Building OSGi bundles for ADEP

When building custom enterprise applications and solutions over the Adobe Digital Enterprise Platform, there is often a need to build custom OSGi bundles that deploy/expose services to be used within the application (typically by the UI layer). Such bundles are deployed in the platform’s OSGi container (Apache Felix).

Here’s a sample Java project, that can be used as a reference or a template to help you build your own OSGi bundle within minutes.

The project essentially consists of the following:

  • Sample Service (com.adobe.adep.sample.ADEPSampleService), and its implementation, that is exposed by this bundle.

 

  • osgi-context.xml – configuration file (snippet below) that defines the service bean, and uses Spring (Blueprint) to expose it as an OSGi service, available over Flex and HTTP remoting.

 

  • BND tool/library and the supporting configuration file (snippet below) – to help generate an OSGi bundle.

  • ANT based scripts – to build the final deployable bundle.

 

To build the above project and generate your OSGi bundle, simply import the project in Eclipse and run the associated build.xml file. Or, use ANT over command line to do the same. The final deployable bundle archive (JAR) is generated in the dist directory of your project root directory.

This can now be deployed over the ADEP OSGi container, the URL of which would typically be http://server:port/system/console/bundles. Your deployed bundle would be listed on the console as shown below, once deployed successfully:

 

Of course, this is just a sample that illustrates how easy it is to build your OSGi bundles for ADEP. You could extend this to define more complex, real life services within the bundle and get yourself going in minutes…