SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
OSGi Overview

      Presenter: Alex Proca



BJUG - 23 oct 2012
Plan
   Problem
   Solution
   Architecture
   Tools
   Demo & Q




                   BJUG - 23 oct 2012
Plan
   Problem
       Dependency Management
           Version Hell
           Conflicting dependencies
           Class loading issues
       Dynamic Behavior
           Difficulties to control component lifecycle
       Lack of a pure modularity solution
   Solution
   Architecture
   Tools
   Demo & Q

                                               BJUG - 23 oct 2012
Dependency Management
   Version Hell - The first case is when a developer or deployer of a Java application
    has accidentally made two different versions of a library available to the system. This will
    not be considered an error by the system. Rather, the system will load classes from one
    or the other library. Adding the new library to the list of available libraries instead of
    replacing it, may see the application still behaving as though the old library is in use,
    which it may well be
   Conflicting dependencies - Another version of the problem arises when two
    libraries (or a library and the application) require different versions of the same third
    library. If both versions of the third library use the same class names, there is no way to
    load both versions of the third library with the same classloader
   Class loading issues - The most complex JAR hell problems arise in circumstances
    that take advantage of the full complexity of the classloading system. A Java program is
    not required to use only a single "flat" classloader, but instead may be composed of
    several (potentially very many) nested, cooperating classloaders. Classes loaded by
    different classloaders may interact in complex ways not fully comprehended by a
    developer, leading to inexplicable errors or bugs.



                                                    BJUG - 23 oct 2012
Dynamic Behavior

   Components and services needs to be installed / removed
   Components need to get updated / replaced
   Components need to be started / stopped



   Example
       Eclipse install/remove plugins/features




                                                  BJUG - 23 oct 2012
Lack of a pure modularity solution
   JVM does not address modularity
       JAR is a black box
           No dependency and no version


   Pure JVM modularity ?
       Jigsaw for JDK 8


   But OSGi is available now




                                           BJUG - 23 oct 2012
Plan
   Problem
   Solution
       OSGi layers
       Deployment infrastructure
           Bundle = byte code + metadata (imports / exports)
           Bundle Activator
           Bundle Dependencies
           Bundles have a lifecycle
           Bundles have their own class loader
           Bundle Versioning
       Service Platform
       Security Layer
       Issues
       Related Projects
   Tools
   Demo & Q

                                                  BJUG - 23 oct 2012
OSGi layers
   OSGi Framework
       Bundles (modules)
       Execution environment
       Application lifecycle
       Services
           Service registry
       Security
   Application share the same JVM




                                BJUG - 23 oct 2012
Bundle
   Bundle - Basic deployment entity (~ application, library)
       Versioned (1.0.2.rc3 – major, minor, micro, qualifier)
       Declaratively specified dependencies
       Represented as JAR file of
           Code, resources
           Extended Manifest file
   Bundle fragments
       Similar to bundles
           Allow extending an existing bundle (often used for testing extended
            bundle)
           Requires a host bundle



                                             BJUG - 23 oct 2012
Bundle Activator
   Class defined in manifest.mf
       Bundle-Activator header
           Can be an external class

   Handle bundle start / stop
       Start
           Register services
           Create service trackers
           Start threads
       Stop
           Release resources
               Unregister own services
               Release used services


                                          BJUG - 23 oct 2012
Bundle dependencies
   Expose packages
       List all of (packages + versions + attributes)
       Fine grained package filtering
   Import Bundle
       Require specific versions (ex. [10.0.0, 13.0.1) )
   Require bundle
       Restricts further changes in API (not recommended)
   Bundle Class path
       Embedded bundle dependencies
           Maven bnd plugin uses this feature to transform some non OSGi
            libraries to OSGi bundles


                                            BJUG - 23 oct 2012
Bundle life cycle




                    BJUG - 23 oct 2012
Separate classloaders




                        BJUG - 23 oct 2012
Bundle Versioning
                                                                    Good
