tags:

views:

485

answers:

2

Is it possible to create Eclipse plugins that auto-discover eachother?

I am developing a set of plugins that need to operate in two primary situations:

  • individually
  • in concert with each other.

When run individually, the plugins should "just work" but when in concert, they will be sharing some of the same model content, and one of the plugins should present the user with a list of other plugins to share content with. eg:

Foo Plugin detected the following plugins it can share ontologies with:

[ ] Bar plugin

[ ] Baz plugin

[ ] Don't share

Does Eclipse offer any internal publication / detection methods that would facilitate this sort of auto-detection of other plugins?

+1  A: 

The answer should be through Declarative Service, which combines the advantages of both eclipse xml extensions and osgi POJO services. Something that is implicitly dynamic like osgi services, but loaded “on demand” like eclipse extensions.

Introduced in 2006 for eclipse3.3, you will find those concepts illustrated in this presentation.

Declarative Services gives the option to define reference to other services. It is also possible to specify the cardinality of the reference. The cardinality is specified using two numbers, the first one, 0 or 1, indicates the optionality, the second one, 1 or n, indicates the multiplicity.

In practice, those DS (Declarative Services) are not easy to use, as you have to access the BundleContext, meaning keeping track of the BundleActivator, which is not always easy...

If what you need is to define some sort of Service Oriented Component Model, this presentation should provide you with the different alternatives existing today, as well as detailing those "Declarative Services"


To publish what rcreswick has found in relation with DS:

VonC
Thanks for the info. I'm working through the links and trying to assimilate a lot of new terminology, but so far this looks like DS are probably the right thing... I just need to understand them better to be sure.
rcreswick
Actually the last link lists other technologies which can achieve the same goal: IPojo in particular looks promising, but not as standard as DS (which is part of OSGI R4)
VonC
Googling for more info about Declarative Services lead me to this tutorial: installment 1: http://www.eclipsezone.com/eclipse/forums/t96740.html installment 2: http://www.eclipsezone.com/eclipse/forums/t97690.rhtml It looks like *exactly* the thing I need. Thanks!
rcreswick
A: 

Well, the OSGI Service Registry can accomplish the sharing of pojo based services at runtime, not the plugins themselves. There are several options to facilitate this, such as coding directly to the OSGI API, Declarative Services, Spring DM and iPojo (I am sure there are others as well).

You may want to check out the Whiteboard Pattern as a means of accomplishing a dynamic Observer/Observable style solution.

Robin