You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2013/11/26 14:49:39 UTC

OSGi support preview

Hi everyone,

There were a number of requests to support OSGi deployment of Cayenne over the last couple of years. Finally there is something to show in this area. With the encouragement from cghersi and using his custom-built Cayenne bundle as a prototype, I added OSGi support to 3.2 (SVN trunk). It was a two-part thing - (1) creating Cayenne jars with the right metadata, and (2) providing a seamless bootstrap mechanism for Cayenne class loading. Both of which are present now.

An example of how to write an app with it is on GitHub [1] (of course until we have 3.2.M2, the first prerequisite is to build Cayenne trunk from source). Here is how you start Cayenne in your app:

  Module osgiModule = OsgiModuleBuilder.forProject(Activator.class).withDriver(Driver.class).module();
  ServerRuntime r = new ServerRuntime("cayenne-osgi-example.xml", osgiModule);

Interation can certainly be expanded. E.g. instead of binding the driver, Cayenne might need to refer to an OSGi service that encapsulates the DataSource in the container. But this shouldn’t be too hard to add.

I would appreciate feedback from the community on this, including success/error reports and new feature suggestions. 

Cheers,
Andrus


[1] https://github.com/andrus/cayenne-osgi-example