Different versions of ZAB in same JVM

                                                                   FOO
               FOO                  Bad (ClassCastException)
               1.0.0
                                            FOO                            ZAB
                                                                           1.0.0
     BAR                     LIB             ZAB                   BAR
     1.0.4                  1.0.1            1.0.0


              Common                         BAR
     ZAB                    ZAB
     1.0.0                  1.1.0             ZAB
                                              1.0.0


                                              BJUG - 23 oct 2012
Plan
   Problem
   Solution
       OSGi layers
       Deployment infrastructure
       Service Platform
           Registering Service
           Consuming Service
           Service Tracker
       Security Layer
       Issues
       Related Projects
   Tools
   Demo & Q

                                    BJUG - 23 oct 2012
Service
   Bundles – modular but still static entities
       How to communicate between bundles?
   Services – dynamic in OSGi
       Can appear / disappear at runtime in according to a condition
       For one service name multiple providers can exist
   Service
       Object registered by a bundle
           BundleContext.registerService(Interface, Impl, Properties)
           Framework automatically unregister all services of stopped bundle




                                             BJUG - 23 oct 2012
Registering Service
   Programmatically in Bundle Activator
       Problems : semantics not clear



   Declaratively
       DS
           Service-Component header refers to xml declaring the service




                                            BJUG - 23 oct 2012
Consuming Service
   Bundle can search for service implementing specific
    interface
   Components
       Declare getter components




                                    BJUG - 23 oct 2012
Service tracker – Consuming Service
   Tracking for service
       Filters by some properties defined with the service
           LDAP syntax (ex. (&(type=“dh”)(heavy=“false”)))




                                             BJUG - 23 oct 2012
Plan
   Problem
   Solution
       OSGi layers
       Deployment infrastructure
       Service Platform
       Security Layer
       Issues
       Implementations
       Related Projects
   Tools
   Demo & Q

                                    BJUG - 23 oct 2012
Security Layer
   Optional (most people does not use security)
   Based on Java 2 Security Architecture
   4 roles
       Developer
           Adds local permissions to the bundle by signning
       Deployer
           Sign the bundle and deploy
       Operator
           Full control all time
       End User



                                             BJUG - 23 oct 2012
Issues

   No repository defined in standards
       Planned for OSGi4
       Equinox have p2 repo


   Bundle dependency resolver
       Resolving bundles can take long time




                                       BJUG - 23 oct 2012
Implementations
   Equinox
       Bundles can be directories too
       Used by eclipse IDE
   Felix
   Concierge
   Knoplerfish




                                         BJUG - 23 oct 2012
Related Projects
   rOSGi – access services in a remote OSGi
   Glassfish v3
       OSGi replace HK2 (module system)
       Uses Apache Felix
   Spring DM
       Donated to eclipse as Virgo project
       Integration of OSGi inside spring
   Spring application platform
       Similar concepts to OSGi
       Defines bundle repository
   JSR 227
       Java modules, proposed OSGi interoperability

                                       BJUG - 23 oct 2012
Tools



   m2eclipse – bridge between eclipse and maven
   Tycho – build OSGi with maven
   Tycho Extras – utils for OSGi builds




                                BJUG - 23 oct 2012
Credits
   Polyglot OSGi -
    http://www.slideshare.net/mstine/polyglot-osgi
   Introduction to OSGi -
    http://www.slideshare.net/iocanel/introduction-toosgi
   OSGi presentation CZJUG -
    http://www.slideshare.net/mmalohlava/osgi-presentation




                                 BJUG - 23 oct 2012
Thank you




     BJUG - 23 oct 2012

Mais conteúdo relacionado

Mais procurados

OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishOSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishArun Gupta
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011njbartlett
 
Architecture | Modular Enterprise Applications | Mark Nuttall
Architecture | Modular Enterprise Applications | Mark NuttallArchitecture | Modular Enterprise Applications | Mark Nuttall
Architecture | Modular Enterprise Applications | Mark NuttallJAX London
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Martin Toshev
 
OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...
OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...
OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...mfrancis
 
Managing Change
Managing ChangeManaging Change
Managing ChangeMirko Jahn
 
