SlideShare a Scribd company logo
Modular Enterprise Applications
  Mark Nuttall, mnuttall@uk.ibm.com
  IBM WebSphere OSGi Applications
         development lead
Overview
• Modularity and OSGi: what they are and
  why Java needs them
• Enterprise OSGi
• What’s new in the OSGi Service
  Platform Release 4 Early Draft 2011.09,
  and why it’s important
• Demonstration
Modularity
So what is Modularity?
“(Desirable) property of a system, such
that individual components can be
examined, modified and maintained
                                                            PCIe x16
independently of the remainder of the
system. Objective is that changes in
one part of a system should not lead to
unexpected behavior in other parts.”            VGA
                                                      DVI




www.cs.bath.ac.uk/~jap/MATH0015/glossary.html
Complexity and System Rot
         Traditional
            system
                                               Modular
                                               system


                   Modular
                   system

                                            Traditional
                                               system



               Time                     Time


In a software system, entanglement is the
primary cause of decay.
Java needs help: enforcing modularity
             makes entanglement less likely
•    Java unit of modularity = JAR
•    Enterprise apps are collections of
     JARs
•    But a JAR lacks the primary
     characteristics of modularity:
    People do
    this to software
    all the time!
•    It does NOT hide its internals
•    It does NOT declare its externals
•    The global Java classpath does
     NOT support versioning
What is OSGi?
• “The dynamic module system for Java”
   – Mature 10-year old technology
   – Governed by OSGi Alliance: http://www.osgi.org
   – Used inside just about all Java-based middleware
       • IBM WebSphere, Oracle WebLogic, Red Hat JBoss, Sun GlassFish, Paremus
         Service Fabric, Eclipse Platform, Apache Geronimo, …



             Jar                                             Jar
            Package               Explicit exports           Package

            Class                                            Class
               Class                                            Class
                  Class                                            Class

            Package                                          Package

            Class                                            Class
               Class                                            Class
                  Class                                            Class
                            Explicit dependencies




                                                                                 6
How does OSGi help reduce cost?
 •   Enforces architecture and simplifies maintenance
 •   Enables modular deployment
 •   Enables co-existence of multiple versions of libraries
      – Simplifies independent evolution of applications
      – Better separation of concern between application and middleware
 •   Enables truly dynamic update of modules within applications


           Bundle                                              Bundle
            Package                 Explicit exports            Package

            Class                                               Class
               Class                                               Class
                  Class                                               Class

            Package                                             Package

            Class                                               Class
               Class                                               Class
                  Class                                               Class
                              Explicit dependencies




                                                                              7
OSGi Modules (aka Bundles)
                                                                                                                             Classloader


                                                                                                        Bundle
• A Jar plus OSGi Manifest, includes:                                                             Manifes t-Ver sion : 1.0
                                                                                                  Bundle- Manif estV ersi




   – Bundle Identity                                                              Classloader


                                                             Bundle
   – Exported Packages
                                                       Manifes t-Ver sion : 1.0
                                                       Bundle- Manif estV ersi
                                                                                                                                                               Classloader


                                                                                                                                          Bundle
   – Imported Packages
                                                                                                                                    Manifes t-Ver sion : 1.0
                                                                                                                                    Bundle- Manif estV ersi




• Dependency resolution                                                                         Classloader
  “wires” bundles into
                                                                                           Bundle
  a dependency graph
                                                                 Manifest-Version: 1.0


• Each gets its own
                                                                 Bundle-ManifestVersion: 2




  class loader
• Classloading
  delegates via graph
                          Manifest-Version: 1.0
                          Bundle-ManifestVersion: 2
                          Bundle-Name: My Example Bundle
                          Bundle-SymbolicName: com.my.bundle
                          Bundle-Version: 1.0.0
                          Export-Package: com.something.i.provide;version="1.0.0"
                          Import-Package: com.something.i.need;version="[1.1,2.0)"
Dynamic Lifecycle

                           Bundle
