BT

Comparing Eclipse Extensions and OSGi Services

| by R.J. Lorimer Follow 0 Followers on Jan 24, 2008. Estimated reading time: 2 minutes |
Eclipse extensions and OSGi services are very similar in both nature and intent. However, despite their similarities they carry several differences having come from different backgrounds. Recently re-published on his blog as a PDF, Neil Bartlett has written an article that performs a comparative analysis of Eclipse extensions and a variety of flavors of OSGi services. The article has been specifically targeted towards Java developers familiar with the Eclipse registry, but not OSGi.

The comparison is prefaced with an explanation of the common confusions caused by the co-existence of the Eclipse extension registry and the OSGi service layer:
Since Eclipse adopted the OSGi runtime in version 3.0, there has been some tension between the Extension Registry, which has been a feature of Eclipse from its beginning, and the Service Layer, which came from OSGi and pre- existed the involvement of Eclipse. The cause of the tension is that these two models overlap somewhat, and because they are both intended to solve very similar problems. However "the Devil is in the details", and these two models are different enough to make it impractical for them to be merged. Therefore developers of Eclipse plugins and RCP applications need to make a choice between the two.
The Eclipse extension registry is based on a series of entries in an XML file for each Eclipse plug-in. Bartlett describes the various benefits that XML markup provides over strictly using executable Java.  Basic OSGi services, in contrast to Eclipse extensions, are defined and registered with regular Java code, which has several implications on their behavior. While describing OSGi services, Bartlett explains the inherent differences in their implementation when compared to Eclipse extensions, and the related advantages and disadvantages, making this point:
So what we really want is something that combines the advantages of both extensions and services. Something that is implicitly dynamic like services, but loaded “on demand” like extensions. Ideally, something that can also simplify the code that application developers must write.
This is the void that declarative services are meant to fill. Since both Eclipse extensions and OSGi services have benefits and drawbacks in different areas, declarative OSGi services were created in an attempt to provide benefits from both technologies. Declarative services are still a relatively new technology, and for the 3.3 release of Eclipse (the most recent stable release), declarative services are available in incubator status as a separate download from the Equinox download site.

The key elements of the article are summarized with a comparison matrix that answers the following questions for Eclipse Extensions as well as all previously described varieties of OSGi services (Services, Declarative Services, and Spring-OSGi).
  • What are registered?
  • How are they registered?
  • How are they consumed?
  • What is the cardinality?
  • When are they loaded?
  • How is dynamic installation/uninstallation dealt with?
  • Can caching references to extensions/services cause problems?
Neil Bartlett concludes the article with these thoughts:
In this article I have described in general terms some of the strengths and weaknesses of Eclipse-style extensions and OSGi-style services. However I would not wish my readers to take away a simplistic message that “extensions aren’t dynamic” or “services can’t be used in RCP applications.” I’m afraid the issues are too subtle for that, and there is no substitute for making your own evaluation in the context of your requirements.
To learn more about the relationship of Eclipse Equinox and OSGi, visit the Eclipse Equinox site.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT