Hello *,

I'm new to Felix but use Eclipse already for a few years. Equinox
supports so-called buddy-class-loading. Does Felix have such a feature,
too? If so, how is it named? I looked for "felix buddy class loading",
but didn't find anything. Is it maybe simply called differently?

If it is not clear to you, what I mean by "buddy class loading", imagine
you have two plugins: my.bundle.a and my.bundle.b. my.bundle.a contains
a framework and my.bundle.b some implementation for it. Thus,
my.bundle.b would define a dependency on my.bundle.a (to import the
interfaces that are provided by the framework), but my.bundle.a would
know nothing about my.bundle.b.

There are situations (especially when integrating non-OSGi-aware systems
into an OSGi context), when the framework in my.bundle.a wants to
instantiate a class from my.bundle.b, but this is not possible as
there's no dependency in this direction. Thus, my.bundle.a would get a
ClassNotFoundException when taking the class name (that was maybe
somehow added to a configuration by my.bundle.b) and trying a
Class.forName(...).

Here comes buddy-class-loading into play: my.bundle.a would say that it
supports it by the following entry in its MANIFEST.MF:

Eclipse-BuddyPolicy: registered

my.bundle.b would declare a dependency on my.bundle.b and say that its
own classes should be available to my.bundle.a by having these two
entries in its MANIFEST.MF:

Require-Bundle: my.bunde.a
Eclipse-RegisterBuddy: my.bunde.a

The important thing is that my.bundle.a still does not reference
my.bundle.b anywhere (the framework must of course not know any of its
implementations), but is still able to load the (exported) classes from
my.bundle.b.

Further information about buddy class loading can be found here:

https://www.jfire.org/modules/phpwiki/index.php/Buddy%20and%20remote%20classloading
http://www.eclipsezone.com/articles/eclipse-vms/

Best regards, Marco :-)




Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to