Hello all,
We are developing a desktop application based on Felix and thinking about
the best approach to support plugins and extension points. My goal at the
moment is to try to use only OSGi configuration for this, that is without
any additional plugin/extensions descriptors. Another important goal is to
load lazily, i.e. extensions are loaded only when they are requested, not
when bundle which uses them is loaded.

If you look at Eclipse they have plugins as OSGi bundles. A plugin could
define its own extension points and provide extensions to the other
extension points.
The extension point mechanism Eclipse uses is NOT based on OSGi, that is
they have a plugin descriptor in plugin.xml, eclipse framework code reads
those descriptors at startup and keeps all the wiring between extension
points and their extensions ready in memory.
When an extension point requests all its extensions the framework will
traverse the wiring and will load and activate the required plugins (if they
have not been activated yet) and then it will create the extensions.

Basically to create an extension in Eclipse one needs to provide an
implementation (key1) and specify which extension point it extends (key2).
Two keys here.

If I want to use say declarative services (or simply services) as extension
points mechanism it seems I have only one key: service interface, that is
when I declare my service I just announce to the framework that I have a
service, I don't specify which extension point this service is intended to
extend.

I guess I can add some parameter to the service (i.e. extension point name)
and have the framework code filter out services by this parameter when
requested. It could work, but I don't really like this approach because
these parameters are somewhat soft constraints and not enforced by OSGi in
any way. Another reason I don't like it is because I suspect that the
service (extension) will be loaded when a component requesting this service
is loaded, but I want it to be loaded only when I specifically requested
this service.

Anybody has any thoughts/ideas on that? Are we reinventing a wheel?
Thanks!

-- 
Dmitry Skavish

Reply via email to