SlideShare a Scribd company logo
Why is OSGi dynamic ?
Christian Campo, compeople AG
EclipseCon Europe 2012,
Overview

               • OSGi is...
               • Lifecycle
               • Services / Extensions
               • Sample
               • Workaround
               • Others




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   2
OSGi is ...

               ... a module system and service platform for
               the Java programming language that implements a
               complete and dynamic component model.

               Applications or components (coming in the form of
               bundles for deployment) can be installed, started,
               stopped, updated, and uninstalled without requiring a
               reboot.

               The service registry allows bundles to detect the
               addition of new services, or the removal of services,
               and adapt accordingly.




                                                                                         *Wikipedia 2012
compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012    |          3
OSGi is ...


                       Bundle                  Service                    Extension



                       started                 started                    installed
                       stopped                 stopped                    uninstalled
                       installed
                       uninstalled




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?      | 12.09.2012   |   4
OSGi Lifecycle ...


                       Bundle

                          Service

                          stopped
                          started


                          Extension

                          uninstalled
                          installed
                       uninstalled
                       stopped
                       started




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   5
OSGi Service Usage ...

                                               Bundle
                                                IService

                                               started

               Bundle                                                          Bundle

                Service                                                        MyComponent



                                                   ?
                stopped
                started                                                        serviceRef



               stopped
               started                                                         started




compeople AG        | EclipseCon Europe 2012        | Why are OSGi dynamic ?        | 12.09.2012   |   6
Extensions




                                                                                                ExtPoint


                                                ?
               Bundle                                                      Bundle

                Extension                                                  MyComponent
                                                                           createExecRef
                uninstalled
                installed


               uninstalled
               stopped
               started                                                     started




compeople AG         | EclipseCon Europe 2012   | Why are OSGi dynamic ?         | 12.09.2012       |      7
Lazy activation

                                               Bundle
                                                IService

                                               started
                                               stopped

               Bundle                                                          Bundle

                Service                                                        MyComponent

                stopped                                                        serviceRef



               stopped                                                         started
                                                                               stopped


                                      Who starts this bundle so the Service can be
                                      accessed ?




compeople AG        | EclipseCon Europe 2012        | Why are OSGi dynamic ?        | 12.09.2012   |   8
Which means ...

               • A service references can become invalid anytime during
               runtime
               • Services are uncoupled from their consumer (no
               dependency)
               • Services need to be started before the lookup
               • Bundles are started lazy by default
                  ›  you cannot rely on a bundle being active




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   9
Sample

                                               Bundle
                                                ISearchService

                                               started

               Bundle                                                          Bundle

                SearchService                                                  MySearch

                started                                                        search



               started                                                         started




compeople AG        | EclipseCon Europe 2012        | Why are OSGi dynamic ?   | 12.09.2012   |   10
Which means ...                                     (API approach)
      MySearch
     ref = context.getServiceReference(ISearchService.class.getName());
     if (ref!=null) {
        ISearchService search = (ISearchService)context.getService(ref);
        if (search!=null) {
           search.findByName("Bill");
           ...
           ...
               // is search still valid here ???
         }
         context.ungetService(ref);
     }




compeople AG         | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   11
Which means ....                              (ServiceTracker)
      MySearch
     ServiceTracker tracker =
                      new ServiceTracker(ctx, ISearchService.class.getName(), null);
      tracker.open();
      ISearchService search = ((ISearchService )tracker.getService());
       if (search!=null) {
           search.findByName("Bill");
           ...
           ...
               // is search still valid here ???
       }




compeople AG         | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   12
Which means ...                      (Declaritive approach)

         <component name= "MySearch">
                <implementation class="org.example.MySearch"/>
         <reference bind="setCustomerSearch"
                        cardinality="1..1"
                        interface="org.eclipse.search.ISearchService"
                        name="Search"
                        policy="dynamic"
                        unbind="unsetCustomerSearch"/>
         </component>



                  Note: The declarative approach requires that DS controls the lifecyle
                  of the target component. (MySearch).
                  If that lifecycle is out of your control, you need an API.
                  Both components should be DS to make sense.




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   13
Which means ...                     (Declaritive approach)

         public class MySearch {
                  public void setCustomerSearch(ISearchService search) {
                     this.search = search;
                 }

                   public Customer[] listCustomer(String name) {
                          return search.findByName(name);
                   }

                   public Customer findCustomer(String number) {
                          return search.findByNumber(number);
                   }

                   public void unsetCustomerSearch(ISearchService search) {
                          this.search = null;
                   }
         }

