Alessio has posted 2 posts at DZone. View Full User Profile

Spring Dynamic Modules in Action

10.12.2010
| 6515 views |
  • submit to reddit
Published by: Manning Pulications Co.
ISBN: 1935182307

Reviewer Ratings

Relevance:
5

Readability:
4

Overall:
5

Buy it now

One Minute Bottom Line

Although obviously oriented to Spring Dynamic Modules for OSGi(tm) (Spring DM from here) users, this book offers a solid overview of OSGi, detailing its strengths and weakness and how SpringDM tackles them. The largest part of the book describes how to use Spring DM in conjunction with other popular frameworks to write highly dynamic enterprise applications. I highly recommend this book to anyone who wants to start using Spring DM, but also to anyone who wants to pick up OSGi for all the goods it brings, but without having to pay for its complexity and deal with a lot of headaches.

Review

This book is aimed at Java programmers who want to use OSGi with Spring . Although all the major prerequisites (Spring Framework, OSGi, etc..) are covered, previous experience on these subjects will help. All the code samples use Maven2, but the steps are detailed as needed. You can find valuable information about these topics on the relevant Refcardz cited at the end of the review.

Another way to describe this book is as a great recipe book on the subject with a comprehensive introductory part. This is because you will find an answer to many of the questions that could arise while beginning Spring DM ("How do I do integration tests?", "How does framework X have to be configured to work in an OSGi environment?",...).

The first two chapters are devoted to the compulsory overview of Spring and OSGi. These are well-written and give a reasonable overview on the subjects, but anyone with previous experience on these can safely skip them, as all Spring DM concepts will be covered from scratch.

Chapters three to five cover Spring DM installation and basic use, and introduce the various features introduced by the framework to work with OSGi. These are the core chapters, as they discuss what is presently the proposed way to overcome some of the OSGi fallacies and how the framework is intended to be used.

Based on its title, chapter six is supposed to describe how to design enterprise applications using Spring DM. However, a large part of the chapter focuses on “infrastructure” topics (OSGi-fying libraries, creating repositories for them, etc.) while only a little coverage is devoted to enterprise application design. That said, chapter 6.4 is one of the most fundamental in the book because it focuses on the dynamic nature of OSGi services and how to handle it with Spring DM.

Chapters seven and eight are devoted to the use of some of the most broadly used data-access and web frameworks. These are really valuable because integrating these kind of frameworks in the OSGi world is a frequent cause of headaches. Obviously, given the sheer size of the Java ecosystem of libraries and frameworks, only a few of them are discussed. The book guides you through the OSGi-ifiation of the libraries that don’t have an entry in any of the OSGi public repositories. On the data-access side, you’ll learn how to use JDBC or JPA, while the web-related chapter covers Spring MVC, Spring-WS, Restlet, GWT, Wicket and DWR. I think this is really great coverage since many other frameworks face issues already described here when used in an OSGi context.

Chapter nine covers a bunch of advanced concepts, such as integrating Java2 security and configuring embedded web containers. Also, a lot of the chapter is devoted to extending default DM’s extenders to handle special situations.

Chapter ten deals with testing. Both unit and integration tests are covered with a good degree of detail. Mocking support for Spring DM is examined and the authors propose some guidelines on how to organize OSGi tests.

The last two chapters deal with Spring DM support for compendium services and the Blueprint specification. Compendium services are standard services built on the core OSGi specification. These, being standard, can run on any OSGi-compliant container and provide functionalities such as logging, configuration, user administration, http support, etc. The Blueprint specification is all about the standardization of Spring DM. It’s worth mentioning that Spring DM is being incubated at Eclipse as Gemini Blueprint.

The book also offers some appendices that detail the development process of Spring DM bundles with several tools (Eclipse, ANT and Ivy, Maven2 and Pax). The reader is exposed to the use of Maven 2 through the whole book, but the appendix goes in greater detail and explores various Maven plugins. It is also more readable.

I really appreciate the attention that this book puts on nearly every issue I can think of like multiple service handling, multiple bean instances configuration, ORM configuration. Also, testing is a constant presence and you will be exposed to some pitfalls related to testing in several different contexts.

On the other hand, I think that the title is a little misleading. As said before, the provided samples are limited to the topic being discussed, so you don’t get a real, working example of an application that takes advantage of SpringDM. While this is fine if you think about the complexity of the subject, building a simple application throughout the book would have been a much more “complete” experience. It’s worth mentioning that you can find a few sample applications on the Spring DM Server website.

In conclusion, I strongly recommend this book as it both gives a really good overview of the OSGi and Spring DM world and prepares you to use Spring DM in a proficient way. Also, many of the problems you will probably face are discussed and solved (saving you days of frustration). My suggestion is to read this book before beginning to use Spring DM rather than as a reference.

Related Resources
Spring DM Website - http://www.springsource.org/osgi
Spring DM Server Website - http://www.springsource.org/dmserver
Gemini Blueprint Website - http://www.eclipse.org/gemini/blueprint/
Refcardz about many of the topics mentioned: http://refcardz.dzone.com/

Published at DZone with permission of its author, Alessio Spadaro.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)