SlideShare une entreprise Scribd logo
1  sur  39
Introduction to OSGi
  & Eclipse Virgo


Gordon Dickens

@gdickens
linkedin.com/in/gordondickens
Blog: technophile.gordondickens.com
GitHub: github.com/gordonad




                                      1
>OSGi Terminology
 OSGI container
 Bundle
 Service
 Spring Dynamic Modules
 Spring dm Server




                           2
OSGI Container
 A low-footprint engine that manages
  OSGi components
 Can be embedded into applications to
  provide modular components
 Three major OSGi Containers:
    ◦ Equinox
      The reference implementation for the
       framework. The container built into Eclipse.
      Used by default with Spring dm Server
      Spring dm Server moving to Eclipse Virgo
       project
    ◦ Knoplerfish
    ◦ Apache Felix
                                                      3
The OSGi Bundle
 JAR   with extra Config Info
 ◦ Classes and resources that deliver
   functions to consumers

 ◦ Can “export” services & packages
 ◦ Can “import” services & packages




                                        4
More on Bundles (bundles for dummies?)
   Bundle is a JAR

   Requires a Manifest that describes the
    bundle
    ◦ META-INF/MANIFEST.MF

   You configure the Manifest with
    ◦   A machine-readable ID
    ◦   Packages required
    ◦   Which packages are exportable/private
    ◦   Services interfaces to expose
    ◦   Requirements - such as the minimum JDK

                                             5
Sample META-
         INF/MANIFEST.MF
Manifest-Version: 1.0
Export-Package: com.gordondickens.utils,org.osgi.framework”
Bundle-Name: Maven OSGi Demo – Services
Build-Jdk: 1.6.0
Bundle-Version: 1.0.0
Bundle-ManifestVersion: 2
Bundle-Activator: com.gordondickens.services.ServiceActivator
Bundle-SymbolicName: maven-osgi-demo-services
Import-Package: org.osgi.framework;version="1.3"




                                                                6
MANIFEST.MF Keywords
   Bundle-ManifestVersion
    ◦ Which OSGi container rules to follow.
       2 = OSGi Specification release 4
       1 = OSGi version 3 or earlier
   Bundle-Name
    ◦ Short, human readable name
   Bundle-SymbolicName
    ◦ Unique, machine-usable name
    ◦ Used by other bundles & container to refer to the bundle
   Bundle-Version
    ◦ Version of the bundle
   Bundle-Activator
    ◦ Listener class
    ◦ May be bound to bundle lifecycle (start, stop events)
   Bundle-Vendor
    ◦ Human readable name for the vendor who created the bundle
   Import-Package
    ◦ Set of packages required for dependency management

                                                                  7
Dependencies
   Bundles are versioned using the
    header Bundle-Version
    ◦ Matches Maven version numbers
      (underscores converted to periods)
   Bundles can require other Bundles to
    function
    ◦ This is configured with the Import-
      Package header
    ◦ Required versions can be specified using
      the version= keyword
   Versions can be a specific version or
    range
                                                 8
Bundle Lifecycle




                   9
What can you do with a
       bundle?
   Bundles just expose
    packages or services
                                            Service
    to be used                 Service
    ◦ Does not automatically
      hide impl classes                  Service
    ◦ Package exporting
      should only be for
      utility packages
      (plumbing).
                                    Bundle

◦   You only want to
    expose “services”

                                                      10
Services
 Register   POJOs to container as a
 service
 ◦ Source bundle registers the service
   interface
 ◦ Target bundle asks the container
   registry for a reference to the service
 Services   are managed by Virgo
 ◦ Services are “published” to the
   container registry
 ◦ Clients lookup and consume the
   services
                                             11
Preparing the Manifest
 You   could do that by hand, but…
 ◦ Format the MANIFEST.MF file
   EXACTLY per spec (ending each line
   on 72 characters, etc)

 Instead,Virgo provides the Bundlor
 build tool




                                        12
Bundlor
   Input:                   • Generates:
    ◦ jar
                               – manifest.mf
    ◦ template.mf
       Import-Template


     jar


                      The BUNDLOR              manifest.mf
template.mf



                                                         13
What is Blueprint?
   A framework that
    ◦ Exposes & consumes services from
      Beans
    ◦ Dynamically publishes App Contexts &
      beans
    ◦ Handles dependencies
    ◦ Can pause bundles while locating
      dependencies (during updates, etc)
    ◦ Simplifies defining OSGi bundles
    ◦ The basis for the Eclipse Virgo, a fully
      OSGi-compliant platform based on
      Equinox
    ◦ Originally from Spring Dynamic Modules
                                                 14
The Blueprint Extender
   Extender start up
    ◦   Looks for Blueprint enabled Bundles
    ◦   Loads their application contexts automatically
    ◦   Publishes application contexts
    ◦   Exports beans as Services
    ◦   Injects any consumed services from other
        Bundles automatically

   When a bundle comes online
    ◦ Detects & publishes the Application Context
    ◦ Inject beans from other required app contexts
   Replaces Bundle Activator
                                                         15
