Skip to content
This repository has been archived by the owner on Jun 28, 2020. It is now read-only.

OSGi-Friendly Plugins #10

Open
peblair opened this issue Oct 17, 2017 · 2 comments
Open

OSGi-Friendly Plugins #10

peblair opened this issue Oct 17, 2017 · 2 comments

Comments

@peblair
Copy link
Collaborator

peblair commented Oct 17, 2017

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:

  • Ability to manually register services with registries (Solves issue 1 but not issue 2). In combination with an OSGi service tracker, this would remove the need for the service mediator.
  • Automatically add the auto-generated service to the OSGi manifest during compilation (which should make the service mediator "just work"...?)
  • Add a method to the registry which returns a service tracker for its associated interface. This has the following benefits: (a) it is a "robust" abstraction which still hides many details, (b) it can be implemented by a plugin.

Additionally, there may be good solutions not listed here.

@c0d3d
Copy link
Owner

c0d3d commented Oct 17, 2017

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

@peblair
Copy link
Collaborator Author

peblair commented Oct 18, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants