SlideShare une entreprise Scribd logo
1  sur  17
10 Questions & Answers on
OSGi (on the server side)
Toralf Richter, May 11, 2009
1. What is OSGi?
Answer 1
An acronym : Open Services Gateway initiative

Answer 2
The name of a consortium : the „OSGi Alliance“
Founded 1999
more than 100 companies as members world-wide (IBM,
Oracle+Sun, Nokia, and many telcos, automotive equipment
manufacturers)
1. What is OSGi?
Answer 3
a specification : the OSGi Service Platform
defines basic concepts of OSGi components and services
terminology: bundle, life cycle, services, dependencies
defines a programming interface (API) to interact with the service
platform, other services in the same platform, etc.
defines how bundles (components) are built and how their needed
meta information is added
current specification version is R4.1 (since May 2007)
1. What is OSGi?
Answer 4
a set of paradigms : in some sense OSGi is yet another incarnation of the
component architecture - complex software systems (should) consist of
simpler building blocks (components)  OSGi bundles
service orientation within the application - components exists besides each
other and express dependency but true interaction is by services using a
producer-consumer pattern
It is fine-grained (versus monolithic) - the building blocks are loosely
coupled and ought to never rely on another building block‘s presence
it is dynamic – services can appear and disappear (white board pattern)
It aims at continuous operation (uninterrupted by updates and maintenance)
2. Origins of OSGi

Mainly from the embedded software development in
automotive (think of BMW iDrive),
mobile (think of Java on mobile phones),
home entertainment (many recent DVD players run on OSGi bundled
Java applications
3. So what is the server-side story
with OSGi?
Drive to „enterprise OSGi“ recognisable
Foundation of OSGi Enterprise Expert Group in January 2007
transport Java EE APIs and functionalities to OSGi
Specification R4.2 due June 2009 will contain “enterprise features” which
will make OSGi much more practicable (than now) for large scale
server side applications
Initial attempt at “distributed OSGi”

  We made some studies into OSGi for server
applications starting from 2007/2008 this but it only
starts to get really interesting now
4. How mature can we consider it
on the server side?
Some examples of server / server-infrastructure applications built
on OSGi already
JBoss, Glassfish v3, BEA Weblogic
Mule ESB, Apache ServiceMix ESB

For the typical JEE application there are still shortcomings of the
specification and available and possible implementations.
It seems this is going to improve with R 4.2

OSGi on the server side can currently be considered a heavily
emerging technology
5. What are the basic principles?
Software is made of components
Each component has a clearly marked functionality („core
competency“)
The „same“ component can be present in several versions
In OSGi components are called bundles
5. What are the basic principles?
OSGi compliant componentised software runs in a suitable
runtime environment called an “OSGI framework” or “OSGI
container”
The container takes care of interpreting the meta information
attached to the components, i.e. provide the export and requests
the imports (quite similar to well know web or JEE containers)
It takes care choosing a suitable isolation level between bundles
based in meta information, in effect determining “visibility”
between bundles
5. What are the basic principles?
Complex applications are composed of bundles and the dependencies
expressed between them
Dependencies can be
direct export / import relationship
Fragment relationship
Service producer /
service consumer
relationship

The container resolves
dependencies from the
“visible” offerings
deployed in the
container
6. How to manage visibility?
Bundles specify explicitly
what (Java) packages they provide to other bundles, the OSGi term for this is
export
what packages or entire other bundles are needed, or in OSGi terms are
imported
and what packages are kept strictly private, etc.

In addition to Java code level visibility (public, protected, …)
visibility between bundles is determined by package exports and
their version information
The OSGi container takes care of dependency resolution (I.e.
does export meet import)
An importer of a package does usually not care which exporter actually
provides package, alternatives / substitutes of the same functionalities / exports
are easily interchangeable
7. How to express version
constraints?
Version number pattern „major.minor.bugfix.qualifier“
Exports specify the version they provide
Imports specify the precise version or version range they
require
Specifying range in the manifest is done in “mathematical notation”
: [ means >=, ] means <=, ( means >, ) means <
Example range: from including 1.5.0 to not including 2.0 - manifest
notation: version=“[1.5.0, 2.0)”
When more than one bundle or package match an importers version
constraint there are decisions rules (set by OSGi specification) which
one goes first
8. How does an OSGi manifest
look?
Key elements of an OSGi JAR MANIFEST below.
MANIFEST is to be found in jar:<xyz>!/METAINF/MANIFEST.MF
Bundle-SymbolicName: ttwBase
Bundle-Version: 1.0.0
Bundle-Activator: com.tomtomwork.base.Activator
Require-Bundle: ttwOther;bundle-version=“[1.3.1, 1.4.0)“
Export-Package: com.tomtomwork.base.*;version=“1.0.0“
Import-Package:
org.osgi.framework;version="1.3.1“,com.tomtomwork.webf
leet;version=“[2.0.0, 2.1.99)“
Private-Package: com.tomtomwork.internal.*
9. How bundles interact using
services?
bundles can register objects they instantiate and hold as services
they become service providers or service producers
when registering service the provider specifies a service interface and arbitrary
additional (meta) information and announces the service(s) on a public white
board (service registry)

also bundles can lookup services fulfilling certain criteria and when
available consume the service
provider and consumer do not and should not know each other. They interact
through the white board (service registry)

loose coupling + dynamism: (non-)availability of services can be queried
“per-access”, notifications can be set up using service listeners, and
since specification R 4.x the service tracker can be used for constant
and transparent service state tracking
10. What are advantages and
costs of OSGi development?
Developer must learn new API
plain OSGi partially invasive on code (can be avoided using
declarative services)
developer MUST honour OSGi paradigms
third party libraries are sometimes not yet OSGi complaint
tooling not yet “up to speed” when you compare it to standard
Java IDE products
JEE capabilities still emergent (e.g. complex / multiple web
applications or JDBC still somewhat complicated)
10. What are advantages and
costs of OSGi development?
robust
clearly defined and managed dependencies

code quality / maintainability
bundles can and should be developed separately and interact on defined
interfaces … this helps to avoid growing huge tangled monoliths

flexibility / adaptability
Composed arbitrarily complex applications from small bundles focusing on
their “core competency”

(high) availability / continuous operation
update / swap bundles without rebooting the entire application container (“hot
deploy” is rather default mode of operation instead an option)

extensibility
add bundles and capabilities at runtime
Thanks for your patience.
Toralf Richter
toralf.richter@tomtom.com
http://de.linkedin.com/in/toralfrichter/
@ToralfRichter

Contenu connexe

Similaire à 10 Questions & Answers on OSGi (on the server side

OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...IndicThreads
 
What is os gi and what does osgi
What is os gi and what does osgiWhat is os gi and what does osgi
What is os gi and what does osgiYunChang Lee
 
Enabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDMEnabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDMmukulobject
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi WebinarWSO2
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Reviewnjbartlett
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OpenBlend society
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year projectsuneel singh
 
OSGi User Forum US DC Metro
OSGi User Forum US DC MetroOSGi User Forum US DC Metro
OSGi User Forum US DC MetropjhInovex
 
OSGi user forum dc metro v1
OSGi user forum dc metro v1OSGi user forum dc metro v1
OSGi user forum dc metro v1pjhInovex
 
Java Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily JiangJava Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily JiangJAX London
 
Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Peter R. Egli
 
Service oriented component model
Service oriented component modelService oriented component model
Service oriented component modelravindrareddy
 
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...Milen Dyankov
 
WebServices and Workflow technologies
WebServices and Workflow technologiesWebServices and Workflow technologies
WebServices and Workflow technologiesNitin Pande
 

Similaire à 10 Questions & Answers on OSGi (on the server side (20)

OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune...
 
What is os gi and what does osgi
What is os gi and what does osgiWhat is os gi and what does osgi
What is os gi and what does osgi
 
Enabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDMEnabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDM
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
 
OSGi
OSGiOSGi
OSGi
 
Osgi platform
Osgi platformOsgi platform
Osgi platform
 
Alves Mea Pch1 Free
Alves Mea Pch1 FreeAlves Mea Pch1 Free
Alves Mea Pch1 Free
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
 
OSGi User Forum US DC Metro
OSGi User Forum US DC MetroOSGi User Forum US DC Metro
OSGi User Forum US DC Metro
 
OSGi user forum dc metro v1
OSGi user forum dc metro v1OSGi user forum dc metro v1
OSGi user forum dc metro v1
 
Osbsoa1
Osbsoa1Osbsoa1
Osbsoa1
 
Java Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily JiangJava Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily Jiang
 
Service virtualization with npm modules updated
Service virtualization with npm modules updatedService virtualization with npm modules updated
Service virtualization with npm modules updated
 
Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)
 
OSGi tech session
OSGi tech sessionOSGi tech session
OSGi tech session
 
Service oriented component model
Service oriented component modelService oriented component model
Service oriented component model
 
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...
Moved to https://slidr.io/azzazzel/leveraging-osgi-to-create-extensible-plugi...
 
WebServices and Workflow technologies
WebServices and Workflow technologiesWebServices and Workflow technologies
WebServices and Workflow technologies
 

Dernier

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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Dernier (20)

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)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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...
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

10 Questions & Answers on OSGi (on the server side

  • 1. 10 Questions & Answers on OSGi (on the server side) Toralf Richter, May 11, 2009
  • 2. 1. What is OSGi? Answer 1 An acronym : Open Services Gateway initiative Answer 2 The name of a consortium : the „OSGi Alliance“ Founded 1999 more than 100 companies as members world-wide (IBM, Oracle+Sun, Nokia, and many telcos, automotive equipment manufacturers)
  • 3. 1. What is OSGi? Answer 3 a specification : the OSGi Service Platform defines basic concepts of OSGi components and services terminology: bundle, life cycle, services, dependencies defines a programming interface (API) to interact with the service platform, other services in the same platform, etc. defines how bundles (components) are built and how their needed meta information is added current specification version is R4.1 (since May 2007)
  • 4. 1. What is OSGi? Answer 4 a set of paradigms : in some sense OSGi is yet another incarnation of the component architecture - complex software systems (should) consist of simpler building blocks (components)  OSGi bundles service orientation within the application - components exists besides each other and express dependency but true interaction is by services using a producer-consumer pattern It is fine-grained (versus monolithic) - the building blocks are loosely coupled and ought to never rely on another building block‘s presence it is dynamic – services can appear and disappear (white board pattern) It aims at continuous operation (uninterrupted by updates and maintenance)
  • 5. 2. Origins of OSGi Mainly from the embedded software development in automotive (think of BMW iDrive), mobile (think of Java on mobile phones), home entertainment (many recent DVD players run on OSGi bundled Java applications
  • 6. 3. So what is the server-side story with OSGi? Drive to „enterprise OSGi“ recognisable Foundation of OSGi Enterprise Expert Group in January 2007 transport Java EE APIs and functionalities to OSGi Specification R4.2 due June 2009 will contain “enterprise features” which will make OSGi much more practicable (than now) for large scale server side applications Initial attempt at “distributed OSGi”   We made some studies into OSGi for server applications starting from 2007/2008 this but it only starts to get really interesting now
  • 7. 4. How mature can we consider it on the server side? Some examples of server / server-infrastructure applications built on OSGi already JBoss, Glassfish v3, BEA Weblogic Mule ESB, Apache ServiceMix ESB For the typical JEE application there are still shortcomings of the specification and available and possible implementations. It seems this is going to improve with R 4.2 OSGi on the server side can currently be considered a heavily emerging technology
  • 8. 5. What are the basic principles? Software is made of components Each component has a clearly marked functionality („core competency“) The „same“ component can be present in several versions In OSGi components are called bundles
  • 9. 5. What are the basic principles? OSGi compliant componentised software runs in a suitable runtime environment called an “OSGI framework” or “OSGI container” The container takes care of interpreting the meta information attached to the components, i.e. provide the export and requests the imports (quite similar to well know web or JEE containers) It takes care choosing a suitable isolation level between bundles based in meta information, in effect determining “visibility” between bundles
  • 10. 5. What are the basic principles? Complex applications are composed of bundles and the dependencies expressed between them Dependencies can be direct export / import relationship Fragment relationship Service producer / service consumer relationship The container resolves dependencies from the “visible” offerings deployed in the container
  • 11. 6. How to manage visibility? Bundles specify explicitly what (Java) packages they provide to other bundles, the OSGi term for this is export what packages or entire other bundles are needed, or in OSGi terms are imported and what packages are kept strictly private, etc. In addition to Java code level visibility (public, protected, …) visibility between bundles is determined by package exports and their version information The OSGi container takes care of dependency resolution (I.e. does export meet import) An importer of a package does usually not care which exporter actually provides package, alternatives / substitutes of the same functionalities / exports are easily interchangeable
  • 12. 7. How to express version constraints? Version number pattern „major.minor.bugfix.qualifier“ Exports specify the version they provide Imports specify the precise version or version range they require Specifying range in the manifest is done in “mathematical notation” : [ means >=, ] means <=, ( means >, ) means < Example range: from including 1.5.0 to not including 2.0 - manifest notation: version=“[1.5.0, 2.0)” When more than one bundle or package match an importers version constraint there are decisions rules (set by OSGi specification) which one goes first
  • 13. 8. How does an OSGi manifest look? Key elements of an OSGi JAR MANIFEST below. MANIFEST is to be found in jar:<xyz>!/METAINF/MANIFEST.MF Bundle-SymbolicName: ttwBase Bundle-Version: 1.0.0 Bundle-Activator: com.tomtomwork.base.Activator Require-Bundle: ttwOther;bundle-version=“[1.3.1, 1.4.0)“ Export-Package: com.tomtomwork.base.*;version=“1.0.0“ Import-Package: org.osgi.framework;version="1.3.1“,com.tomtomwork.webf leet;version=“[2.0.0, 2.1.99)“ Private-Package: com.tomtomwork.internal.*
  • 14. 9. How bundles interact using services? bundles can register objects they instantiate and hold as services they become service providers or service producers when registering service the provider specifies a service interface and arbitrary additional (meta) information and announces the service(s) on a public white board (service registry) also bundles can lookup services fulfilling certain criteria and when available consume the service provider and consumer do not and should not know each other. They interact through the white board (service registry) loose coupling + dynamism: (non-)availability of services can be queried “per-access”, notifications can be set up using service listeners, and since specification R 4.x the service tracker can be used for constant and transparent service state tracking
  • 15. 10. What are advantages and costs of OSGi development? Developer must learn new API plain OSGi partially invasive on code (can be avoided using declarative services) developer MUST honour OSGi paradigms third party libraries are sometimes not yet OSGi complaint tooling not yet “up to speed” when you compare it to standard Java IDE products JEE capabilities still emergent (e.g. complex / multiple web applications or JDBC still somewhat complicated)
  • 16. 10. What are advantages and costs of OSGi development? robust clearly defined and managed dependencies code quality / maintainability bundles can and should be developed separately and interact on defined interfaces … this helps to avoid growing huge tangled monoliths flexibility / adaptability Composed arbitrarily complex applications from small bundles focusing on their “core competency” (high) availability / continuous operation update / swap bundles without rebooting the entire application container (“hot deploy” is rather default mode of operation instead an option) extensibility add bundles and capabilities at runtime
  • 17. Thanks for your patience. Toralf Richter toralf.richter@tomtom.com http://de.linkedin.com/in/toralfrichter/ @ToralfRichter