compeople AG       | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   14
Which means ...                                     (e4 approach)

         public class MySearch {

                   @Inject
                   private ISearchService search;

                   public Customer[] listCustomer(String name) {
                          return search.findByName(name);
                   }

                   public Customer findCustomer(String number) {
                          return search.findByNumber(number);
                   }

         }




compeople AG       | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   15
That things can break ...

               • NPE when accessing service that are injected
                  ›  Service was not started
                  ›  Service was stopped
                  ›  No bundle in the setup implements the Service
               • Service instance exists, but Service-Bundle is stopped
               • Lazy activation does not work once a bundle is stopped
               • At startup no way to check that all dependencies are there.




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   16
Are you ready ... ?

               • Is our code always ready that a reference to a service
               instance is no longer valid ?
               • In your RCP application, do you often stop and start
               bundles ?
               • Do you swap-in a new Service implementation at runtime ?


                               OR do you need that dynamic ?




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   17
Eclipse IDE...

               • A typical usecase for dynamic OSGi is installation of
               bundles in the Eclipse IDE
               • Did you notice that the "Apply changes" option from
               Eclipse 3.7 is gone in 3.8 and 4.2 ?
               • Did it ever work for you ?
               • Test with Eclipse IDE
                  ›  install bundle in 3.7 and in 4.2 (no apply in 4.2)
                  ›  stop a bundle in the console and see how the Eclipse
                     IDE reacts




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   18
stopped egit.ui




compeople AG       | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   19
Not everyone wants/needs dynamic ...

               • Often there is nothing reasonable to do when an injected
               service is not there.
                  ›  SearchDialog without SearchService
                  ›  SearchService without DatabaseConnectorService
                  ›  Car without BrakeService




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   20
Work-arounds

               • Frameworks on top of OSGi implement their own way of
               starting bundles EAGER
               • OSGi based servers want to start everything immediately
               • Applications manually start all necessary bundles and
               service at startup and never stop them




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   21
The advantage ...

               • A missing service is not "normal", don't try to handle it.
               • Detect missing components at startup and fail instantly
               • Services don't appear at some time. They are either there
               or not.
               • A Service cannot disappear while you are using it.




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   22
There are exceptions...

               • Some Services need the dynamic (=flexibility)
                  ›  i.e. change ServiceImplementation if you switch from
                     online to offline
               • So document that decision and add the additional checks




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   23
Which means ...                                     (API approach)


     ref = context.getServiceReference(ICustomerSearch.class.getName());
     if (ref!=null) {
        ICustomerSearch search = (ICustomerSearch)context.getService(ref);
        // if (search!=null) {
          search.findByName("Bill");
          ...
          ...
               // is search is valid here !!!
         // }
         context.ungetService(ref); // ???
     }




compeople AG         | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   24
Which means ...                                   (e4 approach)

         public class MySearch {

                   @Inject
                   private ISearchService search;

                   public Customer[] listCustomer(String name) {
                          return search.findByName(name);
                   }

                   public Customer findCustomer(String number) {
                          return search.findByNumber(number);
                   }

         }




compeople AG       | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   25
Others ...




               OSGi !=                                            !=

                                         no dynamic lifecycle per component




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   26
OSGi

               •  Modules as Bundles                                                     cool

               •  Bundles /w public API & private Impl                                   cool

                                                                                         cool
               •  OSGi Service
               •  Extensions                                                             cool

               •  Lazy Activation                                                        be careful

               •  Start / Stop Services on condition                                     use with care

               •  Ability to stop Bundles at Runtime                                     avoid

               •  Ability to replace Bundles at Runtime                                  avoid




compeople AG        | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012    |           27
Q&A




compeople AG   | EclipseCon Europe 2012   | Why are OSGi dynamic ?   | 12.09.2012   |   28

More Related Content

Viewers also liked

GI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarks
GI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarksGI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarks
GI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarks
IGN Vorstand
 
All your appliances are belong to us
All your appliances are belong to usAll your appliances are belong to us
All your appliances are belong to us
z0mbiehunt3r
 
Chap 1 pfin
Chap 1 pfinChap 1 pfin
Chap 1 pfin
geojan88
 
Gj11e ch02
Gj11e ch02Gj11e ch02
Gj11e ch02
geojan88
 
Indagine sui visitatori del carnevale di putignano 2005
Indagine sui visitatori del carnevale di putignano 2005Indagine sui visitatori del carnevale di putignano 2005
Indagine sui visitatori del carnevale di putignano 2005
Gianclaudio Pinto
 
Kliment oggioni ppt_gi2011_env_europe_remote_final
Kliment oggioni ppt_gi2011_env_europe_remote_finalKliment oggioni ppt_gi2011_env_europe_remote_final
Kliment oggioni ppt_gi2011_env_europe_remote_final
IGN Vorstand
 
Mini lesson plan 1
Mini lesson plan 1Mini lesson plan 1
Mini lesson plan 1dykemaem
 
Patricia talem
Patricia talemPatricia talem
Patricia talemptalem
 
GI2013 ppt decewicz_dresden2013.pdf
GI2013 ppt decewicz_dresden2013.pdfGI2013 ppt decewicz_dresden2013.pdf
GI2013 ppt decewicz_dresden2013.pdf
IGN Vorstand
 
GI2012 hoffmann-oddp
GI2012 hoffmann-oddpGI2012 hoffmann-oddp
GI2012 hoffmann-oddp
IGN Vorstand
 
презентация1лб
презентация1лбпрезентация1лб
презентация1лб
NatalieVolodina
 
Jacob feldman’s chanukah list 2010 final
Jacob feldman’s chanukah list 2010 finalJacob feldman’s chanukah list 2010 final
Jacob feldman’s chanukah list 2010 finalJacob Feldman
 
Open Resources for Research Students and Digital Scholars
Open Resources for Research Students and Digital ScholarsOpen Resources for Research Students and Digital Scholars
Open Resources for Research Students and Digital Scholars
B de los Arcos
 
GI2013 ppt vohnout&team-enviro_grids
GI2013 ppt vohnout&team-enviro_gridsGI2013 ppt vohnout&team-enviro_grids
GI2013 ppt vohnout&team-enviro_grids
IGN Vorstand
 
GI2012 trakas standards ogc
GI2012 trakas standards ogcGI2012 trakas standards ogc
GI2012 trakas standards ogc
IGN Vorstand
 
Animation rig set up
Animation rig set upAnimation rig set up
Animation rig set upharrietmedia
 
GI2011 Lach cost+benefit factors of regio_sdi
GI2011 Lach cost+benefit factors of regio_sdiGI2011 Lach cost+benefit factors of regio_sdi
GI2011 Lach cost+benefit factors of regio_sdi
IGN Vorstand
 
GI2013 ppt hoffmann_review_x-gdi_sustainability
GI2013 ppt hoffmann_review_x-gdi_sustainabilityGI2013 ppt hoffmann_review_x-gdi_sustainability
GI2013 ppt hoffmann_review_x-gdi_sustainability
IGN Vorstand
 

Viewers also liked (20)

Moda verano
Moda veranoModa verano
Moda verano
 
GI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarks
GI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarksGI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarks
GI2013 ppt andreopoulos+kazakis_v2 the+sustainable+future+eco+landmarks
 
All your appliances are belong to us
All your appliances are belong to usAll your appliances are belong to us
All your appliances are belong to us
 
Chap 1 pfin
Chap 1 pfinChap 1 pfin
Chap 1 pfin
 
Gj11e ch02
Gj11e ch02Gj11e ch02
Gj11e ch02
 