• Bundles have a dynamic
  lifecycle
• Can come and go
  independently
• APIs enable graceful
  reaction to changes
OSGi Services
                                         service
                     Consumer     get          register   Provider
                      Bundle                              Bundle
                                listen




• Publish/find/bind service model
   – Fully dynamic
   – Local
   – Non-durable
• Primary mechanism for bundle collaboration
• POJO advertised with properties and/or interface and/or
  class
OSGi Enterprise Specification
• Enterprise 4.2: Released 22 March 2010
    – OSGi Enterprise Expert Group (EEG)
• Brings Enterprise technologies and OSGi together
• Using existing Java SE/EE specifications:
    – JTA, JPA, JNDI, JMX, WebApps…
• Adds Spring-derived Blueprint component model and DI container
• New in the OSGi Service Platform release 4 early draft 2011.09:
    – Standard application model
    – Bundle repository
• Java EE provides the core enterprise application programming
  model
• OSGi encourages modular design, simplifies reuse, and enables
  dynamic module updates
OSGi Bundle Repository
• Standardizes the entities required to resolve requirements
    – Used by the Subsystems specification for deployment
•   Environment – enables context and policy
•   Resolver – similar to runtime framework resolver
•   Repository – provides candidate solutions to requirements
•   Repository XML – interchange XML
                                                            Repository1



       Resolver                Environment                  Repository2
                                                                      XML


                   Subsystem                                Repository3
Subsystems: Disclaimer

• Subsystems is an in-progress RFC.
  What follows is a snapshot in time of the
  expert group thinking and is subject to
  change.
Subsystems: Motivation
• Enterprise Java platforms are awash with bundle
  collections
   – Apache Aries – Applications
   – Apache Geronimo - Applications
   – Apache Karaf – Features
   – Eclipse Virgo – Plans, PARs
   – IBM WebSphere Application Server –
     Applications, Composites, Liberty Features
   – Oracle GlassFish – Applications
   – Paremus Service Fabric – Systems
• Crying out for standardization
   – Portability
   – Tools
   – Ecosystem
Subsystems Model: Hierarchy
• Most common model is                            subsystem
  hierarchy and so
  Subsystems are no                             subsystem
  different
   – Each has 1 parent                          subsystem
   – Each can have many children
                                   subsystem   subsystem
   – Children of the same parent
     are siblings
• Visually represented by          subsystem   subsystem

  containment
Feature Subsystems
• Collection of Resources (e.g.   feature
  Bundles)                        bundle
• Shared life-cycle
• Can be nested                                      feature

• No isolation or affinity        bundle

• Repository-based
                                              bundle
  provisioning
                                  bundle
• Examples: Karaf Features,
  Virgo unscoped Plans


                                  bundle    bundle
Composite Subsystems
  • Coarse-grained sub-assembly           bundle
    module
  • Isolated
                                                       composite
  • Explicit share in/out
                                      bundle
  • Affinity
  • Repository-based                               bundle
    provisioning
                                      bundle
  • Examples: RFC 138
    Composite Bundles*,
    WebSphere Composite
    Bundles                           bundle       bundle


*old design prior to resolver hooks
Application Subsystems
• Model for hosted
  applications                            application
                              bundle
• Isolated
• No sharing out, implicit             bundle
  sharing in
                              bundle
• Affinity
• Repository-based
  provisioning
                              bundle   bundle
• Examples: Aries
  Application, Virgo Scoped
  Plans, Virgo PARs
Example Combination
• Subsystem Types can be                         framework
  mixed and matched
                                 application   application
• Example shows:
  – Features used to assemble
    a Composite                                 composite

  – Composite providing a        feature       feature
    ‘platform’ to Applications
                                 feature
Portability
• Subsystem Manifests are
  portable to a point                             Subsystem Definition
   – Target Environment + Transitive
     Dependencies must support the
     required resource implementation           Transitive
     types (e.g. Blueprint, WAB, DS,          Dependencies
     etc)
• Transitive dependencies                          Target Environment
  may be portable
   – Different Target Environments
     likely to require different Transitive
     Dependencies
Packaging
• Packaged in a Subsystem             my.first.subsystem.ssa
  Archive
                                      OSGI-INF/SUBSYSTEM.MF
• A zip file with .ssa
  extension:                         OSGI-INF/DEPLOYMENT.MF
  – Subsystem Manifest (optional)
  – Deployment Manifest (optional)
                                     an.osgi.bundle-1.0.0.jar
  – Resources
    (optional)
                                     an.osgi.bundle2-1.0.0.jar
Start with an empty
Example         Composite

Composite                         ACTIVE
Application Subsystem
Example                                installed and resolved

Composite                                                       ACTIVE


    Application             RESOLVED


            bundle
                     RESOLVED




                  transitive bundle
                           RESOLVED
Second Application
                                       Subsystem installed and
Example                                        started


Composite                                                                  ACTIVE


    Application             RESOLVED        Application                  ACTIVE


            bundle                                 bundle
                     RESOLVED                                   ACTIVE




                  transitive bundle         transitive bundle
                            ACTIVE                   ACTIVE
Second Application
Example                                Subsystem uninstalled


Composite                                                              ACTIVE


    Application             RESOLVED       Application         UNINSTALLED


            bundle                                bundle
                     RESOLVED                            UNINSTALLED




                  transitive bundle        transitive bundle
                           RESOLVED             UNINSTALLED
First Application Subsystem
Example                                         uninstalled


Composite                                                                 ACTIVE


    Application          UNINSTALLED          Application         UNINSTALLED


            bundle                                   bundle
                  UNINSTALLED                               UNINSTALLED




                  transitive bundle           transitive bundle
                        UNINSTALLED                UNINSTALLED
Subsystems: Summary
• With the publication of the next OSGi Service
  Platform specification, subsystems will be the
  standard way to manage groups of resources
• Version ranges allow flexibility in resource selection
• Subsystem types define sharing semantics
• Deployment definition
   – locks down versions and sharing
   – Identifies transitive dependencies
• API enables management of Subsystem life-cycle
Demo Time: Colors by WebSphere
Colors by WebSphere:
             Bundles and Services
                                            colors.provider.red


colors.web   colors.blender


                                           colors.provider.green




                                           colors.provider.blue




                              colors.api
Colors by WebSphere: Color
               services
                                  Color services    colors.provider.red


colors.web   colors.blender


                                                   colors.provider.green




                                                   colors.provider.blue




                              colors.api
Colors by WebSphere: Color
               services
                               Adjustment Service
                                                     colors.provider.red
                               (Extension Point)
colors.web   colors.blender


                                                    colors.provider.green




                                                    colors.provider.blue




                              colors.api
Summary

• Modularity and OSGi: what they are and
  why Java needs them
• Enterprise OSGi
• What’s new in the OSGi Service
  Platform Release 4 Early Draft 2011.09,
  and why it’s important
• Demonstration
Thank you! Any questions?

More Related Content

ODP
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
PDF
Jax london 2011
PDF
Create *real* modular Java applications - a brief introduction -
PPTX
Introduction to OSGi
PDF
OpenJDK Penrose Presentation (JavaOne 2012)
PDF
Introducing Java 7
PPTX
Java Modularity with OSGi
PDF
What Your Jvm Has Been Trying To Tell You
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
Jax london 2011
Create *real* modular Java applications - a brief introduction -
Introduction to OSGi
OpenJDK Penrose Presentation (JavaOne 2012)
Introducing Java 7
Java Modularity with OSGi
What Your Jvm Has Been Trying To Tell You

What's hot (20)

