On Thursday 19 April 2007 18:57, Stefano Lenzi wrote:
> Where can find an example of your approach or can you give me more
> detail on how to implement it?

Mathieu kind of explained it, but it roughly goes;

In the "main bundle", i.e. the one that wraps the 3rd party bundle, you create 
a service tracker which looks for some form of "Resource Loading Service" of 
the type you specify. For instance;

 public interface ResourceLoader
 {
     Class loadClass( String name );
     InputStream loadResource( String name );
 }

and the activator in the main bundle links together the classloading need in 
the 3rd party lib with the registered ResourceLoaders. If the 3rd party lib 
is friendly enough to have delegation hooks for the creation process(es), 
then it is straight forward, otherwise don't let the bundle load the 3rd 
party lib directly, and instead create a separate classloader with the bundle 
classloader as the parent, and if the parent fails then your classloader 
delegates via the above mechanism.


Hope that is clear enough...


Cheers
-- 
Niclas Hedhman, Software Developer

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

Reply via email to