SlideShare a Scribd company logo
1 of 42
Download to read offline
An Introduction to OSGi



               Alexandre Alves
                June 24, 2008
Short Bio

Employed by Oracle Corp.
 Previously   at BEA Systems


Architect for WebLogic Event Server (rebranded into
Oracle CEP)
 Light-weight   application server just for event processing
 Completely   built on top of Equinox/OSGi and completely
  modular


OASIS BPEL 2.0 spec committee
Agenda

History
Benefits
Architecture
Bundles
Services
Conclusion
History

The OSGi Alliance is an independent non-profit
corporation
 Deutsche Telekom, Nokia, Samsung, etc
 IBM, Oracle, IONA, etc

OSGi technology is the dynamic module system for Java
 Firstrelease in May 2000
 Latest version 4.1 was released in May 2007

OSGi technology provides a
 service-oriented,
 component-based   environment for developers
 and offers standardized ways to manage the software
  lifecycle.
Agenda

History
Benefits
Architecture
Services
Summary
Benefits

Problem Domain
   In large and complex systems, different components need to evolve
    separately
       Developed by different teams
       Re-used from other products
       Some components need more patches than others


Solution Domain
  Organize components as independent versioned modules
       Modules define public interface and dependencies
       Design and implement for re-use!
 Bind   modules dynamically and verify constraints
Benefits

Dynamic module system for Java
 Java does not define the concept of a module
 Closest to it would be a JAR

     Has no clear definition of its interfaces, dependencies, or
     version
Dynamic module system for Java
 One   can load new classes into a Class-Loader, but cannot
  un-load
 No standard way of loading new features into a running
  platform
     Different technology/vendors have different approaches
     (e.g. JBI, J2EE)
Agenda

History
Benefits
Architecture
Bundles
Services
Conclusion
OSGi Framework Layered Architecture

The Framework is split up into
different layers
 Execution    Environment – the VM                                Bundles
 Module   Layer – Module system                                                             Services




                                                                                                         Security
  for the Java Platform
                                                                                             Lifecycle
 Lifecycle   Layer – Dynamic
  support                                                                                     Module
 Service Layer – Module
                                                                        Execution Environment
  collaboration
                                                                                            OS + Hardware




            © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Execution Environment

Execution Environment
 The VM used to launch the
  Framework                                                      Bundles
 The  OSGi specification originated                                                       Services
  on the J2ME platform




                                                                                                       Security
                                                                                           Lifecycle
 Framework    implementations can
  scale down to small devices and                                                           Module
  scale up to large server
  environments                                                        Execution Environment

                                                                                          OS + Hardware




          © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Module Layer

Module system for the Java
Platform
 Enforces    visibility rules                                      Bundles
 Dependency         management                                                               Services




                                                                                                          Security
 Supports versioning of bundles,                                                             Lifecycle
  the OSGi modules
                                                                                               Module
Sophisticated modularity
framework                                                                Execution Environment
 provides for class space
                                                                                             OS + Hardware
  consistency for bundles
 supportsmultiple versions of
  packages and bundles


             © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Lifecycle Layer

Lifecycle Layer provides API to
manage bundles
 Installing
                                                                    Bundles
 Starting                                                                                    Services




                                                                                                          Security
 Stopping
                                                                                              Lifecycle
 Updating
                                                                                               Module
 Uninstalling
 All   dynamically supported at runtime                                 Execution Environment

                                                                                             OS + Hardware




             © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Service Layer

Provides an in-VM service model
 Services
         can be registered and
  consumed inside a VM                                              Bundles
 Again   all operations are dynamic                                                          Services




                                                                                                          Security
 Extensive  support for notification of                                                      Lifecycle
  the service lifecycle
                                                                                               Module

                                                                         Execution Environment

                                                                                             OS + Hardware




             © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Key Concepts

For most users, there are really just two main concepts to
learn
 Bundles

      Supported by Execution Environment, Module, and
      Lifecycle layers


 Services

      Supported by the Lifecycle and Service layers
Agenda

History
Benefits
Architecture
Bundles
Services
Conclusion
Bundle as Module

OSGi technology’s modularity unit
 Or,   in enterprise terms, OSGi technology’s deployment unit
 Again,   main advantage of bundles is to achieve better re-use


Regular JAR file
 Java   code
 Resources
 OSGi    specific entries in MANIFEST.MF
Bundle Definition

MANIFEST.MF


   Bundle-SymbolicName:        Bundle-Classpath:
   Bundle-Version:             Bundle-Activator:


   Import-Package:
   Export-Package:



        export-package                 import-package
                           bundle
Importing and Exporting Packages

Import-Package/Export-Package
 Explicit   dependency model
      Rigid documentation of public interface of module, which
      can be shared amongst development teams
      Helps with build automation (don’t under-estimate the
      effort of building large systems)
 Allows     dynamic selection (i.e. resolve) of dependencies
      Allows framework to find best suitable provider of a
      feature
      Allows framework to dynamically change provider, useful
      for patching system
Bundle Versioning

Versioning
 Import-Package:   com.acme.foo;version="[1.0.0.1, 2.1)“
  ==> 1.0.0.1 <= version < 2.1


 Import-Package:   com.acme.foo;version="1.0.0.1“
  ==> 1.0.0.1 <= version < ∞


 Import-Package:   com.acme.foo;version="1.0“
  ==> 1.0.0.0 <= version < ∞
Importing and Exporting Packages

Attribute matching
    Declarative way of influencing resolving


    Example:
         Bundle A: Import-Package:
         com.acme.foo;company=ACME


         Bundle B: Export-Package: com.acme.foo


         Bundle C: Export-Package: com.acme.foo;
         company="ACME";
Bundle Life-cycle

INSTALLED:
 Framework    has bits installed
RESOLVED:
 Framework    has resolved all dependencies successfully
STARTING:
 Framework    is starting bundle, and invokes registered
  activators in the process
ACTIVE:
 Bundle   is running
STOPPING:
 Framework    is shutting down bundle, and invokes registered
  activators in the process
Bundle Activation

Use Bundle Activator to:
 Contribute   to start and stop of bundle
 Allows   bundle to manage resources (e.g. start thread, read
  file)
 Specify   Bundle-Activator and import org.osgi.framework
 Should    perform work async, or return quickly
 Provides   bundle implementer access to BundleContext object


Note-worthy: there is no standard way of installing/un-
installing bundle from remote agent
Bundle Activation

Bundle-SymbolicName: example.mybundle
Bundle-Version: 1.0.0
Bundle-Activator: example.MyBundleActivator
Import-Package: org.osgi.framework

public class MyBundleActivator implements BundleActivator {
    public void start(BundleContext c) {
      // Initialize
    }
    public void stop(BundleContext c) {
      // Shutdown
    }
}
Bundle Activation

Another approach is to use Spring-DM
 Specify   bundle as a Spring-DM application context
       Spring-Context: META-INF/spring-context.xml

 Use   standard Spring-bean life-cycle interfaces
       InitializingBean
       DisposableBean

 By   default, context is created asynchronously


IMO, cleaner and simpler
Bundle Activation

Bundle-SymbolicName: example.mybundle
Bundle-Version: 1.0.0
Spring-Context: META-INF/spring-context.xml
Import-Package:


<bean id=“bundleBean” class=“example.myBundleBean”
 init-method=“init” destroy-method=“destroy” />
Agenda

History
Benefits
Architecture
Bundles
Services
Conclusion
Services

SOA deals with programming-in-the-large
 Interaction
           between system components (e.g. WS-clients and
  WS-providers through WSDL)


OSGi Service Layer allows one to bring SOA concepts
(e.g. re-use, implementation abstraction) into the system
component implementation level (e.g. programming-in-the-
small)


Main benefit: de-coupling of interface and implementation
allows the selection of different implementation providers
 Authentication/Authorization   providers: LDAP, file-system
Service Definition

Services are regular Java classes
   No need to implement technology-specific interfaces


A Service is made of three components:
  Service name(s)
      “example.AuthenticationService”

 Service  implementation
       example.LDAPAuthenticationServiceImpl

 Service   (reference) properties (optional)
       String property type = (‘file-system” | ‘ldap”)
Service Interaction

Service-provider bundles:
 Register service name(s), implementation, and properties into
  a Service Registry


Service-consumer bundles:
 Query   Service Registry for a particular service name(s)
     May do additional filtering by properties
 Communicates through returned class/interface, does not see
  implementation


Service Registry:
 Similar   to a map of services
Service Registration

AuthenticationService serviceImpl = new
 LDAPAuthenticationServiceImpl();
Dictionary properties = new Dictionary();
properties.put(“type”, “LDAP”);
ServiceRegistration reference =
 bundleContext.registerService(
       new String [] {AuthenticationService.class.getName()},
       serviceImpl,
       properties);
Service Registration

 Or alternatively using Spring-DM:


<bean name=“ldapService”
 class=“LDAPAuthenticationServiceImpl” />
<osgi:service ref=“ldapService“
 interface="example.AuthenticationService">
 <osgi:service-properties>
   <beans:entry key=“type" value=“LDAP"/>
 </osgi:service-properties>
</osgi:service>
Referencing Services

ServiceReference reference =
 bundleContext.getServiceReference(
       AuthenticationService.class.getName());


AuthenticationService service =
 (AuthenticationService)
 bundleContext.getService(reference);
Referencing Services

 Or


<osgi:reference id=“authenService"
 interface="example.AuthenticationService"/>
Services are Dynamic

Services are dynamic, they may come and go
 Service   reference/service may be null/stale
 Should    not cache references


ServiceListener used to keep track
 ServiceTracker   raises the ServiceListener abstraction


Spring-DM proxies services, and will do the right thing
Agenda

History
Benefits
Architecture
Bundles
Services
Conclusion
Challenges

Mind-set:
 Understand   that it is more work to create a modular solution,
  but it pays off long-term


Design-time:
 Very   large Import-Packages
     Error-prone
 Non-intuitive   Import-Packages
     Hard to get correct when reflection is used (e.g. Kodo)
Challenges

Runtime:
 Hard   to debug complex class-path resolving
      instanceof just fails sometimes…
 Service   availability race-conditions
      Client applications referencing to services that have not
      been bound it
      Particularly a problem during start-up


Certain features are missing or too hard to use:
 Security,   Configuration support, Transaction support
Adoption

Many framework implementations
 Equinox   – Open source
 Felix   – Open source
 Knopflerfish     – Open source
 Concierge     – Open source
 ProSyst

Spring Dynamic Modules for OSGi
All Eclipse-based systems run on Equinox
 Runtimes    (e.g., RAP, Swordfish, Riena, ECF, EclipseLink)
 RCP,    eRCP
 Tooling


            © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Adoption

Equinox OSGi as a component runtime
Consistent programming model from embedded to server
Reuse components across the spectrum

                       NASA
                                                                                        RAP
                       JPMorgan
                                                                                        Swordfish
                       Lotus
                                                                                        Riena
                       Jazz
                                                       Rational Suite                   WAS
                       SAS
   eRCP                                                Borland                          BEA
                       Swiss Rail
   Nokia                                               BEA                              Jazz
                       Daimler
   Sprint                                              Jazz                             Spring
                       Riena


 Embedded              Rich Client                         Tooling                          Server

            © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
Lessons Learned when using OSGi

There are always opportunities for re-use
  Re-use within organization
  Re-use of standard services

        HTTP Service
        Service Tracker
        Initial Provisioning
        Declarative Services using Spring-DM
        Start Level Service
Modularize at all levels
    WL-EvS programming model itself is a separate bundle, de-coupled
     from other services, which means WL-EvS could in theory support
     other programming models, such as SCA, etc.
Conclusion

Standard
 Several    different implementations are available


Mature
 Proven    technology
 Over   8 years-old (versus JSR-277/294)


Key-concepts
 Bundles:    re-usability
 Service:   flexibility, extensibility
Q/A



         Alexandre Alves
      alex.alves@oracle.com

More Related Content

What's hot

Desktopvirtualisatie met VMware View, de laatste ontwikkelingen
Desktopvirtualisatie met VMware View, de laatste ontwikkelingenDesktopvirtualisatie met VMware View, de laatste ontwikkelingen
Desktopvirtualisatie met VMware View, de laatste ontwikkelingenUNIT4 IT Solutions
 
Apache MyFaces 1.2 Web Application Development
Apache MyFaces 1.2 Web Application DevelopmentApache MyFaces 1.2 Web Application Development
Apache MyFaces 1.2 Web Application DevelopmentBart Kummel
 
Windows Server 2012 Active Directory Domain and Trust (Forest Trust)
Windows Server 2012 Active Directory Domain and Trust (Forest Trust)Windows Server 2012 Active Directory Domain and Trust (Forest Trust)
Windows Server 2012 Active Directory Domain and Trust (Forest Trust)Serhad MAKBULOĞLU, MBA
 
System Center
System CenterSystem Center
System CenterBlauge
 
Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...
Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...
Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...yocaba
 
Tool support for semi-automatic modularization of existing code bases
Tool support for semi-automatic modularization of existing code basesTool support for semi-automatic modularization of existing code bases
Tool support for semi-automatic modularization of existing code basesyocaba
 
CELC_Новые возможности Cisco UCS
CELC_Новые возможности Cisco UCSCELC_Новые возможности Cisco UCS
CELC_Новые возможности Cisco UCSCisco Russia
 
Roger boesch xen desktop mit cisco
Roger boesch xen desktop mit ciscoRoger boesch xen desktop mit cisco
Roger boesch xen desktop mit ciscoDigicomp Academy AG
 
Comp tia a+_session_14
Comp tia a+_session_14Comp tia a+_session_14
Comp tia a+_session_14Niit Care
 
Hyper-V VMM ile Cloud computing
Hyper-V VMM ile Cloud computingHyper-V VMM ile Cloud computing
Hyper-V VMM ile Cloud computingAhmet Mutlu
 
Towards Organizational Agent-based Operating Systems
Towards Organizational Agent-based Operating SystemsTowards Organizational Agent-based Operating Systems
Towards Organizational Agent-based Operating SystemsJavi Palanca
 
ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF
ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXFApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF
ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXFAdrian Trenaman
 
Vmware 虚拟花技术作为云计算的平台
Vmware 虚拟花技术作为云计算的平台Vmware 虚拟花技术作为云计算的平台
Vmware 虚拟花技术作为云计算的平台George Ang
 
Axp Introduce In China Open Source Forum 2008
Axp Introduce In China Open Source Forum 2008Axp Introduce In China Open Source Forum 2008
Axp Introduce In China Open Source Forum 2008OpenSourceCamp
 
JoramMQ Entreprise tools and services for the JORAM user, OW2con’12, Paris
JoramMQ Entreprise tools and services for the JORAM user, OW2con’12, ParisJoramMQ Entreprise tools and services for the JORAM user, OW2con’12, Paris
JoramMQ Entreprise tools and services for the JORAM user, OW2con’12, ParisOW2
 
Comp tia a+_session_11
Comp tia a+_session_11Comp tia a+_session_11
Comp tia a+_session_11Niit Care
 
Тенденции развития современных Центров Обработки Данных
 Тенденции развития современных Центров Обработки Данных Тенденции развития современных Центров Обработки Данных
Тенденции развития современных Центров Обработки ДанныхCisco Russia
 
Staying ahead of the multi-core revolution with CDT debug
Staying ahead of the multi-core revolution with CDT debugStaying ahead of the multi-core revolution with CDT debug
Staying ahead of the multi-core revolution with CDT debugmarckhouzam
 

What's hot (19)

Desktopvirtualisatie met VMware View, de laatste ontwikkelingen
Desktopvirtualisatie met VMware View, de laatste ontwikkelingenDesktopvirtualisatie met VMware View, de laatste ontwikkelingen
Desktopvirtualisatie met VMware View, de laatste ontwikkelingen
 
Apache MyFaces 1.2 Web Application Development
Apache MyFaces 1.2 Web Application DevelopmentApache MyFaces 1.2 Web Application Development
Apache MyFaces 1.2 Web Application Development
 
What’s new System Center 2012 SP1, VMM
What’s new System Center 2012 SP1, VMMWhat’s new System Center 2012 SP1, VMM
What’s new System Center 2012 SP1, VMM
 
Windows Server 2012 Active Directory Domain and Trust (Forest Trust)
Windows Server 2012 Active Directory Domain and Trust (Forest Trust)Windows Server 2012 Active Directory Domain and Trust (Forest Trust)
Windows Server 2012 Active Directory Domain and Trust (Forest Trust)
 
System Center
System CenterSystem Center
System Center
 
Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...
Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...
Embedding Existing Heterogeneous Monitoring Techniques into a Lightweight, Di...
 
Tool support for semi-automatic modularization of existing code bases
Tool support for semi-automatic modularization of existing code basesTool support for semi-automatic modularization of existing code bases
Tool support for semi-automatic modularization of existing code bases
 
CELC_Новые возможности Cisco UCS
CELC_Новые возможности Cisco UCSCELC_Новые возможности Cisco UCS
CELC_Новые возможности Cisco UCS
 
Roger boesch xen desktop mit cisco
Roger boesch xen desktop mit ciscoRoger boesch xen desktop mit cisco
Roger boesch xen desktop mit cisco
 
Comp tia a+_session_14
Comp tia a+_session_14Comp tia a+_session_14
Comp tia a+_session_14
 
Hyper-V VMM ile Cloud computing
Hyper-V VMM ile Cloud computingHyper-V VMM ile Cloud computing
Hyper-V VMM ile Cloud computing
 
Towards Organizational Agent-based Operating Systems
Towards Organizational Agent-based Operating SystemsTowards Organizational Agent-based Operating Systems
Towards Organizational Agent-based Operating Systems
 
ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF
ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXFApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF
ApacheCon EU 2009 Tales from the front line - ActiveMQ ServiceMix and CXF
 
Vmware 虚拟花技术作为云计算的平台
Vmware 虚拟花技术作为云计算的平台Vmware 虚拟花技术作为云计算的平台
Vmware 虚拟花技术作为云计算的平台
 
Axp Introduce In China Open Source Forum 2008
Axp Introduce In China Open Source Forum 2008Axp Introduce In China Open Source Forum 2008
Axp Introduce In China Open Source Forum 2008
 
JoramMQ Entreprise tools and services for the JORAM user, OW2con’12, Paris
JoramMQ Entreprise tools and services for the JORAM user, OW2con’12, ParisJoramMQ Entreprise tools and services for the JORAM user, OW2con’12, Paris
JoramMQ Entreprise tools and services for the JORAM user, OW2con’12, Paris
 
Comp tia a+_session_11
Comp tia a+_session_11Comp tia a+_session_11
Comp tia a+_session_11
 
Тенденции развития современных Центров Обработки Данных
 Тенденции развития современных Центров Обработки Данных Тенденции развития современных Центров Обработки Данных
Тенденции развития современных Центров Обработки Данных
 
Staying ahead of the multi-core revolution with CDT debug
Staying ahead of the multi-core revolution with CDT debugStaying ahead of the multi-core revolution with CDT debug
Staying ahead of the multi-core revolution with CDT debug
 

Viewers also liked

PlayStation 4 no Brasil
PlayStation 4 no BrasilPlayStation 4 no Brasil
PlayStation 4 no BrasilFGV-EAESP
 
Film opening lessons sep 2013
Film opening lessons sep 2013Film opening lessons sep 2013
Film opening lessons sep 2013NShuttle
 
Dumb criminals
Dumb criminalsDumb criminals
Dumb criminalsLes Davy
 
Hassi: Lasten, nuorten ja perheiden palveluiden kustannusseuranta
Hassi: Lasten, nuorten ja perheiden palveluiden kustannusseurantaHassi: Lasten, nuorten ja perheiden palveluiden kustannusseuranta
Hassi: Lasten, nuorten ja perheiden palveluiden kustannusseurantaKouluterveyskysely
 
Supporting Apache Brands While Making A Profit - v2.0b
Supporting Apache Brands While Making A Profit - v2.0bSupporting Apache Brands While Making A Profit - v2.0b
Supporting Apache Brands While Making A Profit - v2.0bShane Curcuru
 
Pietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmä
Pietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmäPietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmä
Pietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmäKouluterveyskysely
 
Vancouver executive briefing seminar by csr training institute
Vancouver executive briefing seminar by csr training instituteVancouver executive briefing seminar by csr training institute
Vancouver executive briefing seminar by csr training instituteWayne Dunn
 
Travel in europe
Travel in europeTravel in europe
Travel in europebalada65
 
TSE – OSE経営統合への見解
TSE – OSE経営統合への見解TSE – OSE経営統合への見解
TSE – OSE経営統合への見解KVH Co. Ltd.
 
The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213
The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213
The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213Trevor E S Smith
 
File management 101
File management 101File management 101
File management 101Niamh Foley
 

Viewers also liked (20)

PlayStation 4 no Brasil
PlayStation 4 no BrasilPlayStation 4 no Brasil
PlayStation 4 no Brasil
 
Messen mit PHP
Messen mit PHPMessen mit PHP
Messen mit PHP
 
2012 11 Openstack China
2012 11 Openstack China2012 11 Openstack China
2012 11 Openstack China
 
Film opening lessons sep 2013
Film opening lessons sep 2013Film opening lessons sep 2013
Film opening lessons sep 2013
 
Utilizing the Full Potential of EPUB Feature Set
Utilizing the Full Potential of EPUB Feature SetUtilizing the Full Potential of EPUB Feature Set
Utilizing the Full Potential of EPUB Feature Set
 
BIRTE-13-Kawashima
BIRTE-13-KawashimaBIRTE-13-Kawashima
BIRTE-13-Kawashima
 
Dumb criminals
Dumb criminalsDumb criminals
Dumb criminals
 
1 18
1 181 18
1 18
 
Hassi: Lasten, nuorten ja perheiden palveluiden kustannusseuranta
Hassi: Lasten, nuorten ja perheiden palveluiden kustannusseurantaHassi: Lasten, nuorten ja perheiden palveluiden kustannusseuranta
Hassi: Lasten, nuorten ja perheiden palveluiden kustannusseuranta
 
Supporting Apache Brands While Making A Profit - v2.0b
Supporting Apache Brands While Making A Profit - v2.0bSupporting Apache Brands While Making A Profit - v2.0b
Supporting Apache Brands While Making A Profit - v2.0b
 
Pietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmä
Pietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmäPietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmä
Pietilä: Move! Fyysisen toimintakyvyn seurantajärjestelmä
 
Vancouver executive briefing seminar by csr training institute
Vancouver executive briefing seminar by csr training instituteVancouver executive briefing seminar by csr training institute
Vancouver executive briefing seminar by csr training institute
 
Travel in europe
Travel in europeTravel in europe
Travel in europe
 
TSE – OSE経営統合への見解
TSE – OSE経営統合への見解TSE – OSE経営統合への見解
TSE – OSE経営統合への見解
 
03 02 wh_chris_walker
03 02 wh_chris_walker03 02 wh_chris_walker
03 02 wh_chris_walker
 
Medaglia della salvezza (mini book)
Medaglia della salvezza (mini book)Medaglia della salvezza (mini book)
Medaglia della salvezza (mini book)
 
The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213
The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213
The Online Academy Budget $ t-r-e-t-c-h Opportunity-v171213
 
The four agreements
The four agreements The four agreements
The four agreements
 
File management 101
File management 101File management 101
File management 101
 
Interview1 techno
Interview1 technoInterview1 techno
Interview1 techno
 

Similar to Introduction to OSGi

Liferay Module Framework
Liferay Module FrameworkLiferay Module Framework
Liferay Module FrameworkMiguel Pastor
 
Enabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDMEnabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDMmukulobject
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGiIlya Rybak
 
Carbon Webinar
Carbon WebinarCarbon Webinar
Carbon WebinarWSO2
 
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
 
WS-* Specifications Update 2007
WS-* Specifications Update 2007WS-* Specifications Update 2007
WS-* Specifications Update 2007Jorgen Thelin
 
What's New in IBM Messaging
What's New in IBM MessagingWhat's New in IBM Messaging
What's New in IBM MessagingMorag Hughson
 
The Sirocco multi-cloud management framework, OW2con'12, Paris
The Sirocco multi-cloud management framework, OW2con'12, ParisThe Sirocco multi-cloud management framework, OW2con'12, Paris
The Sirocco multi-cloud management framework, OW2con'12, ParisOW2
 
What's New in IBM MQ - Version 8
What's New in IBM MQ - Version 8What's New in IBM MQ - Version 8
What's New in IBM MQ - Version 8MarkTaylorIBM
 
