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

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

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