c0d3d / easy-plugins

Annotation directed service providers, made easy!
Apache License 2.0
3 stars 1 forks source link

OSGi-Friendly Plugins #10

Open peblair opened 7 years ago

peblair commented 7 years ago

cc: @c0d3d easy-plugins works well within a single-classloader environment, but there are challenges involved with running things across OSGi boundaries. In particular, the *Registry classes are only able to discover services via the ServiceLoader API, meaning that the only way of wiring things up in a cross-bundle scenario is via the OSGi service mediator (in theory). Worse, this requires users to break the easy-plugins abstraction by specifying the auto-generated interface in provider bundles' OSGi manifests. To overcome these issues, we should provide better support for wiring up services. Some ideas:

Additionally, there may be good solutions not listed here.

c0d3d commented 7 years ago

My vote is we try for option 3. If that fails, option 2. If that fails, option 1.

peblair commented 7 years ago

Agreed. Note also that we could maybe even cobble together a bndtools plugin, despite the relative lack of documentation. See this interface which makes use of this class. Here is an example of an abstract class which implements a large part of a BND plugin.