• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is OSGi? Is it appliable to any Java application?

 
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What is OSGi and what are its advantages?
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're unfamiliar with OSGi, this article on TSS might be worth checking out.
 
author
Posts: 41
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OSGi is the dynamic module system for Java. In OSGi parlance, a module is known as a bundle. OSGi provides a framework for managing bundles that are packaged as regular Java JAR files with an accompanying manifest. The manifest contains important metadata that describes the bundles and its dependencies to the OSGi framework. However, OSGi is not a prerequisite for using the modularity patterns. OSGi simply provides a runtime environment that enables and enforces modularity on the Java platform. OSGi offers the following capabilities:
  • Modularity: Enables and enforces a modular approach to architecture on the Java platform.
  • Versioning: Supports multiple versions of the same software module deployed within the same Java Virtual Machine (JVM) instance.
  • Hot deployments: Permits modules to be deployed and updated within a running system without restarting the application or the JVM.
  • Encapsulation: Allows modules to hide their implementation details from consuming modules.
  • Service orientation: Encourages service-oriented design principles in a more granular level within the JVM. To accomplish this, OSGi uses μServices.
  • Dependency management: Requires explicit declaration of dependencies between modules.


  • You can read all about OSGi at the OSGi Alliance website.

    OSGi is certainly applicable for any type of application, especially if any of the above advantages interest you. One of the greatest advantages of OSGi is that it enforces modularity. To use OSGi today, you have to embed an OSGi framework, such as Equinox or Apache Felix, into your application. For Java web apps that run on an app server, this can be a bit challenging if the app server itself doesn't do it for you since OSGi uses a different classloader model (i.e. peer) than most app servers (i.e., hierarchical). However, almost all app server platforms are incorporating OSGi and exposing it to the developer and allow you to take advantage of OSGi.

    The beauty of the Java Application Architecture book is that it shows you how to develop modular software even if you cannot use OSGi today (i.e., lack of platform support) so that in the future, you can easily take advantage of the benefits of OSGi (or even Jigsaw in Java 8) when it's available. So the book allows you to start developing modular software today in anticipation of platform support for modularity in the future. Part 3 in the book shows you exactly how easy this can be.

    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.
     
    Ranch Hand
    Posts: 122
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Talk about timing.

    I am being presented a job opportunity where I would learn and develop using OSGI. The project is being defined to me as a two-year long project, with, thus far, "possible" additional opportunities; the additional work mostly dependent upon the success of this two-year project.

    Now I am a complete newbie at OSGI. And while I always welcome the opportunity to learn new technologies, I have to admit I have a little bit of fear over this one. That is because I'm not sure where this OSGI thing is going.

    See, I had not heard of OSGI until my first interview with this project manager a couple of weeks ago. The project manager stated to me that the project involves OSGI, JBoss and Postgres (sp?). He wanted me to know further that there are no Java EE frameworks involved here. As I stated, this is a two year long project. So my fear is that if I go to work on this project for two years and learn all there is to know about this platform, then if I find that I have to put myself back on the job market, will my skill set still be marketable? For two years I will not be working with Java EE, or Spring or Struts, or JPA and Hibernate, the technologies that most java shops are looking for on a job candidate's resume. Will I be able to find another decent java developer position if I work on OSGI for two years? This is the question that keeps nagging me concerning this opportunity.

    I certainly welcome and thank you all for your professional perspective concerning my opportunity and my concern.
    Thank you
    Gary
     
    Jelle Klap
    Bartender
    Posts: 1952
    7
    Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Gary Marshall wrote:
    The project manager stated to me that the project involves OSGI, JBoss and Postgres (sp?). He wanted me to know further that there are no Java EE frameworks involved here.



    How exactly does that work? JBoss pretty much IS a JEE application server, so if they're not planning on using JEE technology I find that a particularly curious choice.
    Further more, if they'll be using Postgres that certainly implies persistence of some kind. I kind of doubt they'll be taking the native SQL approach to that - JPA with a provider like Hibernate or EclipseLink would seem more likely.
    I'm thinking you should probably take the statments made by that project manager with a grain of salt and not worry too much about the negative effects this project might have on the marketability of your skill set.
     
    Kirk Knoernschild
    author
    Posts: 41
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Gary,

    You have a valid concern. I'd wouldn't be too worried about not using Java EE. I would be worried if they said you won't be using any other Java frameworks. You sure the PM is correct on this? I can't imagine developing a Java application without using some other Java framework. Teams almost always use a combination of several frameworks and OSGi doesn't preclude you from using other frameworks. In fact, Spring DM (now known as Blueprint services) is basically the Spring framework for use in an OSGi environment. And it's fantastic! If you don't have the book, you can still see this in action if you download the excerpt and take a look at the example at the end of Chapter 3 (link below). So, in a nutshell, just because you're using OSGi doesn't mean you can't use other frameworks and I'd be more concerned that the team isn't using other proven frameworks than the fact they're using OSGi.

    Something else to keep in mind...Modularity is coming to the Java platform. Every major app server vendor is building their product atop OSGi and many are exposing it's use for development too. Java 8 (due in 2013) is introducing a new module system called Jigsaw that will supposedly be compatible with OSGi. By the end of 2013, modularity is going to be something that every developer is going to need to know to build Java applications. By using OSGi now, you're gaining a lot of really good experience in designing modular software. And even if you're not using OSGi, the book prepares you for impending platform support for modularity by helping you build modular software on the Java platform right now.

    But like I said, if they aren't planning to use any other framework (Spring, Hibernate, etc.), then I'd question what they're doing in the first place. They should be using at least some other frameworks, I would imagine.

    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
     
    Ranch Hand
    Posts: 686
    Mac
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Gary,

    The somebody choose OSGI for the project. That means there is a smart architect sitting there who knows importance of modularity. I believe there must be other supporting frameworks will be used on need basis, and project manager may not aware of it.


    And what made you think that learning something new in software industry will reduce job opportunity for you?

    -Jignesh
     
    Gary Marshall
    Ranch Hand
    Posts: 122
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Thank you all for your time in responding.

    I'm so terribly new at the OSGI thing that its possible I did not understand what the PM was telling me in our first interview. A week ago I asked him again, via email, about using J2EE in the development work - which, I now recall is the development of a "framework" for the modular applications, not the applications themselves. The app development could possibly happen in the future. Here is a snippet of his email response to me:

    "....... I suspect we will be writing some J2EE web apps but right now we are testing that under OSGI Pax-Wicket which departs from the normal J2EE model of doing web app deployment...."

    So there you go. That's what he meant by not using any J2EE frameworks, I guess.

    @Jignesh Patel: What is concerning me is NOT learning something new but rather possibly silo-ing myself into a technology that may or may not be in demand in two years. However thanks to the news from Mr. Knoerschild concerning Java 8 and its relation to OSGI, perhaps I don't need to be concerned about marketability.

    Thanks again
    Gary
     
    You firghten me terribly. I would like to go home now. Here, take this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic