SlideShare a Scribd company logo
1 of 80
Download to read offline
Services-First
Migration to OSGi
     BJ Hargrave (IBM)
    Peter Kriens (aQute)
Agenda
•   Modularity Maturity Model
•   The Brick Wall
•   Couplings
•   µServices
•   What Broker?
•   Example
•   Conclusion
Modularity Maturity
         Model
•   1 Ad Hoc

•   2 Managed

•   3 Contracts

•   4 Fences             Page 2   OSGi Alliance Marketing © 2008-2011 . All Rights Reserved,
                                  © IBM Corp. 2011
                                                                                               21.09.2011




•
                  Inspired by Graham Charters’ excellent OSGi Community Event 2011
    5 Optimize    presentation @ http://slidesha.re/q8EHFp
Modularity Maturity
     Model
1. Ad Hoc
•   Flat, manual class path

•   Single name space

•   Full visibility and normal
    accessibility

•   Monolithic

•   Highly coupled

•   Split Packages

•   Add/Shuffle JARs until it works
1. Ad Hoc
•   Flat, manual class path

•   Single name space



                                           e l l
                                          H
•   Full visibility and normal
    accessibility

•   Monolithic


                                       AR
•
•
    Highly coupled

    Split Packages                   J
•   Add/Shuffle JARs until it works
2. Managed
•   Treat JARs as a module

•   JAR Identity

    •   Naming

    •   Versioning

•   Dependencies

•   Repositories
2. Managed
                                      a d
•   Treat JARs as a module


                                 n l o
                                w he t
•   JAR Identity

    •   Naming

                             D o t
    •   Versioning

                                         r n e
•   Dependencies


                                   n t e
•   Repositories
                                 i
3. Contracts
•   Interface based design,
    POJOs

•   Provide contracts for
    each connection
    between JARs

•   Implementation details
    inside the JAR

•   Versioning on contracts
3. Contracts
•
                                     d e r
                                      a
    Interface based design,


                                     o
    POJOs

•   Provide contracts for
                                    l s
                                   s k
                                  s c
                                 a a
    each connection


                                l h
    between JARs

•   Implementation details
    inside the JAR            c
•   Versioning on contracts
4. Fences
•   Explicitly Import/Export
    packages

•   Explicitly specify
    requirements and capabilities

•   Enforce the module
    boundaries

•   Semantic Versioning

•   Side-by-side versioning
    supported
4. Fences
•   Explicitly Import/Export
    packages

•   Explicitly specify
    requirements and capabilities

                                       o d!
•

•
    Enforce the module
    boundaries

    Semantic Versioning
                                    Go
•   Side-by-side versioning
    supported
5. Optimize
•   Exploit concepts for
    modules and contracts

•   Delegated Control

•   Optimize the code base to
    leverage new patterns:

    •   Extender

    •   Whiteboard

•   Repeat
5. Optimize
•   Exploit concepts for
    modules and contracts

•   Delegated Control

•   Optimize the code base to
    leverage new patterns:

    •   Extender

    •   Whiteboard

•   Repeat
Today
             1.
           Ad Hoc




  2.                     3.
Managed               Contracts



              4.
            Fences



              5.
           Optimize
Today
                       1.
                     Ad Hoc            Enterprise

                                                    DI
   vn                                            ,C
 m                                            ice ing
            2.                     3.
    Ivy   Managed               Contracts
                                            gu r
    saw                                       sp
jig
                        4.
                      Fences



                        5.
                     Optimize
Today
                       1.
                     Ad Hoc            Enterprise

                                                    DI
   vn                                             ,C
 m                                            ice ing
            2.                     3.
    Ivy   Managed               Contracts
                                            gu r       OSGi
    saw                                       s p
jig
                        4.
                      Fences



                        5.
                     Optimize
Today
                       1.
                     Ad Hoc            Enterprise

                                                    DI
   vn                                             ,C
 m                                            ice ing
            2.                     3.
    Ivy   Managed               Contracts
                                            gu r       OSGi
    saw                                       s p
jig
                        4.
                      Fences



                        5.
                     Optimize
Class.forName(String)
Class Space
package

class
Class Space
package

class
Class Space
package

class
Class Space


      V1      V2
Class Space


      V1      V2
Class Space


                V1   V2




Class.forName
Class Space


                        V1   V2




x                   x
    Class.forName
Class Space


                        V1   V2




x                   x
    Class.forName
Why Class.forName?
Why Class.forName?
                                        ! ! !
                                ! ! !
                        ! ! !
                ! ! !
         N G!
    P LI
C OU
How to get an Instance?
 That is the Question!
Couplings

           modular    not Example
                     modular

   type                    FooImpl foo;


                           Foo foo = (Foo)
instance                     Class.forName(“FooImpl”)
                                .newInstance();
Type Coupling
class Client {}   class FooImpl{}
Type Coupling
class Client {}   class FooImpl{}
Type Coupling
class Client {}                     class FooImpl{}




                  interface Foo{}
Type Coupling
class Client {}                     class FooImpl{}




                  interface Foo{}

           uses              implements
Type Coupling
class Client {}                     class FooImpl{}




                  interface Foo{}

           uses              implements



                    get instance
Type Coupling
class Client {}                     class FooImpl{}




                   o
                  r ?l
              o ut s
               n einterface Foo{}



             C s
           uses              implements




               Is   get instance
Instance Coupling

•   New

•   Factory

•   Inversion of Control

•   Broker
Instance Coupling
                           client   container   impl

•   New

•   Factory

•   Inversion of Control

•   Broker
Instance Coupling
                           client   container   impl

•   New

•   Factory

•   Inversion of Control

•   Broker
Instance Coupling
                           client   container   impl

•   New

•   Factory

•   Inversion of Control

•   Broker
Instance Coupling
                           client   container   impl

•   New

•   Factory

•   Inversion of Control

•   Broker
Instance Coupling
                           client   container   impl

•   New

•   Factory

•   Inversion of Control

•   Broker
µServices Primitive
•   Broker Pattern

•   Direction

•   Contract

•   Publish

•   Find

•   Bind

•   Who’s Listening?

•   Cardinality
µServices Primitive
•   Broker Pattern

•   Direction

•   Contract

•   Publish            A   S   B
•   Find

•   Bind

•   Who’s listening?

•   Cardinality
Patterns

•   Factory

•   Listener

•   Discovery

•   Distribution
5. Optimize


     E
5. Optimize
A    B   C




D    E   F




G    H   I
Back to the Brick Wall
Migration
A   B   C




D   E   F




G   H   I
Migration
A   B   C




D   E   F




G   H   I
Migration
A   B   C




D   E   F




G   H   I
Migration
A   B   C




D   E   F




G   H   I
Migration
A   B   C




D   E   F




G   H   I
So we need a broker
 that runs without
      fences...
So we need a Broker
 that runs without
      Fences...SR
         o j o
       P
POJOSR

• Developed by Karl Pauls
• JavaOne presentation 24811
• http://pojosr.googlecode.com
• Based on Apache Felix
Gain
•   Existing libraries and many bundles work without
    modification
•   Bundle (JAR) activation (have their own local main)
•   µServices
•   Dynamicity (in µServices)
•   Extender pattern (react on JAR content)
•   Migration path to Fences (OSGi)
•   Existing OSGi and non-OSGi tooling can be used
Loss
•   No dynamic install/uninstall/update
•   No side-by-side versioning
•   No module privacy
•   No explicit dependencies
•   No Lazy activation
•   No Bundle classpath
•   No Native Code support
Migrating


• Example: extend ant … the tool we all
  (sometimes) love and (sometimes) hate
• We make different <helloXXX/> tasks
Ant Your Service

•   Base ant

•   Activator

•   Extender
                 ant


                    ...
                 ...
Ant Your Service

•   Base ant     pojosr
                  ant

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service

•   Base ant     pojosr
                  ant

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service
                           Class<Task>




•   Base ant     pojosr
                  ant

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service
                           Class<Task>
                                           hello
                                         activator



•   Base ant     pojosr
                  ant

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service
                           Class<Task>
                                           hello
                                         activator



•   Base ant     pojosr
                  ant

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service
<project name="master">

	   <path id="bundles">
	   	 <fileset dir="bundles">
	   	 	 <include name="*.jar" />
	   	 </fileset>
	   </path>

	   <taskdef name="auto"
       classname="aQute.ant.connect.AutoTask" classpathref="bundles" />
	   <auto />

	   <helloActivator />

</project>
Ant Your Service
public class Activator implements BundleActivator {

	   public void start(BundleContext context) throws Exception {
	   	 Properties props = new Properties();
	   	 props.put("ant", "helloActivator");
	   	 context.registerService(Class.class.getName(),
            HelloTask.class, props);
	   }

	 public void stop(BundleContext context) throws Exception {
	 }
}
public class HelloTask extends Task {
	 String message = "Hello Activator";
	
	 public void execute() { System.out.println(message); }
	 public void setMessage(String m) { this.message = m; }
}
Ant Your Service
public class Activator implements BundleActivator {




                               t
	   public void start(BundleContext context) throws Exception {




                             f
	   	 Properties props = new Properties();




                           u
	   	 props.put("ant", "helloActivator");




                    r
	   	 context.registerService(Class.class.getName(),




                   c
            HelloTask.class, props);
	   }

	 public void stop(BundleContext context) throws Exception {
	 }
}
public class HelloTask extends Task {
	 String message = "Hello Activator";
	
	 public void execute() { System.out.println(message); }
	 public void setMessage(String m) { this.message = m; }
}
Ant Your Service
                           Class<Task>
                                           hello
                                         activator



•   Base ant     pojosr
                  pojo
                  ant

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service
                           Class<Task>
                                           hello
                                         activator



•   Base ant     pojosr
                  pojo
                  ant
                                           hello
                                         extendee

•   Activator

•   Extender
                 ant


                     ...
                  ...
Ant Your Service
                           Class<Task>
                                                hello
                                              activator



•   Base ant     pojosr
                  pojo
                  ant
                                                hello
                                              extendee

•   Activator
                             Manifest-Version: 1.0


•                ant         Ant-Task: helloExtender=HelloTask
    Extender
                     ...
                  ...
Ant Your Service
public class HelloTask extends Task {
	 String message = "Hello Extender";
	
	 public void execute() { System.out.println(message); }
	 public void setMessage(String m) { this.message = m; }
}
Ant Your Service
public class HelloTask extends Task {
	 String message = "Hello Extender";
	
	 public void execute() { System.out.println(message); }
	 public void setMessage(String m) { this.message = m; }
}




                                    u ft
                            c r
                N O
Conclusion
• Moving to Fences is hard because popular
  instance creation patterns are
  fundamentally not modular
• Services-First approach works without
  Fences
• After completion, moving to Fences is
  much easier
Good Fences
Make Good Neighbors
Good Fences
            od ul es
Make Good Neighbors
          m
Q&A

More Related Content

Similar to OSGi Services-First Migration with μServices

Intro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T WardIntro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T Wardmfrancis
 
GoF J2EE Design Patterns
GoF J2EE Design PatternsGoF J2EE Design Patterns
GoF J2EE Design PatternsThanh Nguyen
 
IBM Cognos Framework Unleashed
IBM Cognos Framework UnleashedIBM Cognos Framework Unleashed
IBM Cognos Framework UnleashedEnvisn
 
Subsystems: For those occasions where bundles are just too small... - Graham ...
Subsystems: For those occasions where bundles are just too small... - Graham ...Subsystems: For those occasions where bundles are just too small... - Graham ...
Subsystems: For those occasions where bundles are just too small... - Graham ...mfrancis
 
Extending Spring for Custom Usage
Extending Spring for Custom UsageExtending Spring for Custom Usage
Extending Spring for Custom UsageJoshua Long
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversationsos890
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesRob Davies
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)David Bosschaert
 
The OSS Forge Ecosystem: Today and Tomorrow
The OSS Forge Ecosystem: Today and TomorrowThe OSS Forge Ecosystem: Today and Tomorrow
The OSS Forge Ecosystem: Today and Tomorrowoostendo
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGiIlya Rybak
 
IBM SONAS and the Cloud Storage Taxonomy
IBM SONAS and the Cloud Storage TaxonomyIBM SONAS and the Cloud Storage Taxonomy
IBM SONAS and the Cloud Storage TaxonomyTony Pearson
 
AS7/OSGi One Day Talk 2012
AS7/OSGi One Day Talk 2012AS7/OSGi One Day Talk 2012
AS7/OSGi One Day Talk 2012tdiesler
 
A classification framework for component models
A classification framework for component modelsA classification framework for component models
A classification framework for component modelsIvica Crnkovic
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBayTony Ng
 
FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...
FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...
FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...Estevão Hess
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011njbartlett
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJAX London
 
Services first migration to osgi - osgi users forum uk 16-nov2011
Services first migration to osgi - osgi users forum uk 16-nov2011Services first migration to osgi - osgi users forum uk 16-nov2011
Services first migration to osgi - osgi users forum uk 16-nov2011mfrancis
 
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...mfrancis
 

Similar to OSGi Services-First Migration with μServices (20)

Intro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T WardIntro to OSGi – the Microservices kernel - P Kriens & T Ward
Intro to OSGi – the Microservices kernel - P Kriens & T Ward
 
GoF J2EE Design Patterns
GoF J2EE Design PatternsGoF J2EE Design Patterns
GoF J2EE Design Patterns
 
IBM Cognos Framework Unleashed
IBM Cognos Framework UnleashedIBM Cognos Framework Unleashed
IBM Cognos Framework Unleashed
 
Subsystems: For those occasions where bundles are just too small... - Graham ...
Subsystems: For those occasions where bundles are just too small... - Graham ...Subsystems: For those occasions where bundles are just too small... - Graham ...
Subsystems: For those occasions where bundles are just too small... - Graham ...
 
Extending Spring for Custom Usage
Extending Spring for Custom UsageExtending Spring for Custom Usage
Extending Spring for Custom Usage
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversations
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application Bundles
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)
 
The OSS Forge Ecosystem: Today and Tomorrow
The OSS Forge Ecosystem: Today and TomorrowThe OSS Forge Ecosystem: Today and Tomorrow
The OSS Forge Ecosystem: Today and Tomorrow
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGi
 
Git. Transition.
Git. Transition.Git. Transition.
Git. Transition.
 
IBM SONAS and the Cloud Storage Taxonomy
IBM SONAS and the Cloud Storage TaxonomyIBM SONAS and the Cloud Storage Taxonomy
IBM SONAS and the Cloud Storage Taxonomy
 
AS7/OSGi One Day Talk 2012
AS7/OSGi One Day Talk 2012AS7/OSGi One Day Talk 2012
AS7/OSGi One Day Talk 2012
 
A classification framework for component models
A classification framework for component modelsA classification framework for component models
A classification framework for component models
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBay
 
FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...
FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...
FTSProc: a Process to Alleviate the Challenges of Projects that Use the Follo...
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
 
Services first migration to osgi - osgi users forum uk 16-nov2011
Services first migration to osgi - osgi users forum uk 16-nov2011Services first migration to osgi - osgi users forum uk 16-nov2011
Services first migration to osgi - osgi users forum uk 16-nov2011
 
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
 

Recently uploaded

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