Indagine sui visitatori del carnevale di putignano 2005
Indagine sui visitatori del carnevale di putignano 2005Indagine sui visitatori del carnevale di putignano 2005
Indagine sui visitatori del carnevale di putignano 2005
 
Kliment oggioni ppt_gi2011_env_europe_remote_final
Kliment oggioni ppt_gi2011_env_europe_remote_finalKliment oggioni ppt_gi2011_env_europe_remote_final
Kliment oggioni ppt_gi2011_env_europe_remote_final
 
Mini lesson plan 1
Mini lesson plan 1Mini lesson plan 1
Mini lesson plan 1
 
Patricia talem
Patricia talemPatricia talem
Patricia talem
 
GI2013 ppt decewicz_dresden2013.pdf
GI2013 ppt decewicz_dresden2013.pdfGI2013 ppt decewicz_dresden2013.pdf
GI2013 ppt decewicz_dresden2013.pdf
 
GI2012 hoffmann-oddp
GI2012 hoffmann-oddpGI2012 hoffmann-oddp
GI2012 hoffmann-oddp
 
Presentation - Recreating Treasures
Presentation - Recreating TreasuresPresentation - Recreating Treasures
Presentation - Recreating Treasures
 
презентация1лб
презентация1лбпрезентация1лб
презентация1лб
 
Jacob feldman’s chanukah list 2010 final
Jacob feldman’s chanukah list 2010 finalJacob feldman’s chanukah list 2010 final
Jacob feldman’s chanukah list 2010 final
 
Open Resources for Research Students and Digital Scholars
Open Resources for Research Students and Digital ScholarsOpen Resources for Research Students and Digital Scholars
Open Resources for Research Students and Digital Scholars
 
GI2013 ppt vohnout&team-enviro_grids
GI2013 ppt vohnout&team-enviro_gridsGI2013 ppt vohnout&team-enviro_grids
GI2013 ppt vohnout&team-enviro_grids
 
GI2012 trakas standards ogc
GI2012 trakas standards ogcGI2012 trakas standards ogc
GI2012 trakas standards ogc
 
Animation rig set up
Animation rig set upAnimation rig set up
Animation rig set up
 
GI2011 Lach cost+benefit factors of regio_sdi
GI2011 Lach cost+benefit factors of regio_sdiGI2011 Lach cost+benefit factors of regio_sdi
GI2011 Lach cost+benefit factors of regio_sdi
 
GI2013 ppt hoffmann_review_x-gdi_sustainability
GI2013 ppt hoffmann_review_x-gdi_sustainabilityGI2013 ppt hoffmann_review_x-gdi_sustainability
GI2013 ppt hoffmann_review_x-gdi_sustainability
 

Similar to Why is os gi dynamic.pptx

Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
mfrancis
 
The OSGi Framework Multiplication
The OSGi Framework MultiplicationThe OSGi Framework Multiplication
The OSGi Framework Multiplication
Clément Escoffier
 
Eclipse Con2009 Practical Process Orchestration
Eclipse Con2009 Practical Process OrchestrationEclipse Con2009 Practical Process Orchestration
Eclipse Con2009 Practical Process Orchestration
Dietmar Schmidt
 
Osgi Devconeu 2009 Welcome Christer Larsson
Osgi Devconeu 2009 Welcome Christer LarssonOsgi Devconeu 2009 Welcome Christer Larsson
Osgi Devconeu 2009 Welcome Christer Larsson
Christer Larsson
 
Nuxeo World Session: Nuxeo & OSGi
Nuxeo World Session: Nuxeo & OSGiNuxeo World Session: Nuxeo & OSGi
Nuxeo World Session: Nuxeo & OSGi
Nuxeo
 
What is os gi and what does osgi
What is os gi and what does osgiWhat is os gi and what does osgi
What is os gi and what does osgi
YunChang Lee
 
Equinox -The adoption of the OSGi standard in enterprise solutions
Equinox -The adoption of the OSGi standard in enterprise solutions Equinox -The adoption of the OSGi standard in enterprise solutions
Equinox -The adoption of the OSGi standard in enterprise solutions
SpagoWorld
 
