Wednesday, October 13, 2010

The Book review of OSGi in Action

After finished the technical proofreading of Camel in Action, I finally got some time to write a review of OSGi in Action.

Just like the Camel in Action, Manning invited the committers of Apache project to write the OSGi book. As you know Apache Felix is an OSGi specification implementation, so the writers have the first-hand real world experience of the technology. They tell you not only what you can do with OSGi but also why the OSGi was designed as it is.

The first chapter of this book is free for download, with it you can have brief overview what is OSGi, and see the simple example with it.

If you take a look at the Chapter2, you can get the a deep understand for the OSGi modularity. Why the modularity is so important to software development, what's the shortcoming of the Java package, and how OSGi make a great improvement by creating a bundle with the metadata. With this fundamental knowledge you will grasp the sprit of OSGi modularity.

In Chapter3, the writer give us a whole lifecycle picture of the bundle which is another key part of OSGi. By leveraging this lifecycle API, your bundle isn't a set of classes, they can interact with each other by using the services at the runtime. In Chapter4, you can know how OSGi dynamically works to bring all the services work together.

I highly recommend you to go through the first 4 chapters of the OSGi in Action even if you have some working experience of the OSGi. The writer draws a whole picture of the OSGi technology by give a good explanation from three perspective of OSGi, modularity, lifecycle and services. These information can guide you a right direction when you feel lost in OSGi world.

If you need to build a bundle yourself, or you need to fix the weird exceptions of bundles, please take a good look at the Chapter5 and 6. They can tell you how the bundle metadata works, and what the fragment bundles are and what they can do.

Testing and debugging are a daily part of development, but OSGi has some unique characteristics that makes these tasks more difficult using your normal java development experience. There are some tools and framework can help to do it better. Chapter7 and 8 can definitely give you the handy testing and debugging experiences.

When you deploy the bundle into OSGi platform, there are still some tips you should know about. Chapter 9, 10 can tell you how to manage the bundles and application. By knowing these information, you will have confidences to export to the OSGi jungle and successfully battle the OSGi runtime monster.

If you want to know how to design or architect your OSGi application, there are some general ideas of of the component orientation things you should know in Chapter11, and you can make the best usage of the OSGi by applying the component orientation principles.

I really love the first 10 chapters, they help me greatly in understanding more about the OSGi. The other part of this book covered some advance topics, such as the Blueprint, iPOJO, launching and embedding an OSGi Framework, security, web application etc. They are the interesting topics, but they are too complexed to be covered with just few sections. OSGi Enterprise specifications are also working on these areas, you can get some basic idea about these topics by reading the chapter 12,13,14,15.

If you want to visit the OSGi world and have some success there, OSGi in Action could be a good choice for you :)


  1. Thanks for the quick review. Is there any discussion of declarative services?

    If not - how is the topic of "services" in general covered?

    When reading "Equinox" book I found only DS discussion to be accessible, while the regular services were too hard for me.

    Considering Felix is all command line - I can imagine it is even harder to deal with.

  2. Hi Andriy,
    There is no discussion of declarative services.
    The OSGi in Action mainly show you a generic picture of what OSGi is, how the magic works, etc.
    I think Spring DM already provides this kind of DS implementation to avoid user to get touch with OSGi API.