Search code examples
jsfejbosgijava-ee-6

Java EE 6 app with OSGi


I had develop an application base on JSF, EJB and JPA. The JSF side with ManagedBeans and Facelets lies in the war-module and my EJBs are in ejb-module. It is not a big thing, let's say 20 pages, 15 ManagedBeans and few entities and EJBs. It's part of my bachelor thesis and one of the requirements says that I need to make this system modular and I should use for that OSGi technology.

So my knowledge about OSGi is almost none and after few hours of googling I didn't make any progress. So I'd like to ask you, how would you divide this app into modules?And can you point me to some tutorial or article where such a procedure is described?Because I didn't find anything that would fit my scenario.

It's app dedicated to managing student projects at university. So there are two roles, teacher and student. Both of them can create projects, teacher confirmes them, students them submits them.

Here is my project structure

ejb module war module

I don't want you of course to give me a whole solution but I'll be glad if could give me something for the start.

Thanks a lot


Solution

  • In a nutshell, OSGI modules are provided as bundles, which can be started, stopped, modified without disturbing other parts of the application.

    When you break your scenario into bundles you will have:

    1. Service (EJB in your case)
    2. ServiceLocator (which will be used by clients like your jsf in this case, this can be part of your client itself)
    3. Client (JSF in your case)

      i. Depending upon complexity of project, you may also break your web into separate bundles like view, dao e.t.c, but in your case I dont think this is required.

    4. Depending upon common code that you may have in your application you may also have a common bundle.

    A very good place to start with Java EE and OSGI is @ Oracle Wiki