OSGi tech session
OSGi tech sessionOSGi tech session
OSGi tech session
Bram de Kruijff
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
njbartlett
 
Best Practices for (Enterprise) OSGi applications - Tim Ward
Best Practices for (Enterprise) OSGi applications - Tim WardBest Practices for (Enterprise) OSGi applications - Tim Ward
Best Practices for (Enterprise) OSGi applications - Tim Ward
mfrancis
 
Bpel And Osgi
Bpel And OsgiBpel And Osgi
Bpel And Osgizoppello
 
Bpel And OSGi
Bpel And OSGi Bpel And OSGi
Bpel And OSGi zoppello
 
Bpel And OSGi
Bpel And OSGi Bpel And OSGi
Bpel And OSGi zoppello
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the Cloud
Bert Ertman
 
BPEL & OSGi at EclipseCon 2010
BPEL & OSGi at EclipseCon 2010BPEL & OSGi at EclipseCon 2010
BPEL & OSGi at EclipseCon 2010
SpagoWorld
 
Liferay Module Framework
Liferay Module FrameworkLiferay Module Framework
Liferay Module Framework
Miguel Pastor
 
Smila ESE 2008
Smila ESE 2008Smila ESE 2008
Smila ESE 2008
novakovic
 
SMILA - The Integration Framework
SMILA - The Integration FrameworkSMILA - The Integration Framework
SMILA - The Integration Frameworknovakovic
 
FraSCAti with OSGi
FraSCAti with OSGiFraSCAti with OSGi
FraSCAti with OSGi
OSGi User Group France
 

Similar to Why is os gi dynamic.pptx (20)

Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
 
The OSGi Framework Multiplication
The OSGi Framework MultiplicationThe OSGi Framework Multiplication
The OSGi Framework Multiplication
 
Eclipse Con2009 Practical Process Orchestration
Eclipse Con2009 Practical Process OrchestrationEclipse Con2009 Practical Process Orchestration
Eclipse Con2009 Practical Process Orchestration
 
Osgi Devconeu 2009 Welcome Christer Larsson
Osgi Devconeu 2009 Welcome Christer LarssonOsgi Devconeu 2009 Welcome Christer Larsson
Osgi Devconeu 2009 Welcome Christer Larsson
 
OSGi Mars World in Action
OSGi Mars World in ActionOSGi Mars World in Action
OSGi Mars World in Action
 
Nuxeo World Session: Nuxeo & OSGi
Nuxeo World Session: Nuxeo & OSGiNuxeo World Session: Nuxeo & OSGi
Nuxeo World Session: Nuxeo & OSGi
 
What is os gi and what does osgi
What is os gi and what does osgiWhat is os gi and what does osgi
What is os gi and what does osgi
 
Equinox -The adoption of the OSGi standard in enterprise solutions
Equinox -The adoption of the OSGi standard in enterprise solutions Equinox -The adoption of the OSGi standard in enterprise solutions
Equinox -The adoption of the OSGi standard in enterprise solutions
 
OSGi tech session
OSGi tech sessionOSGi tech session
OSGi tech session
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
 
Best Practices for (Enterprise) OSGi applications - Tim Ward
Best Practices for (Enterprise) OSGi applications - Tim WardBest Practices for (Enterprise) OSGi applications - Tim Ward
Best Practices for (Enterprise) OSGi applications - Tim Ward
 
Bpel And Osgi
Bpel And OsgiBpel And Osgi
Bpel And Osgi
 
Bpel And OSGi
Bpel And OSGi Bpel And OSGi
Bpel And OSGi
 
Bpel And OSGi
Bpel And OSGi Bpel And OSGi
Bpel And OSGi
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the Cloud
 
BPEL & OSGi at EclipseCon 2010
BPEL & OSGi at EclipseCon 2010BPEL & OSGi at EclipseCon 2010
BPEL & OSGi at EclipseCon 2010
 
Liferay Module Framework
Liferay Module FrameworkLiferay Module Framework
Liferay Module Framework
 
Smila ESE 2008
Smila ESE 2008Smila ESE 2008
Smila ESE 2008
 
