SlideShare une entreprise Scribd logo
1  sur  36
Télécharger pour lire hors ligne
Michael Greifeneder


                           OSGi
  The Next Generation Java Service Platform


                 SOA - The Java Way
                          or
                My classpath is killing me

Bilder von Peter Kriens “W-JAX Keynote 2007” und
Neil Bartletts “Getting Started with OSGi”
Inhalt

    Problem
●


    OSGi
●


    SOA
●


    Tools
●
Warum OSGi?
Im besten Fall:




Aber auch dieses Verhalten möglich:
Was fehlt?                Application


    Sinnvoller Name für Jar
●
                                Lib A              Lib B

    Version
●


    Abhängigkeiten
●                              Lib C v1          Lib C v2

    Verstecken von internen Klassen
●


    Late Binding, Dynamics
●
OSGi
    Ursprünglich “Open Service Gateway
●

    Initiative” für Embedded Systems
    Heute: Dynamic Module System For Java
●


    Eclipse basiert seit Version 3.0 auf OSGi.
●


    OSGi Alliance definiert Spezifikation seit
●

    '99
        Mitglieder: Nokia, IBM,...
    –

        Aktuelles Release 4.1
    –

    http://www.osgi.org
Implementierungen
    Equinox
●


        Unterbau für Eclipse, Common Public License
    –
        http://www.eclipse.org/equinox/
    Apache Felix
●


        Apache License, http://felix.apache.org
    –

    Makewave Knopflerfish
●


        BSD style license, http://www.knopflerfish.org/
    –

        GUI und Web-Console
    –
Framework
    L0: Execution Environment
●


        Profile definieren Minimum: Mobile, J2SE, EE
    –

    L1: Modules
●


    L2: Life Cycle
●
                                                              S
                                Applications
    Management                                                E
                                                  Services
                                (bundles)                     C
                                                              U
    L3: Service Registry
●                                                Life Cycle   R
                                                              I
                                                              T
                                                   Module
                                                              Y
                                        Java Execution Env

                                                 OS + Hardware
Modules
    Modularisierung
●

    durch
    Bundles
    Eigene
●

    Classloader
    Schutz von
●

    Packages
    Versionierung
●
Lifecycle
    Jedes Bundle
●

    hat Lifecycle          INSTALLED            STARTING

    Bundle Manager
●

    ist Teil der                        start

    Spezifikation
                           RESOLVED              ACTIVE


                                                     stop



                          UNINSTALLED           STOPPING
Metadaten
    META-INF/MANIFEST.MF
●


        Bundle-Name: test.movieservice
    –
        Bundle-SymbolicName: test.movieservice
        Bundle-Version: 1.0.0.SNAPSHOT
    –

        Export-Package: test.movieservice
    –

        Import-Package: test.dto
    –

        BundleActivator:
    –
        test.movieservice.BundleActivator
Probleme
    Jars müssen angepasst werden
●


        Metadaten
    –

    Libraries, die eigene Classloader
●

    verwenden
        z.B.: Hibernate
    –

    Dynamik der Bundles und Services
●

    schwerer zu handhaben
Services - SOA?
    “SOA ist doch was mit Webservices,
●

    oder?”
SOA
  mit Webservices
  und XML




http://www.flickr.com/photos/psd/114552560/in/set-72057594085366895/
Services - SOA?
    Webservices bieten Dienste im Netz an
●

    und greifen über das Netz auf andere
    Services zurück.
    XML dient als Lingua Franka zwischen
    verschiedenen Plattformen
    Die OSGi Service Platform stellt Services
●

    innerhalb einer Java VM zur Verfügung
Services
    System Services
●


        Log Service, Preferences Service,
    –
        Configuration Admin Service, User Admin
        Service, ...
    Protocol Services
●


        HTTP Service , UPnP Service, ...
    –

    Other
●


        XML Parser Service, ...
    –
Services
    Manuelle Registrierung
●


class X implements BundleActivator {
  public void start(BundleContext context) {
    DbService s = new MyDbService();
    context.registerService(
       DbService.class.getName(), s);
  }
}
Services
    Manuelle Verwendung
●

    ServiceReference ref =
      context.getServiceReference(
         DbService.class.getName());
    if (ref != null) {
      DbService s = context.lookup(ref);
      if (s != null) {
         s.callDbService();
      }
    }

    Flexibel, aber mühsam
●
Equinox-
Extensions
     Extensions sind
    ●

    Deklarationen
    ●Lazy Loading

    ●z.B. Menüpunkte




Declarative
Services
 Deklaration in XML
●

●Kein Lazy Loading


    http://www.eclipsezone.com/articles/extensions-vs-services/images/extensions.png
Spring Dynamic Modules
                      for OSGi(tm) Service Platforms
      Wie Spring Framework unter Apache
  ●

      Lizenz
      Spring konfiguriert Anwendungen und
  ●

      kümmert sich um
           Injektion und Deklaration von Services
       –

           Transaktionen
       –

           Logging
       –

           Datenbankabstraktion
       –


http://www.springframework.org/osgi
Spring DM
    META-INF/spring/*-context.xml
●



    <osgi:reference id=quot;db4oOsgiServicequot;
●

    interface=quot;com.db4o.osgi.Db4oServicequot;/>
    <bean name=quot;MovieServiceDb4oquot;
●

    class=quot;test.movieservice.db4o.MovieServiceImplquot;
       init-method=quot;startquot;
       destroy-method=quot;stopquot;>
       <property name=quot;db4oServicequot;
          ref=quot;db4oOsgiServicequot;></property>
    </bean>
    <osgi:service id=quot;db4oMovieServicequot;
●

    ref=quot;MovieServiceDb4oquot;
    interface=quot;test.movieservice.MovieServicequot;>
    </osgi:service>
Open Participation Software for Java


                          PAX
    Projekte von OPS4J
●


    Pax-Construct:
●


        Maven Plugins zum Erstellen, Builden,
    –
        Verwalten und Deployen von OSGI
        Komponenten. Eclipse-Konfiguration
        Verwendet Bnd - Bundle Tool
    –

    Pax-runner
●


        Erleichtert das Testen mit mehrere
    –
        Implementierungen: Equinox, Felix,...
    Pax-Logging,...
●
again...
http://i9.photobucket.com/albums/a59/Heynowrcp/spring.jpg
SpringSource Application Server
    Basiert auf OSGI. Verwendet Equinox als
●

    Unterbau.
    Alle Komponenten des Spring-Frameworks
●

    sind bereits OSGI-ready
    Basiert auf Spring Dynamic Modules
●


    Erweiterungen für Webentwicklung
●


        Bietet spezielles Bundle-Repository
    –

        Deploymenthilfen (zB War File oder PAR)
    –

    Lizensiert unter GPL
●
Summary
    Modularität
●


    Versionierung
●


    Dynamik
●


    Services
●


        Spring DM
    –

        Equinox Extensions
    –

    Achtung bei noch nicht OSGi-ready
●

    Bibliotheken
ENDE

Danke für die Aufmerksamkeit!


    ??? Fragen ???
         Diskussion
Links
    http://www.osgi.org/Specifications/HomePage
●



    http://www.aqute.biz/OSGi/Presentations
●



    http://www.eclipse.org/equinox-portal/getstarted.php
●



    http://www.eclipsecon.org/
●



    http://developers.sun.com/learning/javaoneonline
●



    http://neilbartlett.name/blog/osgibook/
●



    http://www.springframework.org/osgi
●



    http://www.infoq.com/presentations/colyer-server-side-osgi
●


●

Contenu connexe

En vedette

Sunspace presentation for Atlassian Webinar
Sunspace presentation for Atlassian WebinarSunspace presentation for Atlassian Webinar
Sunspace presentation for Atlassian Webinarguest10303d
 
Qué Es Accesibilidad
Qué Es AccesibilidadQué Es Accesibilidad
Qué Es Accesibilidadguest9cd641d
 
Hindsight To The Future
Hindsight To The FutureHindsight To The Future
Hindsight To The FutureG Fernandez
 
Mercury Hedge Final
Mercury Hedge FinalMercury Hedge Final
Mercury Hedge FinalCIG S.A.
 

En vedette (6)

Sunspace presentation for Atlassian Webinar
Sunspace presentation for Atlassian WebinarSunspace presentation for Atlassian Webinar
Sunspace presentation for Atlassian Webinar
 
34920(3)
34920(3)34920(3)
34920(3)
 
2009
20092009
2009
 
Qué Es Accesibilidad
Qué Es AccesibilidadQué Es Accesibilidad
Qué Es Accesibilidad
 
Hindsight To The Future
Hindsight To The FutureHindsight To The Future
Hindsight To The Future
 
Mercury Hedge Final
Mercury Hedge FinalMercury Hedge Final
Mercury Hedge Final
 

Similaire à JSUG - OSGi by Michael Greifeneder

Scala - OSGi Bundles from Outer (Java) Space
Scala - OSGi Bundles from Outer (Java) SpaceScala - OSGi Bundles from Outer (Java) Space
Scala - OSGi Bundles from Outer (Java) SpaceOliver Braun
 
Java EE Microservices ohne Server
Java EE Microservices ohne ServerJava EE Microservices ohne Server
Java EE Microservices ohne Servergedoplan
 
Server Revolutions- Der Spring Source DM Server
Server Revolutions- Der Spring Source DM ServerServer Revolutions- Der Spring Source DM Server
Server Revolutions- Der Spring Source DM ServerSandro Sonntag
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsQAware GmbH
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsJosef Adersberger
 
Jalimo Slides Linuxtag2007
Jalimo Slides Linuxtag2007Jalimo Slides Linuxtag2007
Jalimo Slides Linuxtag2007smancke
 
ANEO | Automatisierung mit RedHat Ansible
ANEO | Automatisierung mit RedHat AnsibleANEO | Automatisierung mit RedHat Ansible
ANEO | Automatisierung mit RedHat AnsibleCarolineAuerMarcher
 
Ionic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf SteroidenIonic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf SteroidenHendrik Lösch
 
Let's talk about Java EE
Let's talk about Java EELet's talk about Java EE
Let's talk about Java EEAndreas König
 
Einführung in Puppet und Vagrant
Einführung in Puppet und VagrantEinführung in Puppet und Vagrant
Einführung in Puppet und Vagrants0enke
 
JBoss AS / EAP Clustering
JBoss AS / EAP  ClusteringJBoss AS / EAP  Clustering
JBoss AS / EAP Clusteringhwilming
 
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEESchnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEEBenjamin Schmid
 
oVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und EvaluierungsergebnisseoVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und Evaluierungsergebnisseinovex GmbH
 
Cloud-native and Enterprise Java? Hold my beer!
Cloud-native and Enterprise Java? Hold my beer!Cloud-native and Enterprise Java? Hold my beer!
Cloud-native and Enterprise Java? Hold my beer!OPEN KNOWLEDGE GmbH
 
Java magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_vollJava magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_vollWolfgang Weigend
 
Gradle - Beginner's Workshop (german)
Gradle - Beginner's Workshop (german)Gradle - Beginner's Workshop (german)
Gradle - Beginner's Workshop (german)Joachim Baumann
 

Similaire à JSUG - OSGi by Michael Greifeneder (20)

Scala - OSGi Bundles from Outer (Java) Space
Scala - OSGi Bundles from Outer (Java) SpaceScala - OSGi Bundles from Outer (Java) Space
Scala - OSGi Bundles from Outer (Java) Space
 
Java EE Microservices ohne Server
Java EE Microservices ohne ServerJava EE Microservices ohne Server
Java EE Microservices ohne Server
 
Server Revolutions- Der Spring Source DM Server
Server Revolutions- Der Spring Source DM ServerServer Revolutions- Der Spring Source DM Server
Server Revolutions- Der Spring Source DM Server
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-Patterns
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-Patterns
 
Jalimo Slides Linuxtag2007
Jalimo Slides Linuxtag2007Jalimo Slides Linuxtag2007
Jalimo Slides Linuxtag2007
 
ANEO | Automatisierung mit RedHat Ansible
ANEO | Automatisierung mit RedHat AnsibleANEO | Automatisierung mit RedHat Ansible
ANEO | Automatisierung mit RedHat Ansible
 
Ionic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf SteroidenIonic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf Steroiden
 
Let's talk about Java EE
Let's talk about Java EELet's talk about Java EE
Let's talk about Java EE
 
Einführung in Puppet und Vagrant
Einführung in Puppet und VagrantEinführung in Puppet und Vagrant
Einführung in Puppet und Vagrant
 
Node.js
Node.jsNode.js
Node.js
 
OC|Webcast "Java heute" vom 24.08.2021
OC|Webcast "Java heute" vom 24.08.2021OC|Webcast "Java heute" vom 24.08.2021
OC|Webcast "Java heute" vom 24.08.2021
 
JBoss AS / EAP Clustering
JBoss AS / EAP  ClusteringJBoss AS / EAP  Clustering
JBoss AS / EAP Clustering
 
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEESchnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
Schnelle Winkel: 10x schnellere Webapps mit AngularJS und JEE
 
2011 09-09 activiti
2011 09-09 activiti2011 09-09 activiti
2011 09-09 activiti
 
OSGi: Tools und Entwicklungsprozesse in OSGi Projekten
OSGi: Tools und Entwicklungsprozesse in OSGi ProjektenOSGi: Tools und Entwicklungsprozesse in OSGi Projekten
OSGi: Tools und Entwicklungsprozesse in OSGi Projekten
 
oVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und EvaluierungsergebnisseoVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und Evaluierungsergebnisse
 
Cloud-native and Enterprise Java? Hold my beer!
Cloud-native and Enterprise Java? Hold my beer!Cloud-native and Enterprise Java? Hold my beer!
Cloud-native and Enterprise Java? Hold my beer!
 
Java magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_vollJava magazin9 2012_wls 12c_das_dutzend_ist_voll
Java magazin9 2012_wls 12c_das_dutzend_ist_voll
 
Gradle - Beginner's Workshop (german)
Gradle - Beginner's Workshop (german)Gradle - Beginner's Workshop (german)
Gradle - Beginner's Workshop (german)
 

Plus de Christoph Pickl

JSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph PicklJSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph PicklChristoph Pickl
 
JSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir classJSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir classChristoph Pickl
 
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgJSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgChristoph Pickl
 
JSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph PicklJSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph PicklChristoph Pickl
 
JSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert PreiningJSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert PreiningChristoph Pickl
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklChristoph Pickl
 
JSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph PicklJSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph PicklChristoph Pickl
 
JSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin SchuerrerJSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin SchuerrerChristoph Pickl
 
JSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas HubmerJSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas HubmerChristoph Pickl
 
JSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar PetrovJSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar PetrovChristoph Pickl
 
JSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans SowaJSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans SowaChristoph Pickl
 
JSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas PieberJSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas PieberChristoph Pickl
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangChristoph Pickl
 
JSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph PicklJSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph PicklChristoph Pickl
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklChristoph Pickl
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikChristoph Pickl
 
JSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan ZarnikovJSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan ZarnikovChristoph Pickl
 
JSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph PicklJSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph PicklChristoph Pickl
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklChristoph Pickl
 
JSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian MotlikJSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian MotlikChristoph Pickl
 

Plus de Christoph Pickl (20)

JSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph PicklJSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph Pickl
 
JSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir classJSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir class
 
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgJSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
 
JSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph PicklJSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph Pickl
 
JSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert PreiningJSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert Preining
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph Pickl
 
JSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph PicklJSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph Pickl
 
JSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin SchuerrerJSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin Schuerrer
 
JSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas HubmerJSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas Hubmer
 
JSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar PetrovJSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar Petrov
 
JSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans SowaJSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans Sowa
 
JSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas PieberJSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas Pieber
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas Lang
 
JSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph PicklJSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph Pickl
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph Pickl
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian Motlik
 
JSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan ZarnikovJSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan Zarnikov
 
JSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph PicklJSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph Pickl
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph Pickl
 
JSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian MotlikJSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian Motlik
 

JSUG - OSGi by Michael Greifeneder

  • 1. Michael Greifeneder OSGi The Next Generation Java Service Platform SOA - The Java Way or My classpath is killing me Bilder von Peter Kriens “W-JAX Keynote 2007” und Neil Bartletts “Getting Started with OSGi”
  • 2. Inhalt Problem ● OSGi ● SOA ● Tools ●
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Im besten Fall: Aber auch dieses Verhalten möglich:
  • 11.
  • 12. Was fehlt? Application Sinnvoller Name für Jar ● Lib A Lib B Version ● Abhängigkeiten ● Lib C v1 Lib C v2 Verstecken von internen Klassen ● Late Binding, Dynamics ●
  • 13. OSGi Ursprünglich “Open Service Gateway ● Initiative” für Embedded Systems Heute: Dynamic Module System For Java ● Eclipse basiert seit Version 3.0 auf OSGi. ● OSGi Alliance definiert Spezifikation seit ● '99 Mitglieder: Nokia, IBM,... – Aktuelles Release 4.1 – http://www.osgi.org
  • 14. Implementierungen Equinox ● Unterbau für Eclipse, Common Public License – http://www.eclipse.org/equinox/ Apache Felix ● Apache License, http://felix.apache.org – Makewave Knopflerfish ● BSD style license, http://www.knopflerfish.org/ – GUI und Web-Console –
  • 15. Framework L0: Execution Environment ● Profile definieren Minimum: Mobile, J2SE, EE – L1: Modules ● L2: Life Cycle ● S Applications Management E Services (bundles) C U L3: Service Registry ● Life Cycle R I T Module Y Java Execution Env OS + Hardware
  • 16. Modules Modularisierung ● durch Bundles Eigene ● Classloader Schutz von ● Packages Versionierung ●
  • 17. Lifecycle Jedes Bundle ● hat Lifecycle INSTALLED STARTING Bundle Manager ● ist Teil der start Spezifikation RESOLVED ACTIVE stop UNINSTALLED STOPPING
  • 18. Metadaten META-INF/MANIFEST.MF ● Bundle-Name: test.movieservice – Bundle-SymbolicName: test.movieservice Bundle-Version: 1.0.0.SNAPSHOT – Export-Package: test.movieservice – Import-Package: test.dto – BundleActivator: – test.movieservice.BundleActivator
  • 19.
  • 20. Probleme Jars müssen angepasst werden ● Metadaten – Libraries, die eigene Classloader ● verwenden z.B.: Hibernate – Dynamik der Bundles und Services ● schwerer zu handhaben
  • 21. Services - SOA? “SOA ist doch was mit Webservices, ● oder?”
  • 22. SOA mit Webservices und XML http://www.flickr.com/photos/psd/114552560/in/set-72057594085366895/
  • 23. Services - SOA? Webservices bieten Dienste im Netz an ● und greifen über das Netz auf andere Services zurück. XML dient als Lingua Franka zwischen verschiedenen Plattformen Die OSGi Service Platform stellt Services ● innerhalb einer Java VM zur Verfügung
  • 24.
  • 25. Services System Services ● Log Service, Preferences Service, – Configuration Admin Service, User Admin Service, ... Protocol Services ● HTTP Service , UPnP Service, ... – Other ● XML Parser Service, ... –
  • 26. Services Manuelle Registrierung ● class X implements BundleActivator { public void start(BundleContext context) { DbService s = new MyDbService(); context.registerService( DbService.class.getName(), s); } }
  • 27. Services Manuelle Verwendung ● ServiceReference ref = context.getServiceReference( DbService.class.getName()); if (ref != null) { DbService s = context.lookup(ref); if (s != null) { s.callDbService(); } } Flexibel, aber mühsam ●
  • 28. Equinox- Extensions Extensions sind ● Deklarationen ●Lazy Loading ●z.B. Menüpunkte Declarative Services Deklaration in XML ● ●Kein Lazy Loading http://www.eclipsezone.com/articles/extensions-vs-services/images/extensions.png
  • 29. Spring Dynamic Modules for OSGi(tm) Service Platforms Wie Spring Framework unter Apache ● Lizenz Spring konfiguriert Anwendungen und ● kümmert sich um Injektion und Deklaration von Services – Transaktionen – Logging – Datenbankabstraktion – http://www.springframework.org/osgi
  • 30. Spring DM META-INF/spring/*-context.xml ● <osgi:reference id=quot;db4oOsgiServicequot; ● interface=quot;com.db4o.osgi.Db4oServicequot;/> <bean name=quot;MovieServiceDb4oquot; ● class=quot;test.movieservice.db4o.MovieServiceImplquot; init-method=quot;startquot; destroy-method=quot;stopquot;> <property name=quot;db4oServicequot; ref=quot;db4oOsgiServicequot;></property> </bean> <osgi:service id=quot;db4oMovieServicequot; ● ref=quot;MovieServiceDb4oquot; interface=quot;test.movieservice.MovieServicequot;> </osgi:service>
  • 31. Open Participation Software for Java PAX Projekte von OPS4J ● Pax-Construct: ● Maven Plugins zum Erstellen, Builden, – Verwalten und Deployen von OSGI Komponenten. Eclipse-Konfiguration Verwendet Bnd - Bundle Tool – Pax-runner ● Erleichtert das Testen mit mehrere – Implementierungen: Equinox, Felix,... Pax-Logging,... ●
  • 33. SpringSource Application Server Basiert auf OSGI. Verwendet Equinox als ● Unterbau. Alle Komponenten des Spring-Frameworks ● sind bereits OSGI-ready Basiert auf Spring Dynamic Modules ● Erweiterungen für Webentwicklung ● Bietet spezielles Bundle-Repository – Deploymenthilfen (zB War File oder PAR) – Lizensiert unter GPL ●
  • 34. Summary Modularität ● Versionierung ● Dynamik ● Services ● Spring DM – Equinox Extensions – Achtung bei noch nicht OSGi-ready ● Bibliotheken
  • 35. ENDE Danke für die Aufmerksamkeit! ??? Fragen ??? Diskussion
  • 36. Links http://www.osgi.org/Specifications/HomePage ● http://www.aqute.biz/OSGi/Presentations ● http://www.eclipse.org/equinox-portal/getstarted.php ● http://www.eclipsecon.org/ ● http://developers.sun.com/learning/javaoneonline ● http://neilbartlett.name/blog/osgibook/ ● http://www.springframework.org/osgi ● http://www.infoq.com/presentations/colyer-server-side-osgi ● ●