OSGi Development

EclipseRT in Indigo Release Train: Equinox


Part three of Ekkehard Gentz’s Indigo Highlights.

For some years Eclipse has been based on OSGi Bundles, aka Plug
ins. OSGi is provided by Eclipse Equinox and not only runs the IDE,
but also all Eclipse Runtime Environments.

What’s new with the Indigo Release (Eclipse 3.7)?

supports OSGi 4.3

The newest
OSGi Specification 4.3 was released in April 2011 and
Eclipse Equinox already supports this – just a few weeks later.
Isn’t this fast ?


OSGi R4.3 Core
Framework API Updates: OSGi now supports generics – some of you
have waited for this for a long time ;-) ServiceRegistry,
ServiceTracker, BundleTracker and Bundle Interface – generics are
now possible everywhere. OSGi has to support J2ME 1.1 and J2SE 1.4
– and yes, it’s still working. For J2ME platforms the OSGi API is
compiled in a way that allows to continue running on J2SE 1.4. Of
course this also works using Equinox.


Hint: some
packages now are deprecated:




are replaced by these packages:




Good news also
for all fans of bytecode-weaving – the manipulating of bytecode at
runtime. There’s a new weaving hook“



Now it’s even
possible to change package dependencies on-the-fly – a powerful but
also dangerous tool.

Equinox and

OSGi is a very
flexible framework, but its also easy to use many different logging
frameworks by independent projects: Log4J, SLF4J, java.util etc.
Many times last year, I opened bugzillas because some projects
declared a required-bundle dependency for logging frameworks. This
isn’t a good idea if you have to use projects together and want to
get all log events into one framework. In the meantime, the
situation has become much better: most projects are using
package-imports instead and so it’s easy to use one framework like
SLF4J, for supporting them all. I’m also glad to notice, that more
and more projects are now using SLF4J together with Logback as
native implementation – that’s also the way I’m going to solve


Besides the
‘legacy’ logging there’s also logging from OSGI framework (Equinox)
and also Eclipse (IDE). It was difficult to use all these API’s
together: ILog, FrameworkLog, OSGi LogService. Indigo makes it
easier, because Equinox Extended OSGi LogService now is part of the
core framework. It doesn’t matter where the log events are produced
– now listeners can watch them all. If you want to know more about
“logging and OSGi here’s a detailed blog series.

Webserver Now with Version 7

Perhaps you
don’t already know, but under the umbrella of Eclipse RT there’s a
high grade webserver – Jetty. OSGi already includes a HTTP Server –
but I recommend to use a full featured one like Jetty.


Some packages
are renamed for Jetty 7 and some of the upcoming Servlet 3.0 features
are already provided. Using Jetty and Equinox, it’s really easy to
build an OSGi webserver without writing web.xml and deploying as


Of course you
can use Jetty the normal WebApp way, too ;-)

Version 2.3.0 with Powerful Enhancements

applications are alway hungry for data, so you have to think how to
persist them. EclipseLink was a part of release train for the first
time in 2009 (same as Riena) and the project has made good progress
since then.


EclipseLink covers three different parts:


In this article
I’m only looking at JPA. Two or three years ago I used Hibernate in
my customer projects as an ORM Framework. Hibernate is powerful,
but has many dependencies and is also not a good OSGi citizen, so
it’s painful to integrate.


You can use
EclipseLink in SE, EE or OSGi Environments. Also EclipseLink
was used by the Gemini Project to provide a JPA module.


Who doesn’t
know this: the server is up and running with many users, but one
department really needs some more properties added to Entities.
Using EclipseLink 2.3.0 you can do this on-the-fly. Previously,
PersistenceUnits in running applications couldn’t be changed – but
EclipseLink 2.3.0 now allows the user to refresh the EntityManagers
in running applications.


enhancement: Mappings can be stored and changed externally.
EclipseLink 2.3.0 allows the user to store MetaDataSource external
to the running application. Together with the on-the-fly Extending
of Entities you get more dynamicity and flexibility. Kudos to the
team! You can read about all N&N from the eclipseLink project


Gyrex is one of the
new projects this year. Gyrex promises to ease the development of
scalable (even clustered) Equinox-based servers. At the last JAX
conference in May in Germany, I listened to Gunnar Wagenknecht’s
Session and was impressed.



Gyrex is based
on Equinox and Jetty, uses p2 as provisioning engine, RAP as Admin
– UI and allows integration into the Cloud.

Update Target

If you’re
already developing software for different targets, then you have to
know the Target Platform definitions. Using Target Platform
Definitions you build your Target
from update sites, directories etc. to be used by your
product. Using a Target Platform is easy – the way to develop the
target platform could be difficult. Usually it takes some time
until you find out which Software Sites you have to contact and
which features you really need.


A really big
problem was maintaining target platforms – how to survive plugin
updates. There was nothing like Update” and everything
to be done manually. Now the pain has an end: Target
Platforms can be updated – for single software items, or all.
There’s a button added to Target Platform definition Editor:



If no updates
are available, the Target Platform remains unchanged. Hint: make a
copy of your definition before updating.

RTP – another
new RT Project

Now we know
it’s easier to update and maintain Target Platforms. But it’s still
not easy to start and to define the Target Platform for the first
time. This is where the new Runtime Packaging Project (RTP) will help you.
RTP will provide predefined Runtime Packages for common



RTP Packages
can be installed using download and run as stand-alone projects
using a script, or via update-site used as an entry point to define
your platform. Thanks also to the RTP Team, they have collected all
the information on how to install and configure Target
for most of the many Runtime Projects. Now it should
be easy to find the right entry point. http://eclipse.org/rtp/examples/
should be part of the bookmark list for all Runtime developers.


If you now want
to try out some EclipseRT projects or find out how to deal with
target platforms, Kai Tödter has provided an easy-to-follow demo
using Equinox and Jetty together with Vaadin as UI. enMOcs also is a pure
Equinox / Jetty based server to communicate between Enterprise and
mobile devices.


Some more
interesting server projects at EclipseRT are Virgo and Gemini. Gemini
provides EE Modules under OSGi, supporting the complete lifecycle.
Virgo started as SpringSource dm Server and eases the development
of Spring-powered EE- and Web Application Servers under OSGi. You
see there are many different servers available at EclipseRT – try
them out and if none fits your requirements, build your own.


In the next
(4th) part of my series, I will cover DVCS – Distributed Version
Control Systems. We’ll take a look at Git / EGit and
MercurialEclipse. EGit has finally reached 1.0 and next year more
and more Eclipse projects will jump over to EGit.


Check out
part two
of Ekkehard Gentz’s Indigo Highlights, for even more
info on the Eclipse release.

Ekkehard Gentz has worked as an Independent Software Architect for more then 30 years in the domain of business applications (ERP). Ekke's focus is on model driven development, OSGI applications and mobile Java Apps. Ekkehard is Committer at the Eclipse Riena Project and Project lead of Open Source Projects redView, redVoodo, enMOcs and red-open. ekke twitters at @ekkescorner and blogs at http://ekkes-corner.org.
comments powered by Disqus