Smooth transition to Eclipse in practice
Smooth transition to Eclipse in practiceSmooth transition to Eclipse in practice
Smooth transition to Eclipse in practiceguest301ea
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web ToolkitJeppe Rishede
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)David Bosschaert
 
Java 7 - What's New?
Java 7 - What's New?Java 7 - What's New?
Java 7 - What's New?Kobib9
 
The glideinWMS approach to the ownership of System Images in the Cloud World
The glideinWMS approach to the ownership of System Images in the Cloud WorldThe glideinWMS approach to the ownership of System Images in the Cloud World
The glideinWMS approach to the ownership of System Images in the Cloud WorldIgor Sfiligoi
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineChun-Yu Wang
 
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011Arun Gupta
 
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...mfrancis
 
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFishOSGi & Java EE in GlassFish
OSGi & Java EE in GlassFishSanjeeb Sahoo
 
Scaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationScaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationPuppet
 

Mais procurados (20)

OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishOSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFish
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
Architecture | Modular Enterprise Applications | Mark Nuttall
Architecture | Modular Enterprise Applications | Mark NuttallArchitecture | Modular Enterprise Applications | Mark Nuttall
Architecture | Modular Enterprise Applications | Mark Nuttall
 
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)Modularity of The Java Platform Javaday (http://javaday.org.ua/)
Modularity of The Java Platform Javaday (http://javaday.org.ua/)
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...
OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...
OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, a...
 
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK.v1.0.20191009
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK.v1.0.20191009Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK.v1.0.20191009
Comparison between Oracle JDK, Oracle OpenJDK, and Red Hat OpenJDK.v1.0.20191009
 
Managing Change
Managing ChangeManaging Change
Managing Change
 
Smooth transition to Eclipse in practice
Smooth transition to Eclipse in practiceSmooth transition to Eclipse in practice
Smooth transition to Eclipse in practice
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)
 
Java 7 - What's New?
Java 7 - What's New?Java 7 - What's New?
Java 7 - What's New?
 
The glideinWMS approach to the ownership of System Images in the Cloud World
The glideinWMS approach to the ownership of System Images in the Cloud WorldThe glideinWMS approach to the ownership of System Images in the Cloud World
The glideinWMS approach to the ownership of System Images in the Cloud World
 
Practical OSGi
Practical OSGiPractical OSGi
Practical OSGi
 
Rogue bundles
Rogue bundlesRogue bundles
Rogue bundles
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
 
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
 
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFishOSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
 
Scaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global OrganizationScaling Puppet Usage to a Global Organization
Scaling Puppet Usage to a Global Organization
 

Destaque

OSGi Benefits for the Pervasive Value Chain - D Bandera
OSGi Benefits for the Pervasive Value Chain - D BanderaOSGi Benefits for the Pervasive Value Chain - D Bandera
OSGi Benefits for the Pervasive Value Chain - D Banderamfrancis
 
2005 OSGi Alliance The need of an integration platform
2005 OSGi Alliance The need of an integration platform2005 OSGi Alliance The need of an integration platform
2005 OSGi Alliance The need of an integration platformOSGi Alliance
 
Bitkom 2012 standardpanel_final_juli 13,2012
Bitkom 2012  standardpanel_final_juli 13,2012Bitkom 2012  standardpanel_final_juli 13,2012
Bitkom 2012 standardpanel_final_juli 13,2012OSGi Alliance
 
OSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical UpdateOSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical Updatemfrancis
 
2011 at ConLife Panel on value of standards
2011 at ConLife Panel on value of standards2011 at ConLife Panel on value of standards
2011 at ConLife Panel on value of standardsOSGi Alliance
 
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...mfrancis
 
Digital Home World Summit 2014 susan schwarze
Digital Home World Summit 2014   susan schwarzeDigital Home World Summit 2014   susan schwarze
Digital Home World Summit 2014 susan schwarzeOSGi Alliance
 
Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...
Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...
Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...mfrancis
 
Keynote: OSGi Past, Present and Future - Alex Blewitt
Keynote: OSGi Past, Present and Future - Alex BlewittKeynote: OSGi Past, Present and Future - Alex Blewitt
Keynote: OSGi Past, Present and Future - Alex Blewittmfrancis
 
OSGi in IoT- final 02-15
OSGi in IoT- final 02-15OSGi in IoT- final 02-15
OSGi in IoT- final 02-15OSGi Alliance
 
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...mfrancis
 
OSGi IoT Demo @ CeBIT 2016
OSGi IoT Demo @ CeBIT 2016OSGi IoT Demo @ CeBIT 2016
OSGi IoT Demo @ CeBIT 2016mfrancis
 
OSGi Specification Evolution - BJ Hargrave
OSGi Specification Evolution - BJ HargraveOSGi Specification Evolution - BJ Hargrave
OSGi Specification Evolution - BJ Hargravemfrancis
 
OSGi -Simplifying the IoT Gateway - Walt Bowers
OSGi -Simplifying the IoT Gateway - Walt BowersOSGi -Simplifying the IoT Gateway - Walt Bowers
OSGi -Simplifying the IoT Gateway - Walt Bowersmfrancis
 
How the OSGi Residential Specifications can help to build an ecosystem for sm...
How the OSGi Residential Specifications can help to build an ecosystem for sm...How the OSGi Residential Specifications can help to build an ecosystem for sm...
How the OSGi Residential Specifications can help to build an ecosystem for sm...mfrancis
 
The Home Network Market - Current Status and Solutions - Keynote; 2003
The Home Network Market - Current Status and Solutions - Keynote; 2003The Home Network Market - Current Status and Solutions - Keynote; 2003
The Home Network Market - Current Status and Solutions - Keynote; 2003OSGi Alliance
 
OSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim VerbelenOSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim Verbelenmfrancis
 
OSGi Technology Value Proposition - December 2013
OSGi Technology Value Proposition - December 2013OSGi Technology Value Proposition - December 2013
OSGi Technology Value Proposition - December 2013mfrancis
 

Destaque (20)

OSGi Benefits for the Pervasive Value Chain - D Bandera
OSGi Benefits for the Pervasive Value Chain - D BanderaOSGi Benefits for the Pervasive Value Chain - D Bandera
OSGi Benefits for the Pervasive Value Chain - D Bandera
 
OSGI,
OSGI,OSGI,
OSGI,
 
2005 OSGi Alliance The need of an integration platform
2005 OSGi Alliance The need of an integration platform2005 OSGi Alliance The need of an integration platform
2005 OSGi Alliance The need of an integration platform
 
Bitkom 2012 standardpanel_final_juli 13,2012
Bitkom 2012  standardpanel_final_juli 13,2012Bitkom 2012  standardpanel_final_juli 13,2012
Bitkom 2012 standardpanel_final_juli 13,2012
 
OSGi In A Nutshell
OSGi In A NutshellOSGi In A Nutshell
OSGi In A Nutshell
 
OSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical UpdateOSGi Community Event 2010 - OSGi Technical Update
OSGi Community Event 2010 - OSGi Technical Update
 
2011 at ConLife Panel on value of standards
2011 at ConLife Panel on value of standards2011 at ConLife Panel on value of standards
2011 at ConLife Panel on value of standards
 
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
Release 4 from a Business Perspective - Peter Kriens, OSGi Alliance Fellow; T...
 
Digital Home World Summit 2014 susan schwarze
Digital Home World Summit 2014   susan schwarzeDigital Home World Summit 2014   susan schwarze
Digital Home World Summit 2014 susan schwarze
 
Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...
Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...
Leveraging OSGi Technology for End-to-End Reconfigurability- Enabling a Seaml...
 
Keynote: OSGi Past, Present and Future - Alex Blewitt
Keynote: OSGi Past, Present and Future - Alex BlewittKeynote: OSGi Past, Present and Future - Alex Blewitt
Keynote: OSGi Past, Present and Future - Alex Blewitt
 
OSGi in IoT- final 02-15
OSGi in IoT- final 02-15OSGi in IoT- final 02-15
OSGi in IoT- final 02-15
 
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
 
OSGi IoT Demo @ CeBIT 2016
OSGi IoT Demo @ CeBIT 2016OSGi IoT Demo @ CeBIT 2016
OSGi IoT Demo @ CeBIT 2016
 
OSGi Specification Evolution - BJ Hargrave
OSGi Specification Evolution - BJ HargraveOSGi Specification Evolution - BJ Hargrave
OSGi Specification Evolution - BJ Hargrave
 
OSGi -Simplifying the IoT Gateway - Walt Bowers
OSGi -Simplifying the IoT Gateway - Walt BowersOSGi -Simplifying the IoT Gateway - Walt Bowers
OSGi -Simplifying the IoT Gateway - Walt Bowers
 
How the OSGi Residential Specifications can help to build an ecosystem for sm...
How the OSGi Residential Specifications can help to build an ecosystem for sm...How the OSGi Residential Specifications can help to build an ecosystem for sm...
How the OSGi Residential Specifications can help to build an ecosystem for sm...
 
The Home Network Market - Current Status and Solutions - Keynote; 2003
The Home Network Market - Current Status and Solutions - Keynote; 2003The Home Network Market - Current Status and Solutions - Keynote; 2003
The Home Network Market - Current Status and Solutions - Keynote; 2003
 
OSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim VerbelenOSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim Verbelen
 
OSGi Technology Value Proposition - December 2013
OSGi Technology Value Proposition - December 2013OSGi Technology Value Proposition - December 2013
OSGi Technology Value Proposition - December 2013
 

Semelhante a OSGi overview

Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Peter R. Egli
 
CodeCamp Iasi 10 march 2012 - SolvingThePuzzle
CodeCamp Iasi 10 march 2012 - SolvingThePuzzleCodeCamp Iasi 10 march 2012 - SolvingThePuzzle
CodeCamp Iasi 10 march 2012 - SolvingThePuzzleCodecamp Romania
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi WebinarWSO2
 
Os gi introduction made by Ly MInh Phuong-SOC team
Os gi introduction made by Ly MInh Phuong-SOC teamOs gi introduction made by Ly MInh Phuong-SOC team
Os gi introduction made by Ly MInh Phuong-SOC teamThuy_Dang
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Martin Toshev
 
Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGiMarek Koniew
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGiIlya Rybak
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Jeffrey Groneberg
 
OSGi Applications Clustering using Distributed Shared Memory
OSGi Applications Clustering using Distributed Shared MemoryOSGi Applications Clustering using Distributed Shared Memory
OSGi Applications Clustering using Distributed Shared MemoryAnthony Gelibert
 
OSGi in Action Chapter 1 and 2
OSGi in Action Chapter 1 and 2OSGi in Action Chapter 1 and 2
OSGi in Action Chapter 1 and 2pjhInovex
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1kshanth2101
 
OSGi Training for Carbon Developers
OSGi Training for Carbon DevelopersOSGi Training for Carbon Developers
OSGi Training for Carbon DevelopersAruna Karunarathna
 
OSGi Persistence With EclipseLink
OSGi Persistence With EclipseLinkOSGi Persistence With EclipseLink
OSGi Persistence With EclipseLinkShaun Smith
 
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishOSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishArun Gupta
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiToni Epple
 

Semelhante a OSGi overview (20)

Modular Java
Modular JavaModular Java
Modular Java
 
Osgi Sun 20080820
Osgi Sun 20080820Osgi Sun 20080820
Osgi Sun 20080820
 
Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)
 
