Chapter 4.2 - Draft, Verse 138 :
 The Framework Multiplication
         Clement Escoffier, akquinet A.G.
akquinet
                                                       akquinet AG
    akquinet                                            €1300k SE
    business consulting
    GmbH €60k SE



        International       Microsoft / .NET           Outsourcing                  JAVA / SAP            Associate Partners
    akquinet              akquinet               akquinet                    akquinet                    BMC GMBH
    IBS                   dynamic solutions      outsourcing                 it-agile
                                                                                                         cimt AG
    GmbH €250k SE         GmbH €300k SE          gGmbH €250k SE              GmbH €100k SE
                                                                                                         DoubleC GmbH
    akquinet              akquinet               akquinet                    akquinet
    IBS Brüssel           SLS logistics          system integration          tech@spree                  Groupconcept GmbH
    GmbH €40k SE          GmbH €250k SE          GmbH €125k SE               GmbH €300k SE
                                                                                                         infodesign GmbH
    akquinet                                                                 akquinet
                                                                                                         panoptimum GmbH
    eurosoft Sp. z o.o.                                                      enterprise solutions
    €100k SE                                                                 GmbH €80k SE                Portal Systems GmbH
    HKS                                                                                                  PortivITy GmbH
    GmbH €75k SE
                                                                                                         w//Center GmbH

    Partner Power
    International GmbH            akquinet AG   2002   2003    2004   2005   2006   2007   Budget 2008    In association   2007
    Partnerbeteiligung            Staff         64     108     133    165    170    203    315            Staff            433




2                                                            The Framework Multiplication
Modular and Mobile Solutions
    Competence Center focusing on
         Modular Systems
              Modularization expertise
              OSGi-based
              Sophisticated, Large scale, Distributed systems
         Mobile Solutions
              In the large
                MobileDevices, Interactions middleware, Server-side …
                M2M, Data collection and Mediation, Control loop

    Technologies
         iPHONE / Android
         OSGi (Apache Felix, Apace Ace, OW2 Chameleon, Apache Sling…)
         Java EE (JBOSS, OW2 JOnAS)

 3                                              The Framework Multiplication
Why multiple OSGi frameworks
in one VM ?
    OSGi has made a successful
     breakthrough                                         Bundle
                                                       (packaging and      Service binding
         THE module layer on the top of              deployment unit)     (loose-coupled,
          Java                                                                dynamic)



    Wide spread usages as
     middleware kernel
         Mobile devices
         Desktop applications
         Lightweight Application servers
         Enterprise Application Servers

    More and more used by                            OSGi™ framework
     application themselves
         Modularity                                  Java Virtual Machine
         Dynamism
         Provisioning

 4                                          The Framework Multiplication
Why ? - Runtime/ Application isolation
  Conflicts   !
       Internal / Private API
        exposed by the middleware
        used unexpectedly by the
        applications
       Version conflict on third-
        party libraries


                                               OSGi™ framework

                                               Java Virtual Machine



 5                                   The Framework Multiplication
Why ? – Application Model
                                      composite {
  Creation    of composite
                                          Install-Bundle:
       Deployment packages++                     foo; bundle-version=[1.0.0,1.2.0),
                                                  bar; bundle-version=[1.0.0,1.0.0]
       Allows to describes               Import-Package: waz; version=2.0.0
        applications                      Export-Package: baz; version=1.0.1
                                          }
                                                                                  Exemple

  Such   composites should
     be ran in an isolated child
     framework
                                                 Child framework

                                             OSGi™ framework

                                             Java Virtual Machine

 6                                 The Framework Multiplication
Why ? – Avoid applications conflicts
  Same        issues as the middleware /applications conflicts
         Two applications may share services
            But sometimes …. NOT !
            Stateful services

         Third-party library conflicts


  By      using separate frameworks
         Guaranty a service isolation
         Guaranty a third-party libraries isolation




 7                                        The Framework Multiplication
How do we solve that today ?
The Launcher approach
  OSGi   R4.2 has standardized how to create OSGi
     framework instances
         Framework Factory
         factory.newFramework(config)



                       FWK 1                  FWK 2


                                Launcher


                           Java Virtual Machine

 8                                  The Framework Multiplication
