You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Pazzo Da Legare <pa...@gmail.com> on 2009/08/04 13:38:15 UTC

best practices to use cayenne (3.0M6) under OSGI

Dear all,

Thank you in advance for your time.

I would like to use Cayenne in OSG, could your opinion and best
practices to do it?
Should Cayenne be wrapped in a service bundle? Or could I use it as "a
library" of shared code between bundles?

I'm looking forward to hearing from you,

p

Re: best practices to use cayenne (3.0M6) under OSGI

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Pazzo,
see my post from a few weeks ago:
http://markmail.org/message/admkhniktnvnfid5

I've simply modified the Cayenne JAR adding the OSGi metadata. It is now
deployed separately as a bundle. Then, I have another bundle which
contains the domain classes and some code for loading the configuration
and setting the context class loader (Thread.setContextClassLoader())
whenever I call a Cayenne function from within my persistence bundle.
That way Cayenne can load my domain classes.

Maybe that helps you along a bit. I'm extremely busy at the moment and
haven't had time to produce a patch to make Cayenne more or less work
out of the box in an OSGi environment but this is definitely still on my
task list.

What I think needs doing in Cayenne at some point is:
- Change the Cayenne POM to generate OSGi metadata (currently I'm still
using my own unpublished tool (not Maven-based) but it should be
possible to do this with [1], too)
- An idea I've had is to figure out a way to improve domain class
loading in Cayenne so you can mark a bundle containing Cayenne domain
classes and use the extender model to give Cayenne access to the bundle.
That way, it can use the right class loader to load these classes
without you having to fiddle with the context class loader.

But right now, I'm afraid, I can't promise anything when exactly I get
to this. I hope sometime next month.

Good luck!

[1] http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

On 04.08.2009 13:38:15 Pazzo Da Legare wrote:
> Dear all,
> 
> Thank you in advance for your time.
> 
> I would like to use Cayenne in OSG, could your opinion and best
> practices to do it?
> Should Cayenne be wrapped in a service bundle? Or could I use it as "a
> library" of shared code between bundles?
> 
> I'm looking forward to hearing from you,
> 
> p




Jeremias Maerki