Does equinox support to define parent class loader for a installed Bundle? [message #691319] |
Fri, 01 July 2011 04:24  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02391 seconds