Modular Java: Creating Flexible Applications with OSGi and Spring

Author: Craig Walls
Publisher: Pragmatic Bookshelf
Pages: 260
ISBN: 978-1934356401
Aimed at: Java programmers wanting to use OSGi
Rating: 4
Pros: Motivates the use of modularity
Cons: Too much space devoted to PAX/Maven outputs
Reviewed by: Harry Fairhead

The good thing about this book is that it motivates the whole idea of building a modular system. As the author says if you think Java is already modular then you haven't really thought about what modularity is or can be. From this point he demonstrates how to construct a simple Hello World modular program using the OSGi framework - Equinox and Felix - with the most commonly used application servers - Tomcat and Jetty. This is then developed into a client-server model.

All of this is very easy to follow and ideal for the complete beginner to OSGi. Of course if you have any experience of OSGi, and in particular if you are already convinced this is the technology to use, then this isn't so useful.

It is arguable from this point the book becomes less useful. The reason is that the discussion makes too much use of tools - particularly Maven and Pax. Pax automates the creation and building of OSGi projects and its use is sensible but the number of Pax/Maven outputs listed in the book is mostly a waste of space and it doesn't help the overall readability.

The main example is of a JAR search engine which does help show many of the stages in creating a project. Later sections move on to using the Spring framework to more or less allow you to use POJOs as OSGi objects and creating web bundles including how to implement a UI.

The final part of the book goes into how you might convert a project into a production module complete with configuration, administration and distribution.

If you are completely new to the idea of creating applications with OSGi then this is a good place to start - but if you are an expert or already committed to a particular approach then you will probably find more relevant information elsewhere. Great for the OSGi beginner.

Last Updated ( Tuesday, 06 October 2009 )