Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Does equinox support to define parent class loader for a installed Bundle?
Does equinox support to define parent class loader for a installed Bundle? [message #691319] Fri, 01 July 2011 04:24 Go to next message
ext2  is currently offline ext2
Messages: 1
Registered: June 2011
Junior Member
When I am tring embedded equinox in an server. I find it's useful to specify the parent class loader for the installed bundle.

Although this feature is not defined in OSGI specification, but another osgi framework implementation(Apache Felix) support such a feature;

But I really want to use equinox instead of felix, so I am wonderring does Equinox support such a feature?

The feature will be very useful, because the application can play two roles, one role is "bundle" in the equinox plugin system, another is "app module" in the host server.
Re: Does equinox support to define parent class loader for a installed Bundle? [message #691418 is a reply to message #691319] Fri, 01 July 2011 08:28 Go to previous message
Thomas Watson is currently offline Thomas Watson
Messages: 420
Registered: July 2009
Senior Member
I am not familiar with how Felix allows you to specify the parent class loader of a bundle or what kind of flexibility you need. In OSGi there is a specified configuration property "org.osgi.framework.bundle.parent" (see org.osgi.framework.Constants.FRAMEWORK_BUNDLE_PARENT) which can be set to one of 4 values ("boot", "ext", "app", or "framework"). This property will set the parent class loader for all bundle class loaders.

In equinox there is also additional flexibility for controlling the class loader of a bundle. See org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook.createClassLoader(ClassLoader, ClassLoaderDelegate, BundleProtectionDomain, BaseData, String[]). The ClassLoadingHook will get called to create a ClassLoader for a bundle. In this method you could set the parent to be what ever you want. I would still recommend you return an instance of org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader if you went this route.

See http://wiki.eclipse.org/index.php/Adaptor_Hooks for more information on the various framework hooks.

HTH

Tom
Previous Topic:Debugging Options?
Next Topic:Creating an installer job in p2
Goto Forum:
  


Current Time: Thu Jul 31 01:44:30 EDT 2014

Powered by FUDForum. Page generated in 0.02101 seconds