Using OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBM
Using OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBMUsing OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBM
Using OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBMmfrancis
 
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
 
20100907 fuse-community-evening-adrian-trenaman-no-logo
20100907 fuse-community-evening-adrian-trenaman-no-logo20100907 fuse-community-evening-adrian-trenaman-no-logo
20100907 fuse-community-evening-adrian-trenaman-no-logoAdrian Trenaman
 
System Center 2012 Ürün Ailesi
System Center 2012 Ürün AilesiSystem Center 2012 Ürün Ailesi
System Center 2012 Ürün AilesiMustafa
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi WebinarWSO2
 
Mobile Tools for Java - Current Project Status
Mobile Tools for Java - Current Project StatusMobile Tools for Java - Current Project Status
Mobile Tools for Java - Current Project Statusgustavoeliano
 

Similar to Introduction to OSGi (20)

OSGi tech session
OSGi tech sessionOSGi tech session
OSGi tech session
 
Liferay Module Framework
Liferay Module FrameworkLiferay Module Framework
Liferay Module Framework
 
Beyond OSGi Software Architecture
Beyond OSGi Software ArchitectureBeyond OSGi Software Architecture
Beyond OSGi Software Architecture
 
Enabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDMEnabling modularization through OSGi and SpringDM
Enabling modularization through OSGi and SpringDM
 
Java Modularity with OSGi
Java Modularity with OSGiJava Modularity with OSGi
Java Modularity with OSGi
 
Carbon Webinar
Carbon WebinarCarbon Webinar
Carbon Webinar
 
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...
 
WS-* Specifications Update 2007
WS-* Specifications Update 2007WS-* Specifications Update 2007
WS-* Specifications Update 2007
 
What's New in IBM Messaging
What's New in IBM MessagingWhat's New in IBM Messaging
What's New in IBM Messaging
 
The Sirocco multi-cloud management framework, OW2con'12, Paris
The Sirocco multi-cloud management framework, OW2con'12, ParisThe Sirocco multi-cloud management framework, OW2con'12, Paris
The Sirocco multi-cloud management framework, OW2con'12, Paris
 
Discover what's new in Windows Server 2012 Active Directory
Discover what's new in Windows Server 2012 Active DirectoryDiscover what's new in Windows Server 2012 Active Directory
Discover what's new in Windows Server 2012 Active Directory
 
What's New in IBM MQ - Version 8
What's New in IBM MQ - Version 8What's New in IBM MQ - Version 8
What's New in IBM MQ - Version 8
 
Using OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBM
Using OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBMUsing OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBM
Using OSGi technology in Eclipse - BJ Hargrave, IBM, for Jeff McAffer, IBM
 
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
 
IJTC ServiceMix 4
IJTC   ServiceMix 4IJTC   ServiceMix 4
IJTC ServiceMix 4
 
20100907 fuse-community-evening-adrian-trenaman-no-logo
20100907 fuse-community-evening-adrian-trenaman-no-logo20100907 fuse-community-evening-adrian-trenaman-no-logo
20100907 fuse-community-evening-adrian-trenaman-no-logo
 
System Center 2012 Ürün Ailesi
System Center 2012 Ürün AilesiSystem Center 2012 Ürün Ailesi
System Center 2012 Ürün Ailesi
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
Mobile Tools for Java - Current Project Status
Mobile Tools for Java - Current Project StatusMobile Tools for Java - Current Project Status
Mobile Tools for Java - Current Project Status
 

More from Alexandre de Castro Alves

More from Alexandre de Castro Alves (7)

A Guideline to Statistical and Machine Learning
A Guideline to Statistical and Machine LearningA Guideline to Statistical and Machine Learning
A Guideline to Statistical and Machine Learning
 
Developing Modular Systems using OSGi
Developing Modular Systems using OSGiDeveloping Modular Systems using OSGi
Developing Modular Systems using OSGi
 
Speeding up big data with event processing
Speeding up big data with event processingSpeeding up big data with event processing
Speeding up big data with event processing
 
A General Extension System for Event Processing Languages
A General Extension System for Event Processing LanguagesA General Extension System for Event Processing Languages
A General Extension System for Event Processing Languages
 
Ts 4783 1
Ts 4783 1Ts 4783 1
Ts 4783 1
 
Bpel4 Ws 1.1 To Ws Bpel 2.0
Bpel4 Ws 1.1 To Ws Bpel 2.0Bpel4 Ws 1.1 To Ws Bpel 2.0
Bpel4 Ws 1.1 To Ws Bpel 2.0
 
Alves Mea Pch1 Free
Alves Mea Pch1 FreeAlves Mea Pch1 Free
Alves Mea Pch1 Free
 

Recently uploaded

Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 

Recently uploaded (20)

Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 

Introduction to OSGi

  • 1. An Introduction to OSGi Alexandre Alves June 24, 2008
  • 2. Short Bio Employed by Oracle Corp.  Previously at BEA Systems Architect for WebLogic Event Server (rebranded into Oracle CEP)  Light-weight application server just for event processing  Completely built on top of Equinox/OSGi and completely modular OASIS BPEL 2.0 spec committee
  • 4. History The OSGi Alliance is an independent non-profit corporation  Deutsche Telekom, Nokia, Samsung, etc  IBM, Oracle, IONA, etc OSGi technology is the dynamic module system for Java  Firstrelease in May 2000  Latest version 4.1 was released in May 2007 OSGi technology provides a  service-oriented,  component-based environment for developers  and offers standardized ways to manage the software lifecycle.
  • 6. Benefits Problem Domain  In large and complex systems, different components need to evolve separately Developed by different teams Re-used from other products Some components need more patches than others Solution Domain  Organize components as independent versioned modules Modules define public interface and dependencies Design and implement for re-use!  Bind modules dynamically and verify constraints
  • 7. Benefits Dynamic module system for Java  Java does not define the concept of a module  Closest to it would be a JAR Has no clear definition of its interfaces, dependencies, or version Dynamic module system for Java  One can load new classes into a Class-Loader, but cannot un-load  No standard way of loading new features into a running platform Different technology/vendors have different approaches (e.g. JBI, J2EE)
  • 9. OSGi Framework Layered Architecture The Framework is split up into different layers  Execution Environment – the VM Bundles  Module Layer – Module system Services Security for the Java Platform Lifecycle  Lifecycle Layer – Dynamic support Module  Service Layer – Module Execution Environment collaboration OS + Hardware © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 10. Execution Environment Execution Environment  The VM used to launch the Framework Bundles  The OSGi specification originated Services on the J2ME platform Security Lifecycle  Framework implementations can scale down to small devices and Module scale up to large server environments Execution Environment OS + Hardware © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 11. Module Layer Module system for the Java Platform  Enforces visibility rules Bundles  Dependency management Services Security  Supports versioning of bundles, Lifecycle the OSGi modules Module Sophisticated modularity framework Execution Environment  provides for class space OS + Hardware consistency for bundles  supportsmultiple versions of packages and bundles © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 12. Lifecycle Layer Lifecycle Layer provides API to manage bundles  Installing Bundles  Starting Services Security  Stopping Lifecycle  Updating Module  Uninstalling  All dynamically supported at runtime Execution Environment OS + Hardware © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 13. Service Layer Provides an in-VM service model  Services can be registered and consumed inside a VM Bundles  Again all operations are dynamic Services Security  Extensive support for notification of Lifecycle the service lifecycle Module Execution Environment OS + Hardware © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 14. Key Concepts For most users, there are really just two main concepts to learn  Bundles Supported by Execution Environment, Module, and Lifecycle layers  Services Supported by the Lifecycle and Service layers
  • 16. Bundle as Module OSGi technology’s modularity unit  Or, in enterprise terms, OSGi technology’s deployment unit  Again, main advantage of bundles is to achieve better re-use Regular JAR file  Java code  Resources  OSGi specific entries in MANIFEST.MF
  • 17. Bundle Definition MANIFEST.MF  Bundle-SymbolicName:  Bundle-Classpath:  Bundle-Version:  Bundle-Activator:  Import-Package:  Export-Package: export-package import-package bundle
  • 18. Importing and Exporting Packages Import-Package/Export-Package  Explicit dependency model Rigid documentation of public interface of module, which can be shared amongst development teams Helps with build automation (don’t under-estimate the effort of building large systems)  Allows dynamic selection (i.e. resolve) of dependencies Allows framework to find best suitable provider of a feature Allows framework to dynamically change provider, useful for patching system
  • 19. Bundle Versioning Versioning  Import-Package: com.acme.foo;version="[1.0.0.1, 2.1)“ ==> 1.0.0.1 <= version < 2.1  Import-Package: com.acme.foo;version="1.0.0.1“ ==> 1.0.0.1 <= version < ∞  Import-Package: com.acme.foo;version="1.0“ ==> 1.0.0.0 <= version < ∞
  • 20. Importing and Exporting Packages Attribute matching  Declarative way of influencing resolving  Example: Bundle A: Import-Package: com.acme.foo;company=ACME Bundle B: Export-Package: com.acme.foo Bundle C: Export-Package: com.acme.foo; company="ACME";
  • 21. Bundle Life-cycle INSTALLED:  Framework has bits installed RESOLVED:  Framework has resolved all dependencies successfully STARTING:  Framework is starting bundle, and invokes registered activators in the process ACTIVE:  Bundle is running STOPPING:  Framework is shutting down bundle, and invokes registered activators in the process
  • 22. Bundle Activation Use Bundle Activator to:  Contribute to start and stop of bundle  Allows bundle to manage resources (e.g. start thread, read file)  Specify Bundle-Activator and import org.osgi.framework  Should perform work async, or return quickly  Provides bundle implementer access to BundleContext object Note-worthy: there is no standard way of installing/un- installing bundle from remote agent
  • 23. Bundle Activation Bundle-SymbolicName: example.mybundle Bundle-Version: 1.0.0 Bundle-Activator: example.MyBundleActivator Import-Package: org.osgi.framework public class MyBundleActivator implements BundleActivator { public void start(BundleContext c) { // Initialize } public void stop(BundleContext c) { // Shutdown } }
  • 24. Bundle Activation Another approach is to use Spring-DM  Specify bundle as a Spring-DM application context Spring-Context: META-INF/spring-context.xml  Use standard Spring-bean life-cycle interfaces InitializingBean DisposableBean  By default, context is created asynchronously IMO, cleaner and simpler
  • 25. Bundle Activation Bundle-SymbolicName: example.mybundle Bundle-Version: 1.0.0 Spring-Context: META-INF/spring-context.xml Import-Package: <bean id=“bundleBean” class=“example.myBundleBean” init-method=“init” destroy-method=“destroy” />
  • 27. Services SOA deals with programming-in-the-large  Interaction between system components (e.g. WS-clients and WS-providers through WSDL) OSGi Service Layer allows one to bring SOA concepts (e.g. re-use, implementation abstraction) into the system component implementation level (e.g. programming-in-the- small) Main benefit: de-coupling of interface and implementation allows the selection of different implementation providers  Authentication/Authorization providers: LDAP, file-system
  • 28. Service Definition Services are regular Java classes  No need to implement technology-specific interfaces A Service is made of three components:  Service name(s) “example.AuthenticationService”  Service implementation example.LDAPAuthenticationServiceImpl  Service (reference) properties (optional) String property type = (‘file-system” | ‘ldap”)
  • 29. Service Interaction Service-provider bundles:  Register service name(s), implementation, and properties into a Service Registry Service-consumer bundles:  Query Service Registry for a particular service name(s) May do additional filtering by properties  Communicates through returned class/interface, does not see implementation Service Registry:  Similar to a map of services
  • 30. Service Registration AuthenticationService serviceImpl = new LDAPAuthenticationServiceImpl(); Dictionary properties = new Dictionary(); properties.put(“type”, “LDAP”); ServiceRegistration reference = bundleContext.registerService( new String [] {AuthenticationService.class.getName()}, serviceImpl, properties);
  • 31. Service Registration Or alternatively using Spring-DM: <bean name=“ldapService” class=“LDAPAuthenticationServiceImpl” /> <osgi:service ref=“ldapService“ interface="example.AuthenticationService"> <osgi:service-properties> <beans:entry key=“type" value=“LDAP"/> </osgi:service-properties> </osgi:service>
  • 32. Referencing Services ServiceReference reference = bundleContext.getServiceReference( AuthenticationService.class.getName()); AuthenticationService service = (AuthenticationService) bundleContext.getService(reference);
  • 33. Referencing Services Or <osgi:reference id=“authenService" interface="example.AuthenticationService"/>
  • 34. Services are Dynamic Services are dynamic, they may come and go  Service reference/service may be null/stale  Should not cache references ServiceListener used to keep track  ServiceTracker raises the ServiceListener abstraction Spring-DM proxies services, and will do the right thing
  • 36. Challenges Mind-set:  Understand that it is more work to create a modular solution, but it pays off long-term Design-time:  Very large Import-Packages Error-prone  Non-intuitive Import-Packages Hard to get correct when reflection is used (e.g. Kodo)
  • 37. Challenges Runtime:  Hard to debug complex class-path resolving instanceof just fails sometimes…  Service availability race-conditions Client applications referencing to services that have not been bound it Particularly a problem during start-up Certain features are missing or too hard to use:  Security, Configuration support, Transaction support
  • 38. Adoption Many framework implementations  Equinox – Open source  Felix – Open source  Knopflerfish – Open source  Concierge – Open source  ProSyst Spring Dynamic Modules for OSGi All Eclipse-based systems run on Equinox  Runtimes (e.g., RAP, Swordfish, Riena, ECF, EclipseLink)  RCP, eRCP  Tooling © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 39. Adoption Equinox OSGi as a component runtime Consistent programming model from embedded to server Reuse components across the spectrum NASA RAP JPMorgan Swordfish Lotus Riena Jazz Rational Suite WAS SAS eRCP Borland BEA Swiss Rail Nokia BEA Jazz Daimler Sprint Jazz Spring Riena Embedded Rich Client Tooling Server © 2008 by IBM Corp and Code 9; made available under the EPL v1.0 | March 2008
  • 40. Lessons Learned when using OSGi There are always opportunities for re-use  Re-use within organization  Re-use of standard services HTTP Service Service Tracker Initial Provisioning Declarative Services using Spring-DM Start Level Service Modularize at all levels  WL-EvS programming model itself is a separate bundle, de-coupled from other services, which means WL-EvS could in theory support other programming models, such as SCA, etc.
  • 41. Conclusion Standard  Several different implementations are available Mature  Proven technology  Over 8 years-old (versus JSR-277/294) Key-concepts  Bundles: re-usability  Service: flexibility, extensibility
  • 42. Q/A Alexandre Alves alex.alves@oracle.com