Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OSGi Use Cases

 
Dan King
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recently I've been reading about OSGi. What I've understood from my reading is that OSGi offers modularity, 'encapsulation' at the jar level, and 'hot-plugability.' But what I've not been able to discern is when is it 'appropriate' to use OSGi. For example, I have an Http Service that I implemented using CXF. Could I re-do the service using CXF over OSGi? If, yes what would need to change? Lastly, of the various implementations -- Flex, Equinox, Knopflerfish -- which one should I start with as I learn? Thanks.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could I re-do the service using CXF over OSGi?

The question is phrased in a way that leads me to believe that you do not yet fully understand what OSGi is, and how it might be applied to a given application scenario. You probably could implement the WS using OSGi, but the salient question is - why would you? OSGi doesn't offer benefits that apply to every single use case; only once you know which problem you'd like to solve using OSGi can you make an informed decision if, and how, to use it.

Lastly, of the various implementations -- Flex, Equinox, Knopflerfish -- which one should I start with as I learn?

There's no "should". All of them implement OSGi; if you don't know enough about OSGi to discern their differences, then you might as well choose any one of them - they're all plenty mature enough.
 
Dan King
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
The question is phrased in a way that leads me to believe that you do not yet fully understand what OSGi is, and how it might be applied to a given application scenario. You probably could implement the WS using OSGi, but the salient question is - why would you? OSGi doesn't offer benefits that apply to every single use case; only once you know which problem you'd like to solve using OSGi can you make an informed decision if, and how, to use it.


You're correct, I do not fully understand what OSGi is, nor do I fully understand which situations OSGi is suited for; the purpose of the original post was to find answers to both of those questions. So, going back to the WS example, while I could use OSGi, what criteria should I use to determine if i should use OSGi? Furthermore, if you have any example use cases that could demonstrate suitable situations for OSGi, I'd appreciate it if you could share those examples. Thanks.

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once use case is managing plugins for an application. A while ago I wrote about how to do that in stock Java. All that fiddling with classloaders and security managers would be handled by OSGi if each plugin came as an OSGi bundle. And it would be easily possible to add/chabge/remove plugins at application runtime.

The http://www.coderanch.com/how-to/java/OSGiLinks page links to a few introductory articles that may be helpful.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic