As many people have already said, Galileo is available for Friends of Eclipse. As Chris pointed-out, one of the reasons Eclipse is able to ship quality software, consistently on-time, is because of the modularity offered by OSGi.
Using OSGi, developers are able to work independently on their piece and the final product assembled separately. In addition to the componentization, OSGi enables lazy loading. Each bundle can contribute “services” and the bundles are only activated if the services are used. This means that an embedded OSGi application (with 10 bundles) feels as responsive as a fully featured IDE with over 1,000 bundles. This lazy, service based, programming model is extremely powerful, however, very hard to get right. Eclipse 3.5 has completely changed this by making OSGi Declarative Services a first class citizen– Number 2 On My Top 10 List of Galileo Features.
Declarative Services (DS) is an OSGi specification to make it easier to wire services together across bundles. Using DS, developers can specify what services their bundle provides and what services are required. This is all specified „declaratively“ using XML, and the DS bundle is responsible for wiring everything together. Huge kudos go out to ProSyst for this work, with special thanks to Stoyan.
In the example above, this particular component provides a „CommandProvider“ and requires a single instance of the „Dictionary Service“. The Dictionary service is provided in the bundle activator using the Service Tracker:
// register the service context.registerService(DictionaryService.class.getName(), service, props); // create a tracker and track the service dictionaryServiceTracker = new ServiceTracker(context, DictionaryService.class.getName(), null); dictionaryServiceTracker.open(); // have a service listener to implement the whiteboard pattern fContext.addServiceListener(this, "(objectclass=" + Dictionary.class.getName() + ")");
When launched, assuming both the Command Provider and the Dictionary are available, the user can look-up a word using the OSGi console:
Like many of the best Eclipse run-time technologies, the Eclipse tooling is what catapults it into the mainstream. In Eclipse 3.5, the Bundle Development Environment (PDE) introduced top notch tooling for working with DS. Using the DS tooling, you can craft component.xml files using a form based editor. A big thank-you goes to Chris Aniszczyk and Rafael Nobrega for the tooling. Rafael was a Google Summer of Code student!
As well as an excellent Run-time and top notch tooling, Chris also put together a template to help you get started. Simply select New Plug-in Project, and choose the OSGi Declarative Services Example.
Eclipse continues to lead the way by providing Open Source, reference implementations, for a number of key specifications. By providing open implementations, organizations benefit by:
- Sharing the development cost
- Having a very large user base test their implementation
- Having a very large user base exposed to their technology
- Having a variety of different people (with different background) contribute to the work
For more information on DS and OSGi in general, checkout the new book by Jeff McAffer, Paul VanderLei and Simon Archer.
Thanks to ProSyst, Chris, Rafael and everyone else who worked on this implementation. Another shining example of the win-win situation enabled by open source software development.