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 Services-First Migration to OSGi

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 Services-First Migration to OSGi (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

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.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
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Services-First Migration to OSGi

  • 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