Template.mf
The Bundlor uses the template.mfto generate the OSGi required manifest.mffile
Which header(s) to use for dependency resolution:
   Import-Package - Core OSGi
     ◦   Used for every external package that the bundle depends on
   Require-Bundle - Core OSGi
     ◦   Bundle must be found to start this bundle
     ◦   Used specifying the bundle and bundle's version
     ◦   Brittle, only searched if not found in Import-Package
   Import-Bundle - Virgo
     ◦   Like Import-Package but all packages within an entire bundle
     ◦   Used specifying the bundle and bundle's version. Not always a best practice, too broad brush.
   Import-Library - Virgo
     ◦   Imports all packages of a specific package, from a library in the Virgo repository.
     ◦   Packages can be resolved across multiple bundles
     ◦   Preferred approach for expressing dependency on the Spring Framework.
   Import-Template - Bundlor
     ◦   Used to import packages by version range.
     ◦   Used when a transitive dependencies not found "your.package (0.0.0)" or "Import of package xyz doesn't specify
         a version”.
     ◦   Can use wildcards and setup custom patterns for matching.
   In Summary, you need to Import Packages! Bundlor assists with directives to save you time instead of listing out all
    your packages in the standard OSGi Import-Package header.
                                                                                                                           16
Dependency Management
   If a Bundle requires another bundle
    ◦ Load the other bundle
    ◦ Damping - Suspends any threads
      attempting to access the imported
      packages
    ◦ Once loaded, threads are resumed




                                          17
Using Blueprint
 Configuring your context
 The blueprint: namespace
 Exporting beans as OSGi Services
  into Registry
 Importing beans from OSGi Registry




                                       18
Configuring your Context
 Good   practice:
 ◦ Separate Spring configuration from
   Blueprint imports/exports
   bundle-context.xml
   bundle-context-osgi.xml
 Create2 context files in META-
 INF/spring
 ◦ All *.xml files in this dir are
   processed
                                        19
Blueprint Services
 Blueprint enables services to be
  published and consumed using
  descriptions written in XML
 Eclipse Virgo supports Blueprint
 The XML descriptions reside in files
  with extension .xml in the bundle’s
  META-INF/spring sub-directory.



                                         20
Spring DM Services
   To publish a service <blueprint:service> and
    specify
    ◦ implementation class
    ◦ interface class(es)
    ◦ at bundle start, an instance is published to the
      OSGi service registry under the interface
    ◦ impl class constructed like any other bean

   To consume a service <blueprint:reference>
    ◦ service may be passed into other beans using DI



                                                         21
Expose the Spring Bean as an OSGi
               Service

    Use        the osgi: namespace
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
 xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd”
 default-activation="eager">

<serviceref="exampleBean"
     interface="com.gordondickens.demo.bean.ExampleBean"/>

</blueprint>




                                                                  22
Consuming the Service
   Use the blueprint: namespace:
    ◦ Service Beans
    ◦ Valid OSGi Service beans
   Can be injected into other Beans using
    ◦ XML injection
    ◦ annotation-driven injection




                                             23
Example: Consuming an OSGi
            Service
                Use the <reference>tag in the
                 blueprint: namespace.

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
 default-activation="eager">

<reference id="exampleBeanService”/>
</blueprint>




                                                                  24
Alternative: use bean-name
   Exposing
<bean id="exampleBean”
    class="com.gordondickens.demo.bean.internal.ExampleBeanImpl" />

<service id="exampleBeanService”
     ref="exampleBean"
    interface="com.gordondickens.demo.bean.ExampleBean"/>



   Consuming
  <reference id="exampleBean”
  interface="com.gordondickens.demo.bean.ExampleBean" />




                                                                      25
Service Damping
   Proxies automatically created services
    ◦ the actual service object may come and go at runtime


   If service disappears, any proxies will wait
    for the service to re-appear.

   This effect is known as damping.




                                                             26
Blueprint Bundle Life
   When a bundle is started:
    ◦ builds application contexts as per the XML
    ◦ creates proxies for specified services
    ◦ publishes specified services to the registry


   When a bundle is stopped:
    ◦   retracts any services
    ◦   closes bundle application context
    ◦   turns off damping of a service proxy
    ◦   proxy’s app context is being closed

                                                     27
Eclipse Virgo
   OSGi Server based on Equinox
   Provides a PAR file archive
   Provides PLAN file for grouped or scoped
    bundles
   Provides Import-Bundle: tag to import all
    packages of a given Bundle
   Bundle Repository used to manage
    artifacts required by other projects
   Can be configured to automatically
    download required bundles from a Maven
    repository

                                                28
Virgo Dependency Mgmt
   Import-Bundle:
    ◦ Import-Package is fine grained
    ◦ Import-Bundle imports all Packages
      from a Bundle
   Import-Library:
    ◦   Imports a Blueprint configured Library
    ◦   A package of Bundles
    ◦   Example: the Spring 3.x Framework
    ◦   Can use wildcards

                                                 29
Virgo Fragments
 A bundle attached to a host bundle
 Treated as part of the host
 Can only add to the host
    ◦ Configuration
    ◦ Classes
    ◦ Resources

   Can not have
    ◦ activator
    ◦ its own class loader

   Designated in manifest.mf with Fragment-Host
    ◦ Fragment-Host points to symbolic name of host


                                                      30
Virgo Feature - Slices
    Fragments for web apps
    Uses manifest values
    In myapp/web/template.mf
       ◦ Slice-Host
       ◦ Slice-ContextPath
