wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Why OSGi (Pros and Cons)? What patterns? JAA book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Why OSGi (Pros and Cons)? What patterns? JAA book" Watch "Why OSGi (Pros and Cons)? What patterns? JAA book" New topic
Author

Why OSGi (Pros and Cons)? What patterns? JAA book

Marco Antonio
Ranch Hand

Joined: Apr 23, 2008
Posts: 74
Hi everybody, but specially to Kirk!

In your opinion, why should we design following the OSGi specifications? Which are the advantages to use OSGi? What about the disadvantages? What are the patterns you review in the book?


Thank you so much, and good luck with the book!!!


Any correction of my English will be gratefully accepted.
Kirk Knoernschild
author
Ranch Hand

Joined: Apr 16, 2012
Posts: 41
The advantages of OSGi is that it gives you runtime support for modularity. This allows you to do things like enforcing module relationships at runtime, deploy different versions of a module alongside each other, hot deploy modules to a running application, and enforce module encapsulation. These are all things that standard Java cannot do. At the end of Chapter 3 (download link for this chapter available below), I provide an example that demonstrates how you cannot enforce module encapsulation using standard Java. Then, I show how you can enforce module encapsulation using OSGi. Personally, it's one of my favorite examples. Other favorites of mine include the reference implementation in Chapter 7, the Manage Relationships sample code (inverting and eliminating relationships), the Acyclic Relationships sample code (escalation, demotion, callback)...Ok...I like several of the examples, including Part 3 where I show how to take a system that's designed using the patterns and port it to OSGi. It was just so easy to do and you realize the benefits immediately.

In general, runtime support for modularity makes it easier to design modular software since the runtime container enforces your design time constructs. To design modular software without a runtime container, you have to employ other tools (i.e., JarAnalyzer in the book) and techniques (i.e., Levelize Build) to enforce modularity. I'd argue that if you don't already have a modular application, you should focus your efforts on modularizing the application first. Then, start using OSGi. Using OSGi if you don't have a modular application won't provide you all the benefits OSGi offers.

Visit the book's website at modularity.kirkk.com where you can review all 18 patterns and download an excerpt of the book. There is also a mobile web application available that you can take with you wherever you go.

--kirk
Twitter: @pragkirk
Marco Antonio
Ranch Hand

Joined: Apr 23, 2008
Posts: 74
Thank you, Kirk.

Those all things are very interesting and you have awakened my curiosity about OSGi and what it can provide to my job.


Thank you so much!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why OSGi (Pros and Cons)? What patterns? JAA book
 
Similar Threads
J2EE and OSGi
OSGi as a Java standard
JVM level language - OSGi + Clojure?
What is OSGi? Is it appliable to any Java application?
OSGi Use Cases