OSGi Services-First Migration with μServices

  • 1. Services-First Migration to OSGi BJ Hargrave (IBM) Peter Kriens (aQute)
  • 2. Agenda • Modularity Maturity Model • The Brick Wall • Couplings • µServices • What Broker? • Example • Conclusion
  • 3. Modularity Maturity Model • 1 Ad Hoc • 2 Managed • 3 Contracts • 4 Fences Page 2 OSGi Alliance Marketing © 2008-2011 . All Rights Reserved, © IBM Corp. 2011 21.09.2011 • Inspired by Graham Charters’ excellent OSGi Community Event 2011 5 Optimize presentation @ http://slidesha.re/q8EHFp
  • 5. 1. Ad Hoc • Flat, manual class path • Single name space • Full visibility and normal accessibility • Monolithic • Highly coupled • Split Packages • Add/Shuffle JARs until it works
  • 6. 1. Ad Hoc • Flat, manual class path • Single name space e l l H • Full visibility and normal accessibility • Monolithic AR • • Highly coupled Split Packages J • Add/Shuffle JARs until it works
  • 7. 2. Managed • Treat JARs as a module • JAR Identity • Naming • Versioning • Dependencies • Repositories
  • 8. 2. Managed a d • Treat JARs as a module n l o w he t • JAR Identity • Naming D o t • Versioning r n e • Dependencies n t e • Repositories i
  • 9. 3. Contracts • Interface based design, POJOs • Provide contracts for each connection between JARs • Implementation details inside the JAR • Versioning on contracts
  • 10. 3. Contracts • d e r a Interface based design, o POJOs • Provide contracts for l s s k s c a a each connection l h between JARs • Implementation details inside the JAR c • Versioning on contracts
  • 11. 4. Fences • Explicitly Import/Export packages • Explicitly specify requirements and capabilities • Enforce the module boundaries • Semantic Versioning • Side-by-side versioning supported
  • 12. 4. Fences • Explicitly Import/Export packages • Explicitly specify requirements and capabilities o d! • • Enforce the module boundaries Semantic Versioning Go • Side-by-side versioning supported
  • 13. 5. Optimize • Exploit concepts for modules and contracts • Delegated Control • Optimize the code base to leverage new patterns: • Extender • Whiteboard • Repeat
  • 14. 5. Optimize • Exploit concepts for modules and contracts • Delegated Control • Optimize the code base to leverage new patterns: • Extender • Whiteboard • Repeat
  • 15. Today 1. Ad Hoc 2. 3. Managed Contracts 4. Fences 5. Optimize
  • 16. Today 1. Ad Hoc Enterprise DI vn ,C m ice ing 2. 3. Ivy Managed Contracts gu r saw sp jig 4. Fences 5. Optimize
  • 17. Today 1. Ad Hoc Enterprise DI vn ,C m ice ing 2. 3. Ivy Managed Contracts gu r OSGi saw s p jig 4. Fences 5. Optimize
  • 18. Today 1. Ad Hoc Enterprise DI vn ,C m ice ing 2. 3. Ivy Managed Contracts gu r OSGi saw s p jig 4. Fences 5. Optimize
  • 19.
  • 20.
  • 25. Class Space V1 V2
  • 26. Class Space V1 V2
  • 27. Class Space V1 V2 Class.forName
  • 28. Class Space V1 V2 x x Class.forName
  • 29. Class Space V1 V2 x x Class.forName
  • 31. Why Class.forName? ! ! ! ! ! ! ! ! ! ! ! ! N G! P LI C OU
  • 32. How to get an Instance? That is the Question!
  • 33. Couplings modular not Example modular type FooImpl foo; Foo foo = (Foo) instance Class.forName(“FooImpl”) .newInstance();
  • 34. Type Coupling class Client {} class FooImpl{}
  • 35. Type Coupling class Client {} class FooImpl{}
  • 36. Type Coupling class Client {} class FooImpl{} interface Foo{}
  • 37. Type Coupling class Client {} class FooImpl{} interface Foo{} uses implements
  • 38. Type Coupling class Client {} class FooImpl{} interface Foo{} uses implements get instance
  • 39. Type Coupling class Client {} class FooImpl{} o r ?l o ut s n einterface Foo{} C s uses implements Is get instance
  • 40. Instance Coupling • New • Factory • Inversion of Control • Broker
  • 41. Instance Coupling client container impl • New • Factory • Inversion of Control • Broker
  • 42. Instance Coupling client container impl • New • Factory • Inversion of Control • Broker
  • 43. Instance Coupling client container impl • New • Factory • Inversion of Control • Broker
  • 44. Instance Coupling client container impl • New • Factory • Inversion of Control • Broker
  • 45. Instance Coupling client container impl • New • Factory • Inversion of Control • Broker
  • 46. µServices Primitive • Broker Pattern • Direction • Contract • Publish • Find • Bind • Who’s Listening? • Cardinality
  • 47. µServices Primitive • Broker Pattern • Direction • Contract • Publish A S B • Find • Bind • Who’s listening? • Cardinality
  • 48. Patterns • Factory • Listener • Discovery • Distribution
  • 50. 5. Optimize A B C D E F G H I
  • 51. Back to the Brick Wall
  • 52. Migration A B C D E F G H I
  • 53. Migration A B C D E F G H I
  • 54. Migration A B C D E F G H I
  • 55. Migration A B C D E F G H I
  • 56. Migration A B C D E F G H I
  • 57. So we need a broker that runs without fences...
  • 58. So we need a Broker that runs without Fences...SR o j o P
  • 59. POJOSR • Developed by Karl Pauls • JavaOne presentation 24811 • http://pojosr.googlecode.com • Based on Apache Felix
  • 60. Gain • Existing libraries and many bundles work without modification • Bundle (JAR) activation (have their own local main) • µServices • Dynamicity (in µServices) • Extender pattern (react on JAR content) • Migration path to Fences (OSGi) • Existing OSGi and non-OSGi tooling can be used
  • 61. Loss • No dynamic install/uninstall/update • No side-by-side versioning • No module privacy • No explicit dependencies • No Lazy activation • No Bundle classpath • No Native Code support
  • 62. Migrating • Example: extend ant … the tool we all (sometimes) love and (sometimes) hate • We make different <helloXXX/> tasks
  • 63. Ant Your Service • Base ant • Activator • Extender ant ... ...
  • 64. Ant Your Service • Base ant pojosr ant • Activator • Extender ant ... ...
  • 65. Ant Your Service • Base ant pojosr ant • Activator • Extender ant ... ...
  • 66. Ant Your Service Class<Task> • Base ant pojosr ant • Activator • Extender ant ... ...
  • 67. Ant Your Service Class<Task> hello activator • Base ant pojosr ant • Activator • Extender ant ... ...
  • 68. Ant Your Service Class<Task> hello activator • Base ant pojosr ant • Activator • Extender ant ... ...
  • 69. Ant Your Service <project name="master"> <path id="bundles"> <fileset dir="bundles"> <include name="*.jar" /> </fileset> </path> <taskdef name="auto" classname="aQute.ant.connect.AutoTask" classpathref="bundles" /> <auto /> <helloActivator /> </project>
  • 70. Ant Your Service public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { Properties props = new Properties(); props.put("ant", "helloActivator"); context.registerService(Class.class.getName(), HelloTask.class, props); } public void stop(BundleContext context) throws Exception { } } public class HelloTask extends Task { String message = "Hello Activator"; public void execute() { System.out.println(message); } public void setMessage(String m) { this.message = m; } }
  • 71. Ant Your Service public class Activator implements BundleActivator { t public void start(BundleContext context) throws Exception { f Properties props = new Properties(); u props.put("ant", "helloActivator"); r context.registerService(Class.class.getName(), c HelloTask.class, props); } public void stop(BundleContext context) throws Exception { } } public class HelloTask extends Task { String message = "Hello Activator"; public void execute() { System.out.println(message); } public void setMessage(String m) { this.message = m; } }
  • 72. Ant Your Service Class<Task> hello activator • Base ant pojosr pojo ant • Activator • Extender ant ... ...
  • 73. Ant Your Service Class<Task> hello activator • Base ant pojosr pojo ant hello extendee • Activator • Extender ant ... ...
  • 74. Ant Your Service Class<Task> hello activator • Base ant pojosr pojo ant hello extendee • Activator Manifest-Version: 1.0 • ant Ant-Task: helloExtender=HelloTask Extender ... ...
  • 75. Ant Your Service public class HelloTask extends Task { String message = "Hello Extender"; public void execute() { System.out.println(message); } public void setMessage(String m) { this.message = m; } }
  • 76. Ant Your Service public class HelloTask extends Task { String message = "Hello Extender"; public void execute() { System.out.println(message); } public void setMessage(String m) { this.message = m; } } u ft c r N O
  • 77. Conclusion • Moving to Fences is hard because popular instance creation patterns are fundamentally not modular • Services-First approach works without Fences • After completion, moving to Fences is much easier
  • 79. Good Fences od ul es Make Good Neighbors m
  • 80. Q&A