PDF
OSGI Modularity
PDF
OSGi and Java 9+
PPSX
Introduction to Java
PPT
.NET Vs J2EE
PDF
Oracle History #5
PDF
Running your Java EE applications in the Cloud
PDF
Osgi Sun 20080820
PDF
OSGi & Java EE in GlassFish - Best of both worlds
PPTX
J2EE Struts with Hibernate Framework
PDF
Java Course 13: JDBC & Logging
PDF
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
PDF
What is-java
PPT
Basics of java programming language
PPTX
Manuel - SPR - Intro to Java Language_2016
DOCX
Java 7 Dolphin manjula kollipara
PDF
Learn Java Part 1
PPTX
1 java programming- introduction
PDF
Java Course 7: Text processing, Charsets & Encodings
PPSX
Introduction to java
PDF
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
OSGI Modularity
OSGi and Java 9+
Introduction to Java
.NET Vs J2EE
Oracle History #5
Running your Java EE applications in the Cloud
Osgi Sun 20080820
OSGi & Java EE in GlassFish - Best of both worlds
J2EE Struts with Hibernate Framework
Java Course 13: JDBC & Logging
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
What is-java
Basics of java programming language
Manuel - SPR - Intro to Java Language_2016
Java 7 Dolphin manjula kollipara
Learn Java Part 1
1 java programming- introduction
Java Course 7: Text processing, Charsets & Encodings
Introduction to java
Using the OSGi Application Model on Mobile Devices with CLDC JVM - Dimitar Va...
Ad

Viewers also liked (20)

PDF
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
ODP
JavaEE + OSGi
PDF
Weld-OSGi, injecting easiness in OSGi
PDF
Praktyczne wprowadzenie do OSGi i Enterprise OSGi
PDF
Benefits of OSGi in Practise
PPT
Developing modular Java applications
PDF
2011 State of the Safety Net Report
PDF
Hum2310 fa2015 proust questionnaire
PDF
ART1204 Art of the Ancient Near East
PDF
Using Open Source technologies to create Enterprise Level Cloud System
PDF
Using GEOBIA to assess crown diameter classes of Acacia tortilis in Bou-Hedma...
PPT
Presentazione cantinando per aziende
PPT
Android | Busy Java Developers Guide to Android: Persistence | Ted Neward
PDF
Java Tech & Tools | Just Keep Passing the Message | Russel Winder
PPTX
Biologi Terapan - Laporan Perbedaan Pengaruh Bahan Tanam Terhadap Produktivi...
PDF
initLab
PDF
Tsahim 1
PDF
Tsahim 1
PPTX
Christmas 2011
PDF
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
JavaEE + OSGi
Weld-OSGi, injecting easiness in OSGi
Praktyczne wprowadzenie do OSGi i Enterprise OSGi
Benefits of OSGi in Practise
Developing modular Java applications
2011 State of the Safety Net Report
Hum2310 fa2015 proust questionnaire
ART1204 Art of the Ancient Near East
Using Open Source technologies to create Enterprise Level Cloud System
Using GEOBIA to assess crown diameter classes of Acacia tortilis in Bou-Hedma...
Presentazione cantinando per aziende
Android | Busy Java Developers Guide to Android: Persistence | Ted Neward
Java Tech & Tools | Just Keep Passing the Message | Russel Winder
Biologi Terapan - Laporan Perbedaan Pengaruh Bahan Tanam Terhadap Produktivi...
initLab
Tsahim 1
Tsahim 1
Christmas 2011
Ad

Similar to Architecture | Modular Enterprise Applications | Mark Nuttall (20)

PDF
ODP
03 osgi and servicemix
PDF
Enterprise OSGi at eBay
PDF
OSGi Best Practices - Tim Ward
PDF
OSGi-enabled Java EE Applications using GlassFish
PDF
OSGi-enabled Java EE applications in GlassFish
PPTX
Intro to OSGi and Eclipse Virgo
PDF
TDC 2011: OSGi-enabled Java EE Application
PDF
OSGi Mars World in Action
ODP
Java Tech & Tools | OSGi Best Practices | Emily Jiang
PDF
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
PDF
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
PDF
Everything I know about software in spaghetti bolognese: managing complexity
PDF
Introduction to OSGi
PDF
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
PDF
VIB - Very Important Bundles
PDF
Tuscany : Applying OSGi After The Fact
PDF
JavaOne 2010: OSGI Migrat
PDF
Enterprise Applications With OSGi and SpringSource dm Server
PPTX
Java 9 Modules: The Duke Yet Lives That OSGi Shall Depose
03 osgi and servicemix
Enterprise OSGi at eBay
OSGi Best Practices - Tim Ward
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE applications in GlassFish
Intro to OSGi and Eclipse Virgo
TDC 2011: OSGi-enabled Java EE Application
OSGi Mars World in Action
Java Tech & Tools | OSGi Best Practices | Emily Jiang
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
Everything I know about software in spaghetti bolognese: managing complexity
Introduction to OSGi
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
VIB - Very Important Bundles
Tuscany : Applying OSGi After The Fact
JavaOne 2010: OSGI Migrat
Enterprise Applications With OSGi and SpringSource dm Server
Java 9 Modules: The Duke Yet Lives That OSGi Shall Depose

More from JAX London (20)

