Inter-plugin communication in Eclipse

前端 未结 2 1297
野的像风
野的像风 2021-02-10 13:42

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:

  • ind
相关标签:
2条回答
  • 2021-02-10 14:07

    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.

    0 讨论(0)
  • 2021-02-10 14:26

    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:

    • Getting Started with OSGi: Introducing Declarative Services
    • Getting Started with OSGi: Declarative Services and Dependencies
    0 讨论(0)
提交回复
热议问题