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
 
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
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011njbartlett
 
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...
 
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
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
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

Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

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