Getting your toolbox ready for OSGi


Getting your toolbox ready for OSGi

This is my second post on OSGi. In my previous post, I just mentioned about what OSGi is all about. In the coming posts, I will be explaining on developing OSGi applications. As before, I won't be repeating anything that has been already written so well by other authors. I will be just siting some links to them. I will try to be innovative by linking thoughts in various articles or adding a missing point to the existing article, or giving a new way of doing things.

But, before we begin out on expedition and get our hands dirty on developing OSGi applications, let us pack up our toolbox for it. However if you are too eager to getting a feel of developing applications on OSGi, just read on this article by “Neil Bartlett” on EclipseZone.

There is nothing special that you need in developing OSGi application, other than an OSGi platform implementation jar to your regular Java environment and a simple text editor. Still, we all like tools in our day-to-day life to make things easy. With this post, I will just try to get ourselves acquainted with the tools that will make our life of developing OSGi applications simpler.


Eclipse is my favorite IDE for Java development. Although you can use can continue to use your own favorite IDE, if you are not already using Eclipse; there is more to using Eclipse. Eclipse itself is build on the Equinox runtime that is an OSGi implementation platform, and Eclipse allows to interact with the Equinox runtime. And sometimes its really very easy to developing your bundles in there.

Eclipse calls the so-called OSGi bundles as Plug-in, and the environment it provides for developing these Plug-ins is called Plugin Development Environment popularly called as PDE.


Maven is basically a build management tool – like the Ant, but much much more. Maven can manage a project's build, reporting and documentation from a central piece of information provided by the POM file.

Maven is popularly helpful for its dependency management. It allows a project and all its dependencies to be managed gracefully. The variety of maven plug-ins that are available makes the usage of Maven even simpler to be used for most of the odd kind of projects.

If you are new to Maven, it may feel a bit intimidating, at first, but you will soon feel very comfortable with it and would always think of how could you make use of Maven to make use of your tasks easier. I will not talk more on this – there is enough written on Maven.

Although we could use Ant, the simplicity given by the Maven is just enough to make us learn Maven if we don't know it already - its simple. Believe me!

We will be using the power of Maven to simplify many of our tasks for OSGi.

Pax Projects

Probably the most important tool in your box for the OSGi world would be the set of tools provided by the OPS4J under the Pax project – an umbrella project for all the OSGi projects at OPS4J. OPS4J was probably one of the early adopters of the OSGi, and therefore what they provide is worth the time they have spent on it. There are several projects under the Pax, all geared to making your OSGi life simpler, without any hype attached.

I would have loved to write on the tools provided by the Pax projects, but Craig Walls has made my job easier by posting exactly the same on his blog few days back. So I would just like to refer to it apart from looking at Pax official site.

And if you are wondering where to begin from on the Pax tools, just start on the pax-runner, pax-cursor and pax-construct to begin with.

The version numbers of most of the projects should not make you upset. You will find that most of them are still having a major version of '0'. Probably this is one of their strategies that indicates them avoiding the hype. I don't want to create any hype either, just check it out yourself. And if you find any place that needs improvements, feel free to do it right away, after all OPS4J is not just about liberty of source, its about a community participation.

Spring & Spring-DM

We will be using Spring for what it is popular for – Dependency Injection. Spring-DM (Spring Dynamic Modules for OSGi service platforms) is another project from Spring Framework specifically focussed at OSGI. Probably we all would like our code to work not only in OSGi, but also in other environments as well. In designing such an application, you would probably do not want your domain objects to be coupled with the OSGi API.

That apart, just like Spring provides us with some great tools and utilities to getting our developer life easier, Spring DM will also provides some tools and utilities specific to OSGi, apart from the dependency injection aspects specifically for OSGi.

Whats Next?

Once these tools are at our box we will be in a better position to learn more and develop OSGi applications easily. Its not about mastering the tools above, but knowing about them will give us a holistic understanding of developing OSGi applications easily.

In my forthcoming posts, I will be using up these tools to develop OSGi applications.

blog comments powered by Disqus