Sunday, March 16, 2008

OSGi Declarative Services

Here I found a link on how to use OSGi R4 DS (Declarative Services) and would like to spend some time to learn and use it to replaces our currently adopted Gravity Service Binder (GSB).

http://neilbartlett.name/blog/osgi-articles/

What does GSB do ?
- Traditionnally, bundle developers must program both application and service dependency management logic into their bundles.
- The Service Binder solves this problem by extracting service dependency management logic from the bundles and moving it into an execution environment that is deployed inside the framework as a standard bundle. Service dependency management logic is configured by informations contained in an XML descriptor that extends the bundle manifest.

What DS can provide ?
- There is no OSGi-specific Java code. In other words, the class we wrote is a POJO, and this is a major feature of Declarative Services.

Why OSGi ?
OSGi helps with two shortcomings of the Java platform (not Java language):
- Component Versioning
- Published Interfaces
With OSGi, you can state the version of the bundle you want to import. It also takes into account compatible versions. Since bundles have their own classloaders, you can have different bundles using different versions of the same library without conflict.