With GlassFish v3, developers can deploy their software as traditional modules (jars and wars), but also as OSGi Bundles. Even more: one jar can be a Web Archive and an OSGi Bundle at the same time. It reminds me of the question whether light is a particle or a wave phenomena. It is both, depending on how you look at it.
I blogged about this more than a year ago. GlassFish v3 is not just an evolution, it is a revolutionary concept. Of course, it is also the reference implementation for the Java Enterprise specification, so it does not break the good tradition of GlassFish v2 by providing a first class Java EE compliant Application Server.
But you can also deploy OSGi bundles in GlassFish v3 (you should download the latest promoted build if possible, since this technology is evolving rapidly). And that opens new possibilities --- including some cans of worms, more possibilities lead to more opportunities to screw up. This blogentry by Sahoo is a good starting point to experiment with the dual behavior of applications in GlassFish v3. Sahoo uses the term "hybrid application" for an application that both uses Java EE and OSGi. I also recommend reading Jerome's blog. He provides some examples about using OSGi Declarative Services in GlassFish v3.
There are some distinctions and some minor overlaps between the OSGi goals and the Java EE goals. OSGi provides the modularity and the lifecycle management where the Java Enterprise specifications provide the traditional enterprise functionalities as persistence, transaction support, resource management.
The mental coin flipping that is happening inside my developer head is whether my applications are now OSGi applications that leverage the Java Enterprise functionality, or are they Java Enterprise applications that benefit from the OSGi modular system? The combined functionality of both worlds offers lots of opportunities, but will also give birth to new patterns, do's and dont's. These are exciting times.
written on 14:15.Create comment