Slice-Host:
com.gordondickenssolutions.runtime.webapp;version="[1.1.0,1.1.0]"




Slice-ContextPath: /myapp


                                                                    31
Virgo Feature - PAR Files
 Platform Archive – like a jar/ear/war
 Multiple bundles packaged together
 Contains
    ◦   application name
    ◦   version
    ◦   symbolic name
    ◦   description
   The modules within are scoped together
   Cannot be shared accidentally by other apps
   The scope forms a boundary for automatic propagation of load time
    weaving and bundle refresh
   The modules of a PAR have their exported packages imported by
    the synthetic context bundle, used for thread context class loading
   The PAR file is visible to management interfaces
   The PAR file can be undeployed and redeployed as a unit
   PARs physically contain the included artifacts


                                                                          32
Virgo Feature -Plan Files
 Recommended over PARs
 Deployment strategy for a Virgo applications
 Similar to PARs describing a collection of
  bundles to load together as an application
 Simple XML file
    ◦ defines a collection of artifacts

   The syntax of a plan file
    ◦ outer <plan/> tag defines a name and version, as
      well as scoping and atomicity requirements
    ◦ Inside the tag is at least one artifact tag with
       type
       name
       version

                                                         33
Virgo Plan Files
 Deploys the artifacts in the order listed
 Can contain other plans (nesting)
 Easily share content between plans
 Update individual parts of a plan
  without repackaging (re-JAR)
 Copy the bundles to the repository
 the $DMS_HOME/repository/usr
  directory

                                          34
Virgo Plan File Example
<?xml version="1.0" encoding="UTF-8"?>
<plan name="greenpages.db.plan" version="2.4.3.RELEASE”
    scoped="false" atomic="true”
    xmlns=http://www.eclipse.org/virgo/schema/plan
    xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
    xsi:schemaLocation="http://www.eclipse.org/virgo/schema/plan
http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">



<attributes>
<attribute name="web.context.path" value="greenpages"/>
</attributes>

<!-- Database properties file (minus file extension) to be deployed -->
<artifact type="configuration" name="greenpages.db.config"/>

<artifact type="bundle" name="greenpages" version="[2.4, 2.5)"/>
<artifact type="bundle" name="greenpages.db" version="[2.4, 2.5)"/>
<artifact type="bundle" name="greenpages.jpa" version="[2.4, 2.5)"/>

<artifact type="bundle" name="greenpages.web" version="[2.4, 2.5)">
<property name="header:Web-ContextPath" value="${web.context.path}"/>
</artifact>
</plan>



                                                                          35
Connecting to OSGi Platform
 bin/startup.sh –shell
     [or]
 ssh -p 2402 admin@localhost




                                36
Admin Console
   http://localhost:8080/admin




                                  37
Terminology Review
 Bundle
 Service
 Extender
 Fragment
 Damping
 Slices




                     38
Summary
 Virgo   makes OSGi easier
 ◦ Registers with the OSGi container
 ◦ Exposes Beans as Services
 ◦ Consumes Services as Beans
 ◦ Simplfies MANIFEST.MF creation




                                       39

Contenu connexe

Tendances

MyFaces Universe at ApacheCon
MyFaces Universe at ApacheConMyFaces Universe at ApacheCon
MyFaces Universe at ApacheConos890
 
Container sig#1 ansible-container
Container sig#1 ansible-containerContainer sig#1 ansible-container
Container sig#1 ansible-containerNaoya Hashimoto
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementationChethan Pchethan
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSYoann Gotthilf
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
GR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug inGR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug inGR8Conf
 
When Camel meets CDI
When Camel meets CDIWhen Camel meets CDI
When Camel meets CDICode-House
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - WebpackRazvan Rosu
 
D2 OPEN SEMINAR - WWDC 핫 이슈
D2 OPEN SEMINAR - WWDC 핫 이슈D2 OPEN SEMINAR - WWDC 핫 이슈
D2 OPEN SEMINAR - WWDC 핫 이슈NAVER D2
 
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David BosschaertMaximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaertmfrancis
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for BeginnersOktay Esgul
 
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)WSO2
 
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010JUG Lausanne
 
CDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily JiangCDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily Jiangmfrancis
 
OSGi Enablement For Apache Tuscany
OSGi Enablement For Apache TuscanyOSGi Enablement For Apache Tuscany
OSGi Enablement For Apache TuscanyRaymond Feng
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEMario-Leander Reimer
 

Tendances (20)

Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
MyFaces Universe at ApacheCon
MyFaces Universe at ApacheConMyFaces Universe at ApacheCon
MyFaces Universe at ApacheCon
 
Container sig#1 ansible-container
Container sig#1 ansible-containerContainer sig#1 ansible-container
Container sig#1 ansible-container
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementation
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
GR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug inGR8Conf 2011: Grails, how to plug in
GR8Conf 2011: Grails, how to plug in
 
When Camel meets CDI
When Camel meets CDIWhen Camel meets CDI
When Camel meets CDI
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - Webpack
 
D2 OPEN SEMINAR - WWDC 핫 이슈
D2 OPEN SEMINAR - WWDC 핫 이슈D2 OPEN SEMINAR - WWDC 핫 이슈
D2 OPEN SEMINAR - WWDC 핫 이슈
 
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David BosschaertMaximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for Beginners
 
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
Integrating MQ Protocols with WSO2 ESB 4.9.0 (RabbitMQ, MQTT, Kafka)
 
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
 
CDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily JiangCDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily Jiang
 
Carbon and OSGi Deep Dive
Carbon and OSGi Deep DiveCarbon and OSGi Deep Dive
Carbon and OSGi Deep Dive
 
OSGi Enablement For Apache Tuscany
OSGi Enablement For Apache TuscanyOSGi Enablement For Apache Tuscany
OSGi Enablement For Apache Tuscany
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
Type script
Type scriptType script
Type script
 

En vedette

Eclipse Extensions Vs OSGI Services Tikal@ EclipseDemoCamps Tel Aviv
Eclipse Extensions Vs OSGI Services   Tikal@ EclipseDemoCamps Tel AvivEclipse Extensions Vs OSGI Services   Tikal@ EclipseDemoCamps Tel Aviv
Eclipse Extensions Vs OSGI Services Tikal@ EclipseDemoCamps Tel Avivguestb69b980e
 
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBMOSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBMmfrancis
 
OSGi, Eclipse and API Tooling
OSGi, Eclipse and API ToolingOSGi, Eclipse and API Tooling
OSGi, Eclipse and API ToolingChris Aniszczyk
 
Eclipse Plug-in Develompent Tips And Tricks
Eclipse Plug-in Develompent Tips And TricksEclipse Plug-in Develompent Tips And Tricks
Eclipse Plug-in Develompent Tips And TricksChris Aniszczyk
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in developmentMartin Toshev
 
What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0David Bosschaert
 
OSGi Provisioning With Apache ACE
OSGi Provisioning With Apache ACEOSGi Provisioning With Apache ACE
OSGi Provisioning With Apache ACEmfrancis
 
Eclipse e4 Tutorial - EclipseCon 2010
Eclipse e4 Tutorial - EclipseCon 2010Eclipse e4 Tutorial - EclipseCon 2010
Eclipse e4 Tutorial - EclipseCon 2010Lars Vogel
 
OSGi For Eclipse Developers
OSGi For Eclipse DevelopersOSGi For Eclipse Developers
OSGi For Eclipse DevelopersChris Aniszczyk
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCPEric Jain
 
PDE Good Practices
PDE Good PracticesPDE Good Practices
PDE Good PracticesAnkur Sharma
 
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!Noopur Gupta
 
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAPcho hyun jong
 
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
The Eclipse IDE - The Force Awakens (Devoxx France 2016)The Eclipse IDE - The Force Awakens (Devoxx France 2016)
The Eclipse IDE - The Force Awakens (Devoxx France 2016)mikaelbarbero
 
테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈cho hyun jong
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with DataSeth Familian
 

En vedette (17)

RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Eclipse Extensions Vs OSGI Services Tikal@ EclipseDemoCamps Tel Aviv
Eclipse Extensions Vs OSGI Services   Tikal@ EclipseDemoCamps Tel AvivEclipse Extensions Vs OSGI Services   Tikal@ EclipseDemoCamps Tel Aviv
Eclipse Extensions Vs OSGI Services Tikal@ EclipseDemoCamps Tel Aviv
 
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBMOSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
OSGi Technology, Eclipse and Convergence - Jeff McAffer, IBM
 
OSGi, Eclipse and API Tooling
OSGi, Eclipse and API ToolingOSGi, Eclipse and API Tooling
OSGi, Eclipse and API Tooling
 
Eclipse Plug-in Develompent Tips And Tricks
Eclipse Plug-in Develompent Tips And TricksEclipse Plug-in Develompent Tips And Tricks
Eclipse Plug-in Develompent Tips And Tricks
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
 
What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0
 
OSGi Provisioning With Apache ACE
OSGi Provisioning With Apache ACEOSGi Provisioning With Apache ACE
OSGi Provisioning With Apache ACE
 
Eclipse e4 Tutorial - EclipseCon 2010
Eclipse e4 Tutorial - EclipseCon 2010Eclipse e4 Tutorial - EclipseCon 2010
Eclipse e4 Tutorial - EclipseCon 2010
 
OSGi For Eclipse Developers
OSGi For Eclipse DevelopersOSGi For Eclipse Developers
OSGi For Eclipse Developers
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCP
 
PDE Good Practices
PDE Good PracticesPDE Good Practices
PDE Good Practices
 
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
Mastering your Eclipse IDE - Tips, Tricks, Java 8 tooling & More!
 
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
 
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
The Eclipse IDE - The Force Awakens (Devoxx France 2016)The Eclipse IDE - The Force Awakens (Devoxx France 2016)
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
 
테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 

Similaire à Intro to OSGi and Eclipse Virgo

Eclipse_Building_Blocks
Eclipse_Building_BlocksEclipse_Building_Blocks
Eclipse_Building_BlocksRahul Shukla
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesRob Davies
 
CD in kubernetes using helm and ksonnet. Stas Kolenkin
CD in kubernetes using helm and ksonnet. Stas KolenkinCD in kubernetes using helm and ksonnet. Stas Kolenkin
CD in kubernetes using helm and ksonnet. Stas KolenkinDataArt
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiToni Epple
 
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
 