PDF
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
ODP
Java Tech & Tools | Mapping, GIS and Geolocating Data in Java | Joachim Van d...
PDF
Keynote | Middleware Everywhere - Ready for Mobile and Cloud | Dr. Mark Little
PDF
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
PDF
Spring Day | Behind the Scenes at Spring Batch | Dave Syer
PDF
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
PDF
Spring Day | Identity Management with Spring Security | Dave Syer
PDF
Spring Day | Spring and Scala | Eberhard Wolff
PDF
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
PPT
Keynote | The Rise and Fall and Rise of Java | James Governor
PPTX
Java Tech & Tools | Beyond the Data Grid: Coherence, Normalisation, Joins and...
PDF
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
PDF
Java Tech & Tools | Social Media in Programming in Java | Khanderao Kand
PDF
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
PDF
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
PDF
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
KEY
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
PPTX
Java Core | JavaFX 2.0: Great User Interfaces in Java | Simon Ritter
PPT
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
PDF
Java Core | Concurrency in the Java Language and Platform | Fredrik Ohrstrom
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Mapping, GIS and Geolocating Data in Java | Joachim Van d...
Keynote | Middleware Everywhere - Ready for Mobile and Cloud | Dr. Mark Little
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
Spring Day | Behind the Scenes at Spring Batch | Dave Syer
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Keynote | The Rise and Fall and Rise of Java | James Governor
Java Tech & Tools | Beyond the Data Grid: Coherence, Normalisation, Joins and...
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
Java Tech & Tools | Social Media in Programming in Java | Khanderao Kand
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | JavaFX 2.0: Great User Interfaces in Java | Simon Ritter
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Concurrency in the Java Language and Platform | Fredrik Ohrstrom

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Spectroscopy.pptx food analysis technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Chapter 3 Spatial Domain Image Processing.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Spectroscopy.pptx food analysis technology
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Architecture | Modular Enterprise Applications | Mark Nuttall

  • 1. Modular Enterprise Applications Mark Nuttall, mnuttall@uk.ibm.com IBM WebSphere OSGi Applications development lead
  • 2. Overview • Modularity and OSGi: what they are and why Java needs them • Enterprise OSGi • What’s new in the OSGi Service Platform Release 4 Early Draft 2011.09, and why it’s important • Demonstration
  • 3. Modularity So what is Modularity? “(Desirable) property of a system, such that individual components can be examined, modified and maintained PCIe x16 independently of the remainder of the system. Objective is that changes in one part of a system should not lead to unexpected behavior in other parts.” VGA DVI www.cs.bath.ac.uk/~jap/MATH0015/glossary.html
  • 4. Complexity and System Rot Traditional system Modular system Modular system Traditional system Time Time In a software system, entanglement is the primary cause of decay.
  • 5. Java needs help: enforcing modularity makes entanglement less likely • Java unit of modularity = JAR • Enterprise apps are collections of JARs • But a JAR lacks the primary characteristics of modularity: People do this to software all the time! • It does NOT hide its internals • It does NOT declare its externals • The global Java classpath does NOT support versioning
  • 6. What is OSGi? • “The dynamic module system for Java” – Mature 10-year old technology – Governed by OSGi Alliance: http://www.osgi.org – Used inside just about all Java-based middleware • IBM WebSphere, Oracle WebLogic, Red Hat JBoss, Sun GlassFish, Paremus Service Fabric, Eclipse Platform, Apache Geronimo, … Jar Jar Package Explicit exports Package Class Class Class Class Class Class Package Package Class Class Class Class Class Class Explicit dependencies 6
  • 7. How does OSGi help reduce cost? • Enforces architecture and simplifies maintenance • Enables modular deployment • Enables co-existence of multiple versions of libraries – Simplifies independent evolution of applications – Better separation of concern between application and middleware • Enables truly dynamic update of modules within applications Bundle Bundle Package Explicit exports Package Class Class Class Class Class Class Package Package Class Class Class Class Class Class Explicit dependencies 7
  • 8. OSGi Modules (aka Bundles) Classloader Bundle • A Jar plus OSGi Manifest, includes: Manifes t-Ver sion : 1.0 Bundle- Manif estV ersi – Bundle Identity Classloader Bundle – Exported Packages Manifes t-Ver sion : 1.0 Bundle- Manif estV ersi Classloader Bundle – Imported Packages Manifes t-Ver sion : 1.0 Bundle- Manif estV ersi • Dependency resolution Classloader “wires” bundles into Bundle a dependency graph Manifest-Version: 1.0 • Each gets its own Bundle-ManifestVersion: 2 class loader • Classloading delegates via graph Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: My Example Bundle Bundle-SymbolicName: com.my.bundle Bundle-Version: 1.0.0 Export-Package: com.something.i.provide;version="1.0.0" Import-Package: com.something.i.need;version="[1.1,2.0)"
  • 9. Dynamic Lifecycle Bundle • Bundles have a dynamic lifecycle • Can come and go independently • APIs enable graceful reaction to changes
  • 10. OSGi Services service Consumer get register Provider Bundle Bundle listen • Publish/find/bind service model – Fully dynamic – Local – Non-durable • Primary mechanism for bundle collaboration • POJO advertised with properties and/or interface and/or class
  • 11. OSGi Enterprise Specification • Enterprise 4.2: Released 22 March 2010 – OSGi Enterprise Expert Group (EEG) • Brings Enterprise technologies and OSGi together • Using existing Java SE/EE specifications: – JTA, JPA, JNDI, JMX, WebApps… • Adds Spring-derived Blueprint component model and DI container • New in the OSGi Service Platform release 4 early draft 2011.09: – Standard application model – Bundle repository • Java EE provides the core enterprise application programming model • OSGi encourages modular design, simplifies reuse, and enables dynamic module updates
  • 12. OSGi Bundle Repository • Standardizes the entities required to resolve requirements – Used by the Subsystems specification for deployment • Environment – enables context and policy • Resolver – similar to runtime framework resolver • Repository – provides candidate solutions to requirements • Repository XML – interchange XML Repository1 Resolver Environment Repository2 XML Subsystem Repository3
  • 13. Subsystems: Disclaimer • Subsystems is an in-progress RFC. What follows is a snapshot in time of the expert group thinking and is subject to change.
  • 14. Subsystems: Motivation • Enterprise Java platforms are awash with bundle collections – Apache Aries – Applications – Apache Geronimo - Applications – Apache Karaf – Features – Eclipse Virgo – Plans, PARs – IBM WebSphere Application Server – Applications, Composites, Liberty Features – Oracle GlassFish – Applications – Paremus Service Fabric – Systems • Crying out for standardization – Portability – Tools – Ecosystem
  • 15. Subsystems Model: Hierarchy • Most common model is subsystem hierarchy and so Subsystems are no subsystem different – Each has 1 parent subsystem – Each can have many children subsystem subsystem – Children of the same parent are siblings • Visually represented by subsystem subsystem containment
  • 16. Feature Subsystems • Collection of Resources (e.g. feature Bundles) bundle • Shared life-cycle • Can be nested feature • No isolation or affinity bundle • Repository-based bundle provisioning bundle • Examples: Karaf Features, Virgo unscoped Plans bundle bundle
  • 17. Composite Subsystems • Coarse-grained sub-assembly bundle module • Isolated composite • Explicit share in/out bundle • Affinity • Repository-based bundle provisioning bundle • Examples: RFC 138 Composite Bundles*, WebSphere Composite Bundles bundle bundle *old design prior to resolver hooks
  • 18. Application Subsystems • Model for hosted applications application bundle • Isolated • No sharing out, implicit bundle sharing in bundle • Affinity • Repository-based provisioning bundle bundle • Examples: Aries Application, Virgo Scoped Plans, Virgo PARs
  • 19. Example Combination • Subsystem Types can be framework mixed and matched application application • Example shows: – Features used to assemble a Composite composite – Composite providing a feature feature ‘platform’ to Applications feature
  • 20. Portability • Subsystem Manifests are portable to a point Subsystem Definition – Target Environment + Transitive Dependencies must support the required resource implementation Transitive types (e.g. Blueprint, WAB, DS, Dependencies etc) • Transitive dependencies Target Environment may be portable – Different Target Environments likely to require different Transitive Dependencies
  • 21. Packaging • Packaged in a Subsystem my.first.subsystem.ssa Archive OSGI-INF/SUBSYSTEM.MF • A zip file with .ssa extension: OSGI-INF/DEPLOYMENT.MF – Subsystem Manifest (optional) – Deployment Manifest (optional) an.osgi.bundle-1.0.0.jar – Resources (optional) an.osgi.bundle2-1.0.0.jar
  • 22. Start with an empty Example Composite Composite ACTIVE
  • 23. Application Subsystem Example installed and resolved Composite ACTIVE Application RESOLVED bundle RESOLVED transitive bundle RESOLVED
  • 24. Second Application Subsystem installed and Example started Composite ACTIVE Application RESOLVED Application ACTIVE bundle bundle RESOLVED ACTIVE transitive bundle transitive bundle ACTIVE ACTIVE
  • 25. Second Application Example Subsystem uninstalled Composite ACTIVE Application RESOLVED Application UNINSTALLED bundle bundle RESOLVED UNINSTALLED transitive bundle transitive bundle RESOLVED UNINSTALLED
  • 26. First Application Subsystem Example uninstalled Composite ACTIVE Application UNINSTALLED Application UNINSTALLED bundle bundle UNINSTALLED UNINSTALLED transitive bundle transitive bundle UNINSTALLED UNINSTALLED
  • 27. Subsystems: Summary • With the publication of the next OSGi Service Platform specification, subsystems will be the standard way to manage groups of resources • Version ranges allow flexibility in resource selection • Subsystem types define sharing semantics • Deployment definition – locks down versions and sharing – Identifies transitive dependencies • API enables management of Subsystem life-cycle
  • 28. Demo Time: Colors by WebSphere
  • 29. Colors by WebSphere: Bundles and Services colors.provider.red colors.web colors.blender colors.provider.green colors.provider.blue colors.api
  • 30. Colors by WebSphere: Color services Color services colors.provider.red colors.web colors.blender colors.provider.green colors.provider.blue colors.api
  • 31. Colors by WebSphere: Color services Adjustment Service colors.provider.red (Extension Point) colors.web colors.blender colors.provider.green colors.provider.blue colors.api
  • 32. Summary • Modularity and OSGi: what they are and why Java needs them • Enterprise OSGi • What’s new in the OSGi Service Platform Release 4 Early Draft 2011.09, and why it’s important • Demonstration
  • 33. Thank you! Any questions?