SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Último

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Último (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

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