OSGi tech session
OSGi tech sessionOSGi tech session
OSGi tech session
 
CodeCamp Iasi 10 march 2012 - SolvingThePuzzle
CodeCamp Iasi 10 march 2012 - SolvingThePuzzleCodeCamp Iasi 10 march 2012 - SolvingThePuzzle
CodeCamp Iasi 10 march 2012 - SolvingThePuzzle
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
Os gi introduction made by Ly MInh Phuong-SOC team
Os gi introduction made by Ly MInh Phuong-SOC teamOs gi introduction made by Ly MInh Phuong-SOC team
Os gi introduction made by Ly MInh Phuong-SOC team
 
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
Modularity of the Java Platform (OSGi, Jigsaw and Penrose)
 
Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGi
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGi
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -
 
OSGi Applications Clustering using Distributed Shared Memory
OSGi Applications Clustering using Distributed Shared MemoryOSGi Applications Clustering using Distributed Shared Memory
OSGi Applications Clustering using Distributed Shared Memory
 
OSGi in Action Chapter 1 and 2
OSGi in Action Chapter 1 and 2OSGi in Action Chapter 1 and 2
OSGi in Action Chapter 1 and 2
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1
 
OSGi Training for Carbon Developers
OSGi Training for Carbon DevelopersOSGi Training for Carbon Developers
OSGi Training for Carbon Developers
 