SMILA - The Integration Framework
SMILA - The Integration FrameworkSMILA - The Integration Framework
SMILA - The Integration Framework
 
FraSCAti with OSGi
FraSCAti with OSGiFraSCAti with OSGi
FraSCAti with OSGi
 

More from christiancampo

What makes an application a good Application (Eclipse Finance Day 2012 Zürich)
What makes an application a good Application (Eclipse Finance Day 2012 Zürich)What makes an application a good Application (Eclipse Finance Day 2012 Zürich)
What makes an application a good Application (Eclipse Finance Day 2012 Zürich)
christiancampo
 
Riena onrap econ-2011
Riena onrap econ-2011Riena onrap econ-2011
Riena onrap econ-2011
christiancampo
 

More from christiancampo (7)

What makes an application a good Application (Eclipse Finance Day 2012 Zürich)
What makes an application a good Application (Eclipse Finance Day 2012 Zürich)What makes an application a good Application (Eclipse Finance Day 2012 Zürich)
What makes an application a good Application (Eclipse Finance Day 2012 Zürich)
 
Riena onrap econ-2011
Riena onrap econ-2011Riena onrap econ-2011
Riena onrap econ-2011
 
Swt qt econ-2010
Swt qt econ-2010Swt qt econ-2010
Swt qt econ-2010
 
Swt qt ese-2009
Swt qt ese-2009Swt qt ese-2009
Swt qt ese-2009
 
Riena on-e4-ese2010
Riena on-e4-ese2010Riena on-e4-ese2010
Riena on-e4-ese2010
 
Riena on-rap-ese2010
Riena on-rap-ese2010Riena on-rap-ese2010
Riena on-rap-ese2010
 
Swt qt ese2010
Swt qt ese2010Swt qt ese2010
Swt qt ese2010
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

