the osgi framework multiplication

20
Chapter 4.2 - Draft, Verse 138 : The Framework Multiplication Clement Escoffier, akquinet A.G.

Upload: clement-escoffier

Post on 18-Dec-2014

1.061 views

Category:

Technology


0 download

DESCRIPTION

This presentations explores the RFC 138 of OSGi R4.2 draft : Multiple Frameworks in one VM.

TRANSCRIPT

Page 1: The OSGi Framework Multiplication

Chapter 4.2 - Draft, Verse 138 : The Framework Multiplication

Clement Escoffier, akquinet A.G.

Page 2: The OSGi Framework Multiplication

akquinet

Partner Power International GmbH Partnerbeteiligung

akquinet business consulting GmbH €60k SE

Associate Partners

BMC GMBH

cimt AG

DoubleC GmbH

Groupconcept GmbH

infodesign GmbH

panoptimum GmbH

Portal Systems GmbH

PortivITy GmbH

w//Center GmbH

In association 2007

Staff 433

International

akquinet IBS GmbH €250k SE

akquinet IBS Brüssel GmbH €40k SE

akquinet eurosoft Sp. z o.o. €100k SE

HKS GmbH €75k SE

Microsoft / .NET

akquinet dynamic solutions GmbH €300k SE

akquinet SLS logistics GmbH €250k SE

Outsourcing

akquinet outsourcing gGmbH €250k SE

akquinet system integration GmbH €125k SE

JAVA / SAP

akquinet it-agile GmbH €100k SE

akquinet tech@spree GmbH €300k SE

akquinet enterprise solutions GmbH €80k SE

akquinet AG 2002 2003 2004 2005 2006 2007 Budget 2008

Staff 64 108 133 165 170 203 315

akquinet AG €1300k SE

2 The Framework Multiplication

Page 3: The OSGi 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

 Mobile Devices, 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

Page 4: The OSGi Framework Multiplication

Why multiple OSGi frameworks in one VM ?   OSGi has made a successful

breakthrough   THE module layer on the top of

Java

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

  More and more used by application themselves   Modularity   Dynamism   Provisioning

Java Virtual Machine

OSGi™ framework

Bundle (packaging and

deployment unit) Service binding (loose-coupled,

dynamic)

4 The Framework Multiplication

Page 5: The OSGi 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

Java Virtual Machine

OSGi™ framework

5 The Framework Multiplication

Page 6: The OSGi Framework Multiplication

Why ? – Application Model   Creation of composite

  Deployment packages++   Allows to describes

applications

  Such composites should be ran in an isolated child framework

composite {

Install-Bundle: foo; bundle-version=[1.0.0,1.2.0), bar; bundle-version=[1.0.0,1.0.0] Import-Package: waz; version=2.0.0 Export-Package: baz; version=1.0.1 }

Exemple

Java Virtual Machine

OSGi™ framework

Child framework

6 The Framework Multiplication

Page 7: The OSGi 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

Page 8: The OSGi 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)

Java Virtual Machine

Launcher

FWK 1 FWK 2

8 The Framework Multiplication

Page 9: The OSGi 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….

Java Virtual Machine

Bundle

OSGi Framework

OSGi Framework

9 The Framework Multiplication

Page 10: The OSGi 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

Page 11: The OSGi 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

Page 12: The OSGi 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

Page 13: The OSGi 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

Page 14: The OSGi Framework Multiplication

The parent – child relationship   Child frameworks

managed by   A composite bundle

  Representing the child into the parent

  A surrogate bundle   Representing the parent into

the child

Java Virtual Machine

OSGi Framework

Child Framework

Composite Bundle

Surrogate Bundle

14 The Framework Multiplication

Page 15: The OSGi 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

  The Composite represents the child framework into the parent framework   Publishes exported services into the parent service registry   Exports exported packages

15 The Framework Multiplication

Page 16: The OSGi 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

Page 17: The OSGi 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

Page 18: The OSGi Framework Multiplication

Conclusion   Being able 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

Page 19: The OSGi 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

Page 20: The OSGi Framework Multiplication

Questions ?

The Framework Multiplication 20

Karl Pauls [email protected] Bülowstraße 66, 10783 Berlin +49 151 226 49 845

Dr. Clement Escoffier [email protected]

Bülowstraße 66, 10783 Berlin +49 175 2467717