OSGi Training for Carbon Developers
OSGi Training for Carbon DevelopersOSGi Training for Carbon Developers
OSGi Training for Carbon DevelopersAruna Karunarathna
 
K8s Quick Start
K8s Quick StartK8s Quick Start
K8s Quick StartGanesh Pol
 
Setup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architectureSetup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architectureMindfire Solutions
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi WebinarWSO2
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Serge van den Oever
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1kshanth2101
 
Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsExpeed Software
 
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010Atlassian
 
IBM Cloud Pak for Integration 2020.2.1 installation
IBM Cloud Pak for Integration 2020.2.1 installation IBM Cloud Pak for Integration 2020.2.1 installation
IBM Cloud Pak for Integration 2020.2.1 installation khawkwf
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetesdatamantra
 
OSGi Sticker Shock Eclipse Con 2010
OSGi Sticker Shock   Eclipse Con 2010OSGi Sticker Shock   Eclipse Con 2010
OSGi Sticker Shock Eclipse Con 2010ericjohnson
 
Introduction to Webpack 5.0 Presentation
Introduction to Webpack 5.0 PresentationIntroduction to Webpack 5.0 Presentation
Introduction to Webpack 5.0 PresentationKnoldus Inc.
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdfAbid Malik
 

Similaire à Intro to OSGi and Eclipse Virgo (20)

Eclipse_Building_Blocks
Eclipse_Building_BlocksEclipse_Building_Blocks
Eclipse_Building_Blocks
 
Osgi
OsgiOsgi
Osgi
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application Bundles
 
CD in kubernetes using helm and ksonnet. Stas Kolenkin
CD in kubernetes using helm and ksonnet. Stas KolenkinCD in kubernetes using helm and ksonnet. Stas Kolenkin
CD in kubernetes using helm and ksonnet. Stas Kolenkin
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGi
 
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
 
OSGi Training for Carbon Developers
OSGi Training for Carbon DevelopersOSGi Training for Carbon Developers
OSGi Training for Carbon Developers
 
K8s Quick Start
K8s Quick StartK8s Quick Start
K8s Quick Start
 
Setup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architectureSetup ColdFusion application using fusebox mvc architecture
Setup ColdFusion application using fusebox mvc architecture
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1
 
Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applications
 
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
Plugins 2.0 & OSGi Gotchas - Atlassian Summit 2010
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
 
IBM Cloud Pak for Integration 2020.2.1 installation
IBM Cloud Pak for Integration 2020.2.1 installation IBM Cloud Pak for Integration 2020.2.1 installation
IBM Cloud Pak for Integration 2020.2.1 installation
 
Scalable Spark deployment using Kubernetes
Scalable Spark deployment using KubernetesScalable Spark deployment using Kubernetes
Scalable Spark deployment using Kubernetes
 
OSGi Sticker Shock Eclipse Con 2010
OSGi Sticker Shock   Eclipse Con 2010OSGi Sticker Shock   Eclipse Con 2010
OSGi Sticker Shock Eclipse Con 2010
 
Introduction to Webpack 5.0 Presentation
Introduction to Webpack 5.0 PresentationIntroduction to Webpack 5.0 Presentation
Introduction to Webpack 5.0 Presentation
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdf
 