Why is os gi dynamic.pptx

  • 1. Why is OSGi dynamic ? Christian Campo, compeople AG EclipseCon Europe 2012,
  • 2. Overview • OSGi is... • Lifecycle • Services / Extensions • Sample • Workaround • Others compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 2
  • 3. OSGi is ... ... a module system and service platform for the Java programming language that implements a complete and dynamic component model. Applications or components (coming in the form of bundles for deployment) can be installed, started, stopped, updated, and uninstalled without requiring a reboot. The service registry allows bundles to detect the addition of new services, or the removal of services, and adapt accordingly. *Wikipedia 2012 compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 3
  • 4. OSGi is ... Bundle Service Extension started started installed stopped stopped uninstalled installed uninstalled compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 4
  • 5. OSGi Lifecycle ... Bundle Service stopped started Extension uninstalled installed uninstalled stopped started compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 5
  • 6. OSGi Service Usage ... Bundle IService started Bundle Bundle Service MyComponent ? stopped started serviceRef stopped started started compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 6
  • 7. Extensions ExtPoint ? Bundle Bundle Extension MyComponent createExecRef uninstalled installed uninstalled stopped started started compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 7
  • 8. Lazy activation Bundle IService started stopped Bundle Bundle Service MyComponent stopped serviceRef stopped started stopped Who starts this bundle so the Service can be accessed ? compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 8
  • 9. Which means ... • A service references can become invalid anytime during runtime • Services are uncoupled from their consumer (no dependency) • Services need to be started before the lookup • Bundles are started lazy by default ›  you cannot rely on a bundle being active compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 9
  • 10. Sample Bundle ISearchService started Bundle Bundle SearchService MySearch started search started started compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 10
  • 11. Which means ... (API approach) MySearch ref = context.getServiceReference(ISearchService.class.getName()); if (ref!=null) { ISearchService search = (ISearchService)context.getService(ref); if (search!=null) { search.findByName("Bill"); ... ... // is search still valid here ??? } context.ungetService(ref); } compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 11
  • 12. Which means .... (ServiceTracker) MySearch ServiceTracker tracker = new ServiceTracker(ctx, ISearchService.class.getName(), null); tracker.open(); ISearchService search = ((ISearchService )tracker.getService()); if (search!=null) { search.findByName("Bill"); ... ... // is search still valid here ??? } compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 12
  • 13. Which means ... (Declaritive approach) <component name= "MySearch"> <implementation class="org.example.MySearch"/> <reference bind="setCustomerSearch" cardinality="1..1" interface="org.eclipse.search.ISearchService" name="Search" policy="dynamic" unbind="unsetCustomerSearch"/> </component> Note: The declarative approach requires that DS controls the lifecyle of the target component. (MySearch). If that lifecycle is out of your control, you need an API. Both components should be DS to make sense. compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 13
  • 14. Which means ... (Declaritive approach) public class MySearch { public void setCustomerSearch(ISearchService search) { this.search = search; } public Customer[] listCustomer(String name) { return search.findByName(name); } public Customer findCustomer(String number) { return search.findByNumber(number); } public void unsetCustomerSearch(ISearchService search) { this.search = null; } } compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 14
  • 15. Which means ... (e4 approach) public class MySearch { @Inject private ISearchService search; public Customer[] listCustomer(String name) { return search.findByName(name); } public Customer findCustomer(String number) { return search.findByNumber(number); } } compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 15
  • 16. That things can break ... • NPE when accessing service that are injected ›  Service was not started ›  Service was stopped ›  No bundle in the setup implements the Service • Service instance exists, but Service-Bundle is stopped • Lazy activation does not work once a bundle is stopped • At startup no way to check that all dependencies are there. compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 16
  • 17. Are you ready ... ? • Is our code always ready that a reference to a service instance is no longer valid ? • In your RCP application, do you often stop and start bundles ? • Do you swap-in a new Service implementation at runtime ? OR do you need that dynamic ? compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 17
  • 18. Eclipse IDE... • A typical usecase for dynamic OSGi is installation of bundles in the Eclipse IDE • Did you notice that the "Apply changes" option from Eclipse 3.7 is gone in 3.8 and 4.2 ? • Did it ever work for you ? • Test with Eclipse IDE ›  install bundle in 3.7 and in 4.2 (no apply in 4.2) ›  stop a bundle in the console and see how the Eclipse IDE reacts compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 18
  • 19. stopped egit.ui compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 19
  • 20. Not everyone wants/needs dynamic ... • Often there is nothing reasonable to do when an injected service is not there. ›  SearchDialog without SearchService ›  SearchService without DatabaseConnectorService ›  Car without BrakeService compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 20
  • 21. Work-arounds • Frameworks on top of OSGi implement their own way of starting bundles EAGER • OSGi based servers want to start everything immediately • Applications manually start all necessary bundles and service at startup and never stop them compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 21
  • 22. The advantage ... • A missing service is not "normal", don't try to handle it. • Detect missing components at startup and fail instantly • Services don't appear at some time. They are either there or not. • A Service cannot disappear while you are using it. compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 22
  • 23. There are exceptions... • Some Services need the dynamic (=flexibility) ›  i.e. change ServiceImplementation if you switch from online to offline • So document that decision and add the additional checks compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 23
  • 24. Which means ... (API approach) ref = context.getServiceReference(ICustomerSearch.class.getName()); if (ref!=null) { ICustomerSearch search = (ICustomerSearch)context.getService(ref); // if (search!=null) { search.findByName("Bill"); ... ... // is search is valid here !!! // } context.ungetService(ref); // ??? } compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 24
  • 25. Which means ... (e4 approach) public class MySearch { @Inject private ISearchService search; public Customer[] listCustomer(String name) { return search.findByName(name); } public Customer findCustomer(String number) { return search.findByNumber(number); } } compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 25
  • 26. Others ... OSGi != != no dynamic lifecycle per component compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 26
  • 27. OSGi •  Modules as Bundles cool •  Bundles /w public API & private Impl cool cool •  OSGi Service •  Extensions cool •  Lazy Activation be careful •  Start / Stop Services on condition use with care •  Ability to stop Bundles at Runtime avoid •  Ability to replace Bundles at Runtime avoid compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 27
  • 28. Q&A compeople AG | EclipseCon Europe 2012 | Why are OSGi dynamic ? | 12.09.2012 | 28