Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » DynamicImport-Package question while patching DataNucleus for OSGi
DynamicImport-Package question while patching DataNucleus for OSGi [message #730566] Wed, 28 September 2011 12:04 Go to next message
Matthew T. Adams is currently offline Matthew T. Adams
Messages: 31
Registered: July 2009
Location: Austin, TX
Member

I'm in the process of patching DataNucleus to build better OSGi jars. As such, I've got its POMs configured to use maven-bundle-plugin and I have one question, which is one of practicality versus correctness:

What are the ramifications if I add "DynamicImport-Package: *" just in case there are package dependencies that aren't caught by maven-bundle-plugin?

As I understand it, OSGi class loader(s) will search packages statically declared in Import-Package, and only if not found, will begin searching in packages according to DynamicImport-Package. This seems reasonable given that transparent persistence (ORM) products might need to instantiate not only persistable user classes, but also compile- or run-time generated query classes (like criteria/query classes), as well as product-specific plugins that the product might go looking for.

Any practical advice is appreciated. Unless I hear otherwise, I'm going to add it, if only to make the experience better for the end user.

Thanks,
Matthew
Re: DynamicImport-Package question while patching DataNucleus for OSGi [message #730569 is a reply to message #730566] Wed, 28 September 2011 12:11 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
DynamicImport-Package: * is an anti-pattern which is best avoided. The problem is it can appear to work in many scenarios and then fail miserably when things get a little more complicated.
Re: DynamicImport-Package question while patching DataNucleus for OSGi [message #730570 is a reply to message #730569] Wed, 28 September 2011 12:12 Go to previous messageGo to next message
Matthew T. Adams is currently offline Matthew T. Adams
Messages: 31
Registered: July 2009
Location: Austin, TX
Member

Well, I knew that it was kind of a bad word, but what advice would you give? Just leave it out and let the user figure it out?
Re: DynamicImport-Package question while patching DataNucleus for OSGi [message #730572 is a reply to message #730570] Wed, 28 September 2011 12:14 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Either generate correct manifests automatically or provide suitable imports in the bundlor or bnd template to ensure imports are put in which can't be detected automatically. Accurate manifests are the way to go. Smile
Re: DynamicImport-Package question while patching DataNucleus for OSGi [message #730581 is a reply to message #730572] Wed, 28 September 2011 12:22 Go to previous messageGo to next message
Matthew T. Adams is currently offline Matthew T. Adams
Messages: 31
Registered: July 2009
Location: Austin, TX
Member

Yes, I agree about correct manifests, but it is impossible for an ORM to know about a user's classes at the time the ORM's bundle manifests are created. The ORM is more of a framework, not a user bundle.

If I don't include a "DynamicImport-Package: *", then will the user be able to control things enough without having to wrap the ORM bundles with bnd or something to allow the ORM to instantiate user classes via reflection?

Should the ORM use OSGi-specific means to instantiate user classes via reflection that would allow an ORM manifest to be free from "DynamicImport-Package: *" and would still make it easy for the ORM to just work in OSGi?
Re: DynamicImport-Package question while patching DataNucleus for OSGi [message #730615 is a reply to message #730581] Wed, 28 September 2011 13:45 Go to previous message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 271
Registered: January 2010
Senior Member
Matthew,

You might find this interesting: http://njbartlett.name/2010/08/30/osgi-readiness-loading-classes.html
Previous Topic:JAX bundles included with Virgo
Next Topic:How to deploy Vaadin app to Virgo Jetty Server?
Goto Forum:
  


Current Time: Thu Jul 24 02:45:12 EDT 2014

Powered by FUDForum. Page generated in 0.03078 seconds