SlideShare a Scribd company logo
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 Ward
mfrancis
 
GoF J2EE Design Patterns
GoF J2EE Design PatternsGoF J2EE Design Patterns
GoF J2EE Design Patterns
Thanh Nguyen
 
IBM Cognos Framework Unleashed
IBM Cognos Framework UnleashedIBM Cognos Framework Unleashed
IBM Cognos Framework Unleashed
Envisn
 
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 Usage
Joshua Long
 
MyFaces CODI Conversations
MyFaces CODI ConversationsMyFaces CODI Conversations
MyFaces CODI Conversations
os890
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application Bundles
Rob 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 Tomorrow
oostendo
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGi
Ilya Rybak
 
Git. Transition.
Git. Transition.Git. Transition.
Git. Transition.
Pavel Grushetzky
 
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
Tony Pearson
 
AS7/OSGi One Day Talk 2012
AS7/OSGi One Day Talk 2012AS7/OSGi One Day Talk 2012
AS7/OSGi One Day Talk 2012
tdiesler
 
A classification framework for component models
A classification framework for component modelsA classification framework for component models
A classification framework for component models
Ivica Crnkovic
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBay
Tony 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 Bartlett
JAX London
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
njbartlett
 
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
mfrancis
 
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

Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 

Recently uploaded (20)

Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 

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