An introduction to OSGi


Published on

An introduction to OSGi

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

An introduction to OSGi

  1. 1. First steps in OSGi Andrea Chiodoni, 2009martedì, 17 maggio 2011
  2. 2. Understand: what OSGi is, why OSGi a n d w h y it i s s o important to the Java community.martedì, 17 maggio 2011
  3. 3. Agenda Jar Hell problem A definition of OSGi Modularity and Java Architecture Versioning Sample: Activator Sample: Service OSGi implementations Tools for OSGi Repositories Advanced topics What comes next...martedì, 17 maggio 2011
  4. 4. Jar Hell problem Missing Module construct at Bootstrap Class Loader runtime: JARs are only knows at ${JAVA_HOME}/jre/lib/rt.jar build and deploy time Delegate to Information hiding not properly Extension Class Loader enforced ${JAVA_HOME}/jre/lib/ext/ Version information not consumed Delegate to at runtime System Class Loader ${CLASSPATH} Java SE/EE are subject to JAR Hell Delegate to problem User-Defined Class Loader(s) JAR specification is too old for the time being (JARs are not modules)!martedì, 17 maggio 2011
  5. 5. Modularity and Java 1/2 JSR 277: Java Module System A new module system for Java (JAR -> JAM) Abandoned the 3.12.2008, proceed under Project Jigsaw Project Jigsaw (OpenJDK) Many discussions around “The massive, monolithic JDK” Low-level module system to modularise the JDK 7 Available for developers to use in their own code Not an official part of the Java SE 7! Interoperate with other module systems (OSGi) Apache Harmony (based on OSGi core)martedì, 17 maggio 2011
  6. 6. Modularity and Java 2/2 Open Service Gateway initiative (OSGi) from OSGi Alliance, founded 1999 (Ericsson, IBM, Oracle,...) The Dynamic Module System for Java Target: embedded, client, server systems Widely adopted: even by SUN (Glassfish v3) R1 (JSR 8) in May 2000, R4.1 (JSR 291) in May 2007 (current release) Will be closer to Java (language extensions), SUN- OSGi Alliance effort (JSR 294)martedì, 17 maggio 2011
  7. 7. What is OSGi Extension of the JAR Module = bundle Naming + definition Versioning ■ Gestione automatica delle dipendenze ■ Gestione del ciclo di vita del codice (configurazione e distribuzione dinamica)martedì, 17 maggio 2011
  8. 8. Layered architecture Services Bundles Security Life Cycle Modules Execution Environment Java VM Native Operating Systemmartedì, 17 maggio 2011
  9. 9. Bundle states install refresh update Installed Starting resolve refresh update start Resolved Active stop uninstall uninstall Stopped Uninstalled Explicit transition Automatic transitionmartedì, 17 maggio 2011
  10. 10. Service Registry Service Registry publish Service discover Description Service Provider Service Requester <<bundle>> <<bundle>> bindmartedì, 17 maggio 2011
  11. 11. Sample:xx <<bundle>> <<bundle>> <<service>> A S B register get listenmartedì, 17 maggio 2011
  12. 12. Execution Environments Eclipse Equinox Eclipse Spring DM Server mBedded Server Equinox Edition Apache Felix ServiceMix Kernel Knopflerfishmartedì, 17 maggio 2011
  13. 13. Development Tools Eclipse Maven Bundle Plugin (Apache Felix) Bundle Tool (BND), Code/Bndmartedì, 17 maggio 2011
  14. 14. What comes next Advanced OSGi Standard Services Whiteboard Pattern Event Admin Extender Model Building WEB applications OSGi Bundle Repository (OBR, RFC 112) Spring Dynamic Modules Distributed OSGi Specification (RFC 119, OSGi R4.2) SCA and OSGimartedì, 17 maggio 2011
  15. 15. Referencesì, 17 maggio 2011