Dernier

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Dernier (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

Intro to OSGi and Eclipse Virgo

  • 1. Introduction to OSGi & Eclipse Virgo Gordon Dickens @gdickens linkedin.com/in/gordondickens Blog: technophile.gordondickens.com GitHub: github.com/gordonad 1
  • 2. >OSGi Terminology  OSGI container  Bundle  Service  Spring Dynamic Modules  Spring dm Server 2
  • 3. OSGI Container  A low-footprint engine that manages OSGi components  Can be embedded into applications to provide modular components  Three major OSGi Containers: ◦ Equinox  The reference implementation for the framework. The container built into Eclipse.  Used by default with Spring dm Server  Spring dm Server moving to Eclipse Virgo project ◦ Knoplerfish ◦ Apache Felix 3
  • 4. The OSGi Bundle  JAR with extra Config Info ◦ Classes and resources that deliver functions to consumers ◦ Can “export” services & packages ◦ Can “import” services & packages 4
  • 5. More on Bundles (bundles for dummies?)  Bundle is a JAR  Requires a Manifest that describes the bundle ◦ META-INF/MANIFEST.MF  You configure the Manifest with ◦ A machine-readable ID ◦ Packages required ◦ Which packages are exportable/private ◦ Services interfaces to expose ◦ Requirements - such as the minimum JDK 5
  • 6. Sample META- INF/MANIFEST.MF Manifest-Version: 1.0 Export-Package: com.gordondickens.utils,org.osgi.framework” Bundle-Name: Maven OSGi Demo – Services Build-Jdk: 1.6.0 Bundle-Version: 1.0.0 Bundle-ManifestVersion: 2 Bundle-Activator: com.gordondickens.services.ServiceActivator Bundle-SymbolicName: maven-osgi-demo-services Import-Package: org.osgi.framework;version="1.3" 6
  • 7. MANIFEST.MF Keywords  Bundle-ManifestVersion ◦ Which OSGi container rules to follow.  2 = OSGi Specification release 4  1 = OSGi version 3 or earlier  Bundle-Name ◦ Short, human readable name  Bundle-SymbolicName ◦ Unique, machine-usable name ◦ Used by other bundles & container to refer to the bundle  Bundle-Version ◦ Version of the bundle  Bundle-Activator ◦ Listener class ◦ May be bound to bundle lifecycle (start, stop events)  Bundle-Vendor ◦ Human readable name for the vendor who created the bundle  Import-Package ◦ Set of packages required for dependency management 7
  • 8. Dependencies  Bundles are versioned using the header Bundle-Version ◦ Matches Maven version numbers (underscores converted to periods)  Bundles can require other Bundles to function ◦ This is configured with the Import- Package header ◦ Required versions can be specified using the version= keyword  Versions can be a specific version or range 8
  • 10. What can you do with a bundle?  Bundles just expose packages or services Service to be used Service ◦ Does not automatically hide impl classes Service ◦ Package exporting should only be for utility packages (plumbing). Bundle ◦ You only want to expose “services” 10
  • 11. Services  Register POJOs to container as a service ◦ Source bundle registers the service interface ◦ Target bundle asks the container registry for a reference to the service  Services are managed by Virgo ◦ Services are “published” to the container registry ◦ Clients lookup and consume the services 11
  • 12. Preparing the Manifest  You could do that by hand, but… ◦ Format the MANIFEST.MF file EXACTLY per spec (ending each line on 72 characters, etc)  Instead,Virgo provides the Bundlor build tool 12
  • 13. Bundlor  Input: • Generates: ◦ jar – manifest.mf ◦ template.mf  Import-Template jar The BUNDLOR manifest.mf template.mf 13
  • 14. What is Blueprint?  A framework that ◦ Exposes & consumes services from Beans ◦ Dynamically publishes App Contexts & beans ◦ Handles dependencies ◦ Can pause bundles while locating dependencies (during updates, etc) ◦ Simplifies defining OSGi bundles ◦ The basis for the Eclipse Virgo, a fully OSGi-compliant platform based on Equinox ◦ Originally from Spring Dynamic Modules 14
  • 15. The Blueprint Extender  Extender start up ◦ Looks for Blueprint enabled Bundles ◦ Loads their application contexts automatically ◦ Publishes application contexts ◦ Exports beans as Services ◦ Injects any consumed services from other Bundles automatically  When a bundle comes online ◦ Detects & publishes the Application Context ◦ Inject beans from other required app contexts  Replaces Bundle Activator 15
  • 16. Template.mf The Bundlor uses the template.mfto generate the OSGi required manifest.mffile Which header(s) to use for dependency resolution:  Import-Package - Core OSGi ◦ Used for every external package that the bundle depends on  Require-Bundle - Core OSGi ◦ Bundle must be found to start this bundle ◦ Used specifying the bundle and bundle's version ◦ Brittle, only searched if not found in Import-Package  Import-Bundle - Virgo ◦ Like Import-Package but all packages within an entire bundle ◦ Used specifying the bundle and bundle's version. Not always a best practice, too broad brush.  Import-Library - Virgo ◦ Imports all packages of a specific package, from a library in the Virgo repository. ◦ Packages can be resolved across multiple bundles ◦ Preferred approach for expressing dependency on the Spring Framework.  Import-Template - Bundlor ◦ Used to import packages by version range. ◦ Used when a transitive dependencies not found "your.package (0.0.0)" or "Import of package xyz doesn't specify a version”. ◦ Can use wildcards and setup custom patterns for matching.  In Summary, you need to Import Packages! Bundlor assists with directives to save you time instead of listing out all your packages in the standard OSGi Import-Package header. 16
  • 17. Dependency Management  If a Bundle requires another bundle ◦ Load the other bundle ◦ Damping - Suspends any threads attempting to access the imported packages ◦ Once loaded, threads are resumed 17
  • 18. Using Blueprint  Configuring your context  The blueprint: namespace  Exporting beans as OSGi Services into Registry  Importing beans from OSGi Registry 18
  • 19. Configuring your Context  Good practice: ◦ Separate Spring configuration from Blueprint imports/exports  bundle-context.xml  bundle-context-osgi.xml  Create2 context files in META- INF/spring ◦ All *.xml files in this dir are processed 19
  • 20. Blueprint Services  Blueprint enables services to be published and consumed using descriptions written in XML  Eclipse Virgo supports Blueprint  The XML descriptions reside in files with extension .xml in the bundle’s META-INF/spring sub-directory. 20
  • 21. Spring DM Services  To publish a service <blueprint:service> and specify ◦ implementation class ◦ interface class(es) ◦ at bundle start, an instance is published to the OSGi service registry under the interface ◦ impl class constructed like any other bean  To consume a service <blueprint:reference> ◦ service may be passed into other beans using DI 21
  • 22. Expose the Spring Bean as an OSGi Service  Use the osgi: namespace <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd” default-activation="eager"> <serviceref="exampleBean" interface="com.gordondickens.demo.bean.ExampleBean"/> </blueprint> 22
  • 23. Consuming the Service  Use the blueprint: namespace: ◦ Service Beans ◦ Valid OSGi Service beans  Can be injected into other Beans using ◦ XML injection ◦ annotation-driven injection 23
  • 24. Example: Consuming an OSGi Service  Use the <reference>tag in the blueprint: namespace. <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" default-activation="eager"> <reference id="exampleBeanService”/> </blueprint> 24
  • 25. Alternative: use bean-name  Exposing <bean id="exampleBean” class="com.gordondickens.demo.bean.internal.ExampleBeanImpl" /> <service id="exampleBeanService” ref="exampleBean" interface="com.gordondickens.demo.bean.ExampleBean"/>  Consuming <reference id="exampleBean” interface="com.gordondickens.demo.bean.ExampleBean" /> 25
  • 26. Service Damping  Proxies automatically created services ◦ the actual service object may come and go at runtime  If service disappears, any proxies will wait for the service to re-appear.  This effect is known as damping. 26
  • 27. Blueprint Bundle Life  When a bundle is started: ◦ builds application contexts as per the XML ◦ creates proxies for specified services ◦ publishes specified services to the registry  When a bundle is stopped: ◦ retracts any services ◦ closes bundle application context ◦ turns off damping of a service proxy ◦ proxy’s app context is being closed 27
  • 28. Eclipse Virgo  OSGi Server based on Equinox  Provides a PAR file archive  Provides PLAN file for grouped or scoped bundles  Provides Import-Bundle: tag to import all packages of a given Bundle  Bundle Repository used to manage artifacts required by other projects  Can be configured to automatically download required bundles from a Maven repository 28
  • 29. Virgo Dependency Mgmt  Import-Bundle: ◦ Import-Package is fine grained ◦ Import-Bundle imports all Packages from a Bundle  Import-Library: ◦ Imports a Blueprint configured Library ◦ A package of Bundles ◦ Example: the Spring 3.x Framework ◦ Can use wildcards 29
  • 30. Virgo Fragments  A bundle attached to a host bundle  Treated as part of the host  Can only add to the host ◦ Configuration ◦ Classes ◦ Resources  Can not have ◦ activator ◦ its own class loader  Designated in manifest.mf with Fragment-Host ◦ Fragment-Host points to symbolic name of host 30
  • 31. Virgo Feature - Slices  Fragments for web apps  Uses manifest values  In myapp/web/template.mf ◦ Slice-Host ◦ Slice-ContextPath Slice-Host: com.gordondickenssolutions.runtime.webapp;version="[1.1.0,1.1.0]" Slice-ContextPath: /myapp 31
  • 32. Virgo Feature - PAR Files  Platform Archive – like a jar/ear/war  Multiple bundles packaged together  Contains ◦ application name ◦ version ◦ symbolic name ◦ description  The modules within are scoped together  Cannot be shared accidentally by other apps  The scope forms a boundary for automatic propagation of load time weaving and bundle refresh  The modules of a PAR have their exported packages imported by the synthetic context bundle, used for thread context class loading  The PAR file is visible to management interfaces  The PAR file can be undeployed and redeployed as a unit  PARs physically contain the included artifacts 32
  • 33. Virgo Feature -Plan Files  Recommended over PARs  Deployment strategy for a Virgo applications  Similar to PARs describing a collection of bundles to load together as an application  Simple XML file ◦ defines a collection of artifacts  The syntax of a plan file ◦ outer <plan/> tag defines a name and version, as well as scoping and atomicity requirements ◦ Inside the tag is at least one artifact tag with  type  name  version 33
  • 34. Virgo Plan Files  Deploys the artifacts in the order listed  Can contain other plans (nesting)  Easily share content between plans  Update individual parts of a plan without repackaging (re-JAR)  Copy the bundles to the repository  the $DMS_HOME/repository/usr directory 34
  • 35. Virgo Plan File Example <?xml version="1.0" encoding="UTF-8"?> <plan name="greenpages.db.plan" version="2.4.3.RELEASE” scoped="false" atomic="true” xmlns=http://www.eclipse.org/virgo/schema/plan xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://www.eclipse.org/virgo/schema/plan http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd"> <attributes> <attribute name="web.context.path" value="greenpages"/> </attributes> <!-- Database properties file (minus file extension) to be deployed --> <artifact type="configuration" name="greenpages.db.config"/> <artifact type="bundle" name="greenpages" version="[2.4, 2.5)"/> <artifact type="bundle" name="greenpages.db" version="[2.4, 2.5)"/> <artifact type="bundle" name="greenpages.jpa" version="[2.4, 2.5)"/> <artifact type="bundle" name="greenpages.web" version="[2.4, 2.5)"> <property name="header:Web-ContextPath" value="${web.context.path}"/> </artifact> </plan> 35
  • 36. Connecting to OSGi Platform  bin/startup.sh –shell [or]  ssh -p 2402 admin@localhost 36
  • 37. Admin Console  http://localhost:8080/admin 37
  • 38. Terminology Review  Bundle  Service  Extender  Fragment  Damping  Slices 38
  • 39. Summary  Virgo makes OSGi easier ◦ Registers with the OSGi container ◦ Exposes Beans as Services ◦ Consumes Services as Beans ◦ Simplfies MANIFEST.MF creation 39

Notes de l'éditeur

  1. Analagous (not completely) to web application containers in that there is a specification (OSGI R4) and various implementations of the specification. Sun is also trying to build it’s own Java Module system as JSR-277, and there is a draft circulating to provide OSGI Bundles within the Java Module System when it is deployed. See http://openjdk.java.net/projects/modules/osgi-support-draft.html for more details on this proposal, and http://jcp.org/en/jsr/detail?id=277 for details on JSR-277.
  2. This was created for us by a maven plugin (we’ll see later in this chapter)… Bundle-ManifestVersion – Which OSGi container rules to follow. 2 = OSGi Specification release 4 1 = OSGi version 3 or earlierBundle-Name – Short, human readable nameBundle-SymbolicName – Unique, machine-usable name for the bundle used by other bundles and the container to refer to the bundleBundle-Version – The version of the bundle that is being deployedBundle-Activator – A listener class that may be bound to the lifecycle of the bundle (start, stop events)Bundle-Vendor – A human readable name for the vendor who created the bundleImport-Package – A set of packages that are required for dependency management
  3. Services provide a way to register a Java POJO within the OSGi container. The services can be then referenced by name in the OSGi container by any other module that requests the package the service is exposed within.
  4. The maven-bundle-plugin works to build standard MANIFEST.MF files. You can use the output of this plugin in Felix, Knopflerfish and Equinox.We’ll see in an upcoming chapter that Spring-DM gives us an even bigger advantage.sample Maven configuration for the plugin: &lt;build&gt; &lt;plugins&gt; … &lt;plugin&gt; &lt;groupId&gt;org.apache.felix&lt;/groupId&gt; &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt; &lt;extensions&gt;true&lt;/extensions&gt; &lt;version&gt;1.4.3&lt;/version&gt; &lt;configuration&gt; &lt;instructions&gt; &lt;Export-Package&gt;com.gordondickens.services.interfaces, com.gordondickens.services, com.gordondickens.services.impl&lt;/Export-Package&gt; &lt;Export-Service&gt;com.gordondickens.services.interfaces.SayHelloService;version=&quot;1.0&quot;&lt;/Export-Service&gt; &lt;Bundle-SymbolicName&gt;maven-osgi-demo-services&lt;/Bundle-SymbolicName&gt; &lt;Bundle-Activator&gt;com.gordondickens.services.ServiceActivator&lt;/Bundle-Activator&gt; &lt;Import-Package&gt;*&lt;/Import-Package&gt; &lt;/instructions&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt;
  5. Undeploying also destroys application contexts. Undeploying the extender undeploys all application contexts.
  6. This behavior can be overridden in the manifest.
  7. Parameter descriptions:ref = the bean to lookup in the Spring Contextid= the OSGi service name to export (and that can be consumed by another Spring-DM bundle as a Spring Bean)interface = the service interface to advertise to the OSGi frameworkNote: If a bean implements multiple business interfaces, you can use an alternative form:&lt;osgi:service id=&quot;theServiceId&quot; ref=&quot;theBeanid&quot;&gt; &lt;osgi:interfaces&gt; &lt;value&gt;com.gordondickens.bean.InterfaceA&lt;/value&gt; &lt;value&gt;com.gordondickens.bean.interfaceB&lt;/value&gt; &lt;/osgi:interfaces&gt;&lt;/osgi:service&gt;&lt;s
  8. Note: if you consume a OSGi Service that is not created by a Spring Dynamic Module, you will get the service based on the default OSGi service registry lookup rules (see the OSGi specification section 5 for details at www.osgi.org).
  9. Note – the same multi-interface wiring applies here too:&lt;osgi:reference id=&quot;exampleBeanService&quot;&gt; &lt;osgi:interfaces&gt; &lt;value&gt;com.gordondickens.demo.bean.ExampleBean&lt;/value&gt; &lt;value&gt;com.gordondickens.demo.bean.Example2Bean&lt;/value&gt; &lt;/osgi:interfaces&gt;&lt;/osgi:references&gt;
  10. The bean-name attribute on the osgi:reference tag allows you to refer to the bean not by an OSGi Service ID, but by the actual bean ID in the Spring context. If the Spring Bean exampleBean was exposed to OSGi as exampleBeanService, a consuming context could request it using a bean-name rather than an id, and therefore refer to Spring names, not OSGi names.Note that this mechanism matches on Services that expose the ExampleBean interface and that have a property named org.springframework.osgi.bean.nameset to exampleBean.
  11. Note: the bundles in the repository must be standard OSGi header-based bundles, NOT ones with Import-Bundle: and Import-Library tags. This means that the Spring-DM server is holding onto pure OSGi bundles, and allowing you to deploy your applications based on Spring-DM headers in the deployment directory.You may then use Import-Bundle, which imports all packages from a Bundle, or Import-Library, which imports a series of bundles (example: Spring Framework library)
  12. Sample Manifest:Manifest-Version: 1.0Bundle-Name: DemoSpringDMBundle BundleBundle-ManifestVersion: 2Bundle-SymbolicName: DemoSpringDMBundleBundle-Version: 1.0.0Import-Library: org.springframework.spring;version=&quot;[2.5.6.A,2.5.6.A]&quot;Import-Bundle: org.eclipse.osgi.services;version=&quot;[3.1.200.v20071203,3.1.200.v20071203]&quot;Import-Package: org.osgi.framework;version=&quot;[1.4.0,1.4.0]&quot;Bundle-Activator: com.gordondickens.demo.BeanRunner
  13. For information on the Spring-DM Server, visit www.springsource.com