How do we solve that today ?
The Child approach
  A      bundle instantiates a new OSGi framework
       The lifecycle of this framework is managed by the bundle
       Relationships between the intra-bundle and the external world
        are managed by the bundle
              May be tricky….


                                 OSGi Framework

                                    Bundle

                                     OSGi Framework

                                    Java Virtual Machine

 9                                           The Framework Multiplication
Does this work ?
  In simple cases … YES
  In sophisticated cases …. Absolutely NO


         Cross-framework singleton bundle ?
              A singleton bundle may be resolved several times on the JVM

         URL Streams have to be multiplexed
              The JVM supports only ONE extension of the URL class
              What happens if several framework provide several times the same URL
               Handler ?

         The Security Manager is a JVM Singleton
              The condition permission admin directly uses the JVM security
                No   way to adapt the security policy per framework

 10                                              The Framework Multiplication
The RFC 0138
Multiple Frameworks In One JVM
  OSGi       R4.2 RFC

      Not pushed in the OSGi R4.2 because of some direct impacts
       on the framework
           Will be somewhere in OSGi R5


      Assumption
           Each framework manages its own class space, and is responsible for
            managing the lifecycle and resolution of its bundles.
              Class  reachability inside the framework is managed by bundle resolution
               and classloading rules
              Class reachability outside the framework is managed by standard
               classloading rules and hierarchies


 11                                         The Framework Multiplication
Child Framework
  Define   a way to create child frameworks
    Created thanks to a Framework service
     (CompositeBundleFactory)
    Similar to the Launcher API
         Framework configuration
         Composite Manifest




 12                                 The Framework Multiplication
Composite Manifest
    A Composite Manifest may contain
         Bundle-Version and Bundle-SymbolicName
         Import-Package from the parent framework
         Export-Package from the child to the parent
         CompositeServiceFilter-Export
              Exports services from the child to the parent
              Equivalent to iPOJO exports
         CompositeServiceFilter-Import
              Imports a service from the parent to the child
              Equivalent to iPOJO imports

    No way to install bundles directly in the composite
         At least in the last version of the RFC
         Allows to define your ADL, to choose your provisioning mechanism...
         Can be done with the framework configuration map

 13                                              The Framework Multiplication
The parent – child relationship
  Child
       frameworks
  managed by
      A composite bundle                               Child Framework
           Representing the child into
            the parent                                                         Surrogate
                                                                                 Bundle
      A surrogate bundle
           Representing the parent into
            the child
                                                   Composite
                                                    Bundle


                                                         OSGi Framework

                                                        Java Virtual Machine

 14                                        The Framework Multiplication
Surrogate & Composite Bundles
  The Surrogate represents the parent framework into the
  child framework
      Publishes imported services into the child service registry
      Exports imported packages


  TheComposite represents the child framework into the
  parent framework
      Publishes exported services into the parent service registry
      Exports exported packages




 15                                The Framework Multiplication
Singleton Multiplexing
  Propose     a way to multiplex URL Handler without
  conflicts

  Objective
      Resolve URL by using the ‘adequate’ URL Handler
      Already done inside Felix
         Analyze from the stack trace which Framework triggers the URL
          resolving
         Use the good URL Handler service




 16                                  The Framework Multiplication
What else ?
  …


  RFC       not included into OSGi R4.2
      Break the system bundle lifecycle (RESOLVED state ?)
           Impact the core specification
      Surrogate bundles are complex
           Why not reusing the System Bundle ?
      The specification does not cover all use cases
         Security ?
         Others singletons ?



  However, it’s       still a work in progress…

 17                                         The Framework Multiplication
Conclusion
  Beingable to launch several frameworks inside the same
  VM is definitely required
      But it’s not so simple !


  The    RFC 0138 proposes a first draft addressing the issues
      Child framework creation and management
      Singleton multiplexing


  However, it’s    far from complete
      And complex to implement…


 18                               The Framework Multiplication
What might be cool
  A   real composite bundle description language
      ADL
      Abstract placeholder
           Dynamism, Substitution


  Creating       a bridge with the deployment admin
      A deployment package could create a child framework

  Sandbox        mechanism
      Like on the iPHONE



 19                                  The Framework Multiplication