OSGi Persistence With EclipseLink
OSGi Persistence With EclipseLinkOSGi Persistence With EclipseLink
OSGi Persistence With EclipseLink
 
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishOSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFish
 
Hybrid Applications
Hybrid ApplicationsHybrid Applications
Hybrid Applications
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGi
 
OSGI Modularity
OSGI ModularityOSGI Modularity
OSGI Modularity
 

OSGi overview

  • 1. OSGi Overview Presenter: Alex Proca BJUG - 23 oct 2012
  • 2. Plan  Problem  Solution  Architecture  Tools  Demo & Q BJUG - 23 oct 2012
  • 3. Plan  Problem  Dependency Management  Version Hell  Conflicting dependencies  Class loading issues  Dynamic Behavior  Difficulties to control component lifecycle  Lack of a pure modularity solution  Solution  Architecture  Tools  Demo & Q BJUG - 23 oct 2012
  • 4. Dependency Management  Version Hell - The first case is when a developer or deployer of a Java application has accidentally made two different versions of a library available to the system. This will not be considered an error by the system. Rather, the system will load classes from one or the other library. Adding the new library to the list of available libraries instead of replacing it, may see the application still behaving as though the old library is in use, which it may well be  Conflicting dependencies - Another version of the problem arises when two libraries (or a library and the application) require different versions of the same third library. If both versions of the third library use the same class names, there is no way to load both versions of the third library with the same classloader  Class loading issues - The most complex JAR hell problems arise in circumstances that take advantage of the full complexity of the classloading system. A Java program is not required to use only a single "flat" classloader, but instead may be composed of several (potentially very many) nested, cooperating classloaders. Classes loaded by different classloaders may interact in complex ways not fully comprehended by a developer, leading to inexplicable errors or bugs. BJUG - 23 oct 2012
  • 5. Dynamic Behavior  Components and services needs to be installed / removed  Components need to get updated / replaced  Components need to be started / stopped  Example  Eclipse install/remove plugins/features BJUG - 23 oct 2012
  • 6. Lack of a pure modularity solution  JVM does not address modularity  JAR is a black box  No dependency and no version  Pure JVM modularity ?  Jigsaw for JDK 8  But OSGi is available now BJUG - 23 oct 2012
  • 7. Plan  Problem  Solution  OSGi layers  Deployment infrastructure  Bundle = byte code + metadata (imports / exports)  Bundle Activator  Bundle Dependencies  Bundles have a lifecycle  Bundles have their own class loader  Bundle Versioning  Service Platform  Security Layer  Issues  Related Projects  Tools  Demo & Q BJUG - 23 oct 2012
  • 8. OSGi layers  OSGi Framework  Bundles (modules)  Execution environment  Application lifecycle  Services  Service registry  Security  Application share the same JVM BJUG - 23 oct 2012
  • 9. Bundle  Bundle - Basic deployment entity (~ application, library)  Versioned (1.0.2.rc3 – major, minor, micro, qualifier)  Declaratively specified dependencies  Represented as JAR file of  Code, resources  Extended Manifest file  Bundle fragments  Similar to bundles  Allow extending an existing bundle (often used for testing extended bundle)  Requires a host bundle BJUG - 23 oct 2012
  • 10. Bundle Activator  Class defined in manifest.mf  Bundle-Activator header  Can be an external class  Handle bundle start / stop  Start  Register services  Create service trackers  Start threads  Stop  Release resources  Unregister own services  Release used services BJUG - 23 oct 2012
  • 11. Bundle dependencies  Expose packages  List all of (packages + versions + attributes)  Fine grained package filtering  Import Bundle  Require specific versions (ex. [10.0.0, 13.0.1) )  Require bundle  Restricts further changes in API (not recommended)  Bundle Class path  Embedded bundle dependencies  Maven bnd plugin uses this feature to transform some non OSGi libraries to OSGi bundles BJUG - 23 oct 2012
  • 12. Bundle life cycle BJUG - 23 oct 2012
  • 13. Separate classloaders BJUG - 23 oct 2012
  • 14. Bundle Versioning Good Different versions of ZAB in same JVM FOO FOO Bad (ClassCastException) 1.0.0 FOO ZAB 1.0.0 BAR LIB ZAB BAR 1.0.4 1.0.1 1.0.0 Common BAR ZAB ZAB 1.0.0 1.1.0 ZAB 1.0.0 BJUG - 23 oct 2012
  • 15. Plan  Problem  Solution  OSGi layers  Deployment infrastructure  Service Platform  Registering Service  Consuming Service  Service Tracker  Security Layer  Issues  Related Projects  Tools  Demo & Q BJUG - 23 oct 2012
  • 16. Service  Bundles – modular but still static entities  How to communicate between bundles?  Services – dynamic in OSGi  Can appear / disappear at runtime in according to a condition  For one service name multiple providers can exist  Service  Object registered by a bundle  BundleContext.registerService(Interface, Impl, Properties)  Framework automatically unregister all services of stopped bundle BJUG - 23 oct 2012
  • 17. Registering Service  Programmatically in Bundle Activator  Problems : semantics not clear  Declaratively  DS  Service-Component header refers to xml declaring the service BJUG - 23 oct 2012
  • 18. Consuming Service  Bundle can search for service implementing specific interface  Components  Declare getter components BJUG - 23 oct 2012
  • 19. Service tracker – Consuming Service  Tracking for service  Filters by some properties defined with the service  LDAP syntax (ex. (&(type=“dh”)(heavy=“false”))) BJUG - 23 oct 2012
  • 20. Plan  Problem  Solution  OSGi layers  Deployment infrastructure  Service Platform  Security Layer  Issues  Implementations  Related Projects  Tools  Demo & Q BJUG - 23 oct 2012
  • 21. Security Layer  Optional (most people does not use security)  Based on Java 2 Security Architecture  4 roles  Developer  Adds local permissions to the bundle by signning  Deployer  Sign the bundle and deploy  Operator  Full control all time  End User BJUG - 23 oct 2012
  • 22. Issues  No repository defined in standards  Planned for OSGi4  Equinox have p2 repo  Bundle dependency resolver  Resolving bundles can take long time BJUG - 23 oct 2012
  • 23. Implementations  Equinox  Bundles can be directories too  Used by eclipse IDE  Felix  Concierge  Knoplerfish BJUG - 23 oct 2012
  • 24. Related Projects  rOSGi – access services in a remote OSGi  Glassfish v3  OSGi replace HK2 (module system)  Uses Apache Felix  Spring DM  Donated to eclipse as Virgo project  Integration of OSGi inside spring  Spring application platform  Similar concepts to OSGi  Defines bundle repository  JSR 227  Java modules, proposed OSGi interoperability BJUG - 23 oct 2012
  • 25. Tools  m2eclipse – bridge between eclipse and maven  Tycho – build OSGi with maven  Tycho Extras – utils for OSGi builds BJUG - 23 oct 2012
  • 26. Credits  Polyglot OSGi - http://www.slideshare.net/mstine/polyglot-osgi  Introduction to OSGi - http://www.slideshare.net/iocanel/introduction-toosgi  OSGi presentation CZJUG - http://www.slideshare.net/mmalohlava/osgi-presentation BJUG - 23 oct 2012
  • 27. Thank you BJUG - 23 oct 2012