Questions ?




     Karl Pauls                                       Dr. Clement Escoffier
     karl.pauls@akquinet.de                  clement.escoffier@akquinet.de
     Bülowstraße 66, 10783 Berlin              Bülowstraße 66, 10783 Berlin
     +49 151 226 49 845                                   +49 175 2467717
20                                  The Framework Multiplication

The OSGi Framework Multiplication

  • 1.
    Chapter 4.2 -Draft, Verse 138 : The Framework Multiplication Clement Escoffier, akquinet A.G.
  • 2.
    akquinet akquinet AG akquinet €1300k SE business consulting GmbH €60k SE International Microsoft / .NET Outsourcing JAVA / SAP Associate Partners akquinet akquinet akquinet akquinet BMC GMBH IBS dynamic solutions outsourcing it-agile cimt AG GmbH €250k SE GmbH €300k SE gGmbH €250k SE GmbH €100k SE DoubleC GmbH akquinet akquinet akquinet akquinet IBS Brüssel SLS logistics system integration tech@spree Groupconcept GmbH GmbH €40k SE GmbH €250k SE GmbH €125k SE GmbH €300k SE infodesign GmbH akquinet akquinet panoptimum GmbH eurosoft Sp. z o.o. enterprise solutions €100k SE GmbH €80k SE Portal Systems GmbH HKS PortivITy GmbH GmbH €75k SE w//Center GmbH Partner Power International GmbH akquinet AG 2002 2003 2004 2005 2006 2007 Budget 2008 In association 2007 Partnerbeteiligung Staff 64 108 133 165 170 203 315 Staff 433 2 The Framework Multiplication
  • 3.
    Modular and MobileSolutions   Competence Center focusing on   Modular Systems   Modularization expertise   OSGi-based   Sophisticated, Large scale, Distributed systems   Mobile Solutions   In the large  MobileDevices, Interactions middleware, Server-side …  M2M, Data collection and Mediation, Control loop   Technologies   iPHONE / Android   OSGi (Apache Felix, Apace Ace, OW2 Chameleon, Apache Sling…)   Java EE (JBOSS, OW2 JOnAS) 3 The Framework Multiplication
  • 4.
    Why multiple OSGiframeworks in one VM ?   OSGi has made a successful breakthrough Bundle (packaging and Service binding   THE module layer on the top of deployment unit) (loose-coupled, Java dynamic)   Wide spread usages as middleware kernel   Mobile devices   Desktop applications   Lightweight Application servers   Enterprise Application Servers   More and more used by OSGi™ framework application themselves   Modularity Java Virtual Machine   Dynamism   Provisioning 4 The Framework Multiplication
  • 5.
    Why ? -Runtime/ Application isolation   Conflicts !   Internal / Private API exposed by the middleware used unexpectedly by the applications   Version conflict on third- party libraries OSGi™ framework Java Virtual Machine 5 The Framework Multiplication
  • 6.
    Why ? –Application Model composite {   Creation of composite Install-Bundle:   Deployment packages++ foo; bundle-version=[1.0.0,1.2.0), bar; bundle-version=[1.0.0,1.0.0]   Allows to describes Import-Package: waz; version=2.0.0 applications Export-Package: baz; version=1.0.1 } Exemple   Such composites should be ran in an isolated child framework Child framework OSGi™ framework Java Virtual Machine 6 The Framework Multiplication
  • 7.
    Why ? –Avoid applications conflicts   Same issues as the middleware /applications conflicts   Two applications may share services   But sometimes …. NOT !   Stateful services   Third-party library conflicts   By using separate frameworks   Guaranty a service isolation   Guaranty a third-party libraries isolation 7 The Framework Multiplication
  • 8.
    How do wesolve that today ? The Launcher approach   OSGi R4.2 has standardized how to create OSGi framework instances   Framework Factory   factory.newFramework(config) FWK 1 FWK 2 Launcher Java Virtual Machine 8 The Framework Multiplication
  • 9.
    How do wesolve that today ? The Child approach   A bundle instantiates a new OSGi framework   The lifecycle of this framework is managed by the bundle   Relationships between the intra-bundle and the external world are managed by the bundle   May be tricky…. OSGi Framework Bundle OSGi Framework Java Virtual Machine 9 The Framework Multiplication
  • 10.
    Does this work?   In simple cases … YES   In sophisticated cases …. Absolutely NO   Cross-framework singleton bundle ?   A singleton bundle may be resolved several times on the JVM   URL Streams have to be multiplexed   The JVM supports only ONE extension of the URL class   What happens if several framework provide several times the same URL Handler ?   The Security Manager is a JVM Singleton   The condition permission admin directly uses the JVM security  No way to adapt the security policy per framework 10 The Framework Multiplication
  • 11.
    The RFC 0138 MultipleFrameworks In One JVM   OSGi R4.2 RFC   Not pushed in the OSGi R4.2 because of some direct impacts on the framework   Will be somewhere in OSGi R5   Assumption   Each framework manages its own class space, and is responsible for managing the lifecycle and resolution of its bundles.   Class reachability inside the framework is managed by bundle resolution and classloading rules   Class reachability outside the framework is managed by standard classloading rules and hierarchies 11 The Framework Multiplication
  • 12.
    Child Framework   Define a way to create child frameworks   Created thanks to a Framework service (CompositeBundleFactory)   Similar to the Launcher API   Framework configuration   Composite Manifest 12 The Framework Multiplication
  • 13.
    Composite Manifest   A Composite Manifest may contain   Bundle-Version and Bundle-SymbolicName   Import-Package from the parent framework   Export-Package from the child to the parent   CompositeServiceFilter-Export   Exports services from the child to the parent   Equivalent to iPOJO exports   CompositeServiceFilter-Import   Imports a service from the parent to the child   Equivalent to iPOJO imports   No way to install bundles directly in the composite   At least in the last version of the RFC   Allows to define your ADL, to choose your provisioning mechanism...   Can be done with the framework configuration map 13 The Framework Multiplication
  • 14.
    The parent –child relationship   Child frameworks managed by   A composite bundle Child Framework   Representing the child into the parent Surrogate Bundle   A surrogate bundle   Representing the parent into the child Composite Bundle OSGi Framework Java Virtual Machine 14 The Framework Multiplication
  • 15.
    Surrogate & CompositeBundles   The Surrogate represents the parent framework into the child framework   Publishes imported services into the child service registry   Exports imported packages   TheComposite represents the child framework into the parent framework   Publishes exported services into the parent service registry   Exports exported packages 15 The Framework Multiplication
  • 16.
    Singleton Multiplexing   Propose a way to multiplex URL Handler without conflicts   Objective   Resolve URL by using the ‘adequate’ URL Handler   Already done inside Felix   Analyze from the stack trace which Framework triggers the URL resolving   Use the good URL Handler service 16 The Framework Multiplication
  • 17.
    What else ?  …   RFC not included into OSGi R4.2   Break the system bundle lifecycle (RESOLVED state ?)   Impact the core specification   Surrogate bundles are complex   Why not reusing the System Bundle ?   The specification does not cover all use cases   Security ?   Others singletons ?   However, it’s still a work in progress… 17 The Framework Multiplication
  • 18.
    Conclusion   Beingable tolaunch several frameworks inside the same VM is definitely required   But it’s not so simple !   The RFC 0138 proposes a first draft addressing the issues   Child framework creation and management   Singleton multiplexing   However, it’s far from complete   And complex to implement… 18 The Framework Multiplication
  • 19.
    What might becool   A real composite bundle description language   ADL   Abstract placeholder   Dynamism, Substitution   Creating a bridge with the deployment admin   A deployment package could create a child framework   Sandbox mechanism   Like on the iPHONE 19 The Framework Multiplication
  • 20.
    Questions ? Karl Pauls Dr. Clement Escoffier karl.pauls@akquinet.de clement.escoffier@akquinet.de Bülowstraße 66, 10783 Berlin Bülowstraße 66, 10783 Berlin +49 151 226 49 845 +49 175 2467717 20 The Framework Multiplication