SlideShare una empresa de Scribd logo
1 de 63
Descargar para leer sin conexión
OSGi Blueprint Services




                     Blueprint Services

                          DI brought to OSGi


                             Guillaume Nodet
OSGi Blueprint Services



                                       Author
          • Guillaume Nodet
          • ASF Member, VP Apache ServiceMix,
            PMC member of various Apache
            projects (ServiceMix, Felix, Geronimo,
            Mina …)
          • Software Architect at Progress Software
          • OSGi Enterprise Expert Group



OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   1
OSGi Blueprint Services



                                     Agenda
          •    Introduction
          •    Configuration
          •    Beans
          •    Service references
          •    Service registrations
          •    Advanced uses
          •    Next steps
          •    Conclusion

OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   2
OSGi Blueprint Services



                             Introduction
          •    Dependency injection / IOC
          •    Handle legacy code
          •    Handle the OSGi dynamics
          •    Hide the OSGi API




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   3
OSGi Blueprint Services



                                   Configuration
          • Extender pattern
          • XML resources
          • Metadata


                Blueprint Bundle                                     Metadata
                                               XML




                                              Blueprint Extender




OSGi DevCon, June 22, 2009         Copyright Guillaume Nodet, Licensed under ASL 2.0   4
OSGi Blueprint Services



                       Blueprint XML definition

             blueprint ::= <type-converters> manager *
             manager ::= <bean> | <service> | service-reference
             service-reference ::= <reference> | <ref-list>
             type-converter ::= <bean> | <ref>




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   5
OSGi Blueprint Services



                             Simple example

          <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”>
              <service interface=“osgi.devcon.User”>
                  <bean class=“osgi.devcon.impl.UserImpl”>
                       <argument value=“gnodet” />
                  </bean>
              </service>
          </blueprint>




          bundleContext.registerService(
              osgi.devcon.User.class.getName(),
              new osgi.devcon.impl.UserImpl(“gnodet”),
              new Hashtable());



OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   6
OSGi Blueprint Services



                             Simple example

          <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”>
              <service interface=“osgi.devcon.User”>
                  <bean class=“osgi.devcon.impl.UserImpl”>
                       <argument value=“gnodet” />
                  </bean>
              </service>
          </blueprint>              Top level element



          bundleContext.registerService(
              osgi.devcon.User.class.getName(),
              new osgi.devcon.impl.UserImpl(“gnodet”),
              new Hashtable());



OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   7
OSGi Blueprint Services



                             Simple example

          <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”>
              <service interface=“osgi.devcon.User”>
                  <bean class=“osgi.devcon.impl.UserImpl”>
                       <argument value=“gnodet” />
                  </bean>
              </service>
          </blueprint>      Blueprint namespace



          bundleContext.registerService(
              osgi.devcon.User.class.getName(),
              new osgi.devcon.impl.UserImpl(“gnodet”),
              new Hashtable());



OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   8
OSGi Blueprint Services



                             Simple example

          <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”>
              <service interface=“osgi.devcon.User”>
                  <bean class=“osgi.devcon.impl.UserImpl”>
                       <argument value=“gnodet” />
                  </bean>
              </service>
          </blueprint>                          Manager definition



          bundleContext.registerService(
              osgi.devcon.User.class.getName(),
              new osgi.devcon.impl.UserImpl(“gnodet”),
              new Hashtable());



OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   9
OSGi Blueprint Services



                             Manager types
          • Bean
          • Single Service
            Reference
          • Multiple Service
            References
          • Service
            Registration



OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   10
OSGi Blueprint Services



                                Managers
          •    Described by some metadata
          •    Provide objects
          •    Activation / deactivation
          •    Dependencies (implicit or explicit)
          •    Initialization
                 – Eager
                 – Lazy
          • Id
          • Inlined managers
OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   11
OSGi Blueprint Services



                               Bean manager




                      <bean class=“osgi.devcon.impl.UserImpl”>
                          <argument value=”gnodet” />
                          <property name=“arrival” value=“22/06/09” />
                      </bean>




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   12
OSGi Blueprint Services



                                    Bean creation
          • Constructor creation
                             <bean class=“osgi.devcon.impl.UserImpl” />



                             new osgi.devcon.impl.UserImpl()



          • Constructor creation with arguments
                             <bean class=“osgi.devcon.impl.UserImpl”>
                                 <argument value=“gnodet” />
                             </bean>


                             new osgi.devcon.impl.UserImpl(“gnodet”)



OSGi DevCon, June 22, 2009            Copyright Guillaume Nodet, Licensed under ASL 2.0   13
OSGi Blueprint Services



                                    Bean creation
          • Static factory
                             <bean class=“osgi.devcon.impl.UserFactory”
                                   factory-method=“createUser”>
                                 <argument value=“gnodet” />
                             </bean>


                             osgi.devcon.impl.UserFactory
                                     .createUser( “gnodet”)




OSGi DevCon, June 22, 2009            Copyright Guillaume Nodet, Licensed under ASL 2.0   14
OSGi Blueprint Services



                                Bean creation
          • Instance factory
                      <bean factory-ref=“userFactory”
                            factory-method=“createUser”>
                          <argument value=“gnodet” />
                      </bean>


                      osgi.devcon.impl.UserFactory userFactory = …
                      userFactory.createUser( “gnodet”)




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   15
OSGi Blueprint Services



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

                      <argument>
                          [any value]
                      </argument>




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   16
OSGi Blueprint Services



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

                      <argument>
                          [any value]
                      </argument>                                                     Plain value




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0                 17
OSGi Blueprint Services



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

                      <argument>
                          [any value]
                      </argument>
                                                                            Reference to a top
                                                                             level manager




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0              18
OSGi Blueprint Services



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

                      <argument>
                          [any value]
                      </argument>
                                                                                Complex value




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0             19
OSGi Blueprint Services



                              Bean properties

                       <bean class=“osgi.devcon.impl.UserImpl”>
                           <property name=“userId” value=“gnodet” />
                       </bean>


                       UserImpl user = new osgi.devcon.impl.UserImpl();
                       user.setUserId(“gnodet”);




OSGi DevCon, June 22, 2009         Copyright Guillaume Nodet, Licensed under ASL 2.0   20
OSGi Blueprint Services



                              Bean properties

                       <bean class=“osgi.devcon.impl.UserImpl”>
                           <property name=“userId” value=“gnodet” />
                       </bean>


                       UserImpl user = new osgi.devcon.impl.UserImpl();
                       user.setUserId(“gnodet”);




                                                                                       Property name




OSGi DevCon, June 22, 2009         Copyright Guillaume Nodet, Licensed under ASL 2.0                   21
OSGi Blueprint Services



                              Bean properties

                       <bean class=“osgi.devcon.impl.UserImpl”>
                           <property name=“userId” value=“gnodet” />
                       </bean>


                       UserImpl user = new osgi.devcon.impl.UserImpl();
                       user.setUserId(“gnodet”);




                               Property value


OSGi DevCon, June 22, 2009         Copyright Guillaume Nodet, Licensed under ASL 2.0   22
OSGi Blueprint Services



                              Bean properties


                      <property name=“userId” value=“gnodet”/>

                      <property name=“userId” ref=“[refid]”/>

                      <property name=“userId”>
                          [any value]
                      </property>




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   23
OSGi Blueprint Services



                             Bean scope

          • Singleton
                 – a single instance will be reused
          • Prototype
                 – a new instance will be created each time it
                   is injected




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   24
OSGi Blueprint Services



                                       Values
          •    <null/>                                  •    <value>
          •    <bean>                                   •    <list>
          •    <reference>                              •    <set>
          •    <ref-list>                               •    <map>
          •    <service>                                •    <array>
          •    <ref>                                    •    <props>
          •    <idref>




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   25
OSGi Blueprint Services


                                      <ref />
          • Injects an object provided by the
            manager with the given id
                      <bean id=“regId” … />

                      <bean class=“osgi.devcon.impl.UserImpl”>
                          <property name=“registration”>
                              <ref component-id=“regId” />
                          </property>
                      </bean>



                      <bean class=“osgi.devcon.impl.UserImpl”>
                          <property name=“registration” ref=“regId” />
                      </bean>



OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   26
OSGi Blueprint Services


                                      <ref />
          • Injects an object provided by the
            manager with the given id
                                                                                      Property value
                      <bean id=“regId” … />

                      <bean class=“osgi.devcon.impl.UserImpl”>
                          <property name=“registration”>
                              <ref component-id=“regId” />
                          </property>
                      </bean>



                      <bean class=“osgi.devcon.impl.UserImpl”>
                          <property name=“registration” ref=“regId” />
                      </bean>



OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0                    27
OSGi Blueprint Services


                                  <idref />
          • Injects the id of an existing object


                      <bean id=“regId” … />

                      <bean class=“osgi.devcon.impl.UserImpl”>
                          <property name=“registrationId”>
                              <idref component-id=“regId” />
                          </property>
                      </bean>




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   28
OSGi Blueprint Services


                                     <value>
          • Insert the content of the element text

                    <bean class=“osgi.devcon.impl.UserImpl”>
                        <property name=“userId”>
                            <value>gnodet</value>
                        </property>
                    </bean>




                    <bean class=“osgi.devcon.impl.UserImpl”>
                        <property name=“userId” value=“gnodet” />
                    </bean>




OSGi DevCon, June 22, 2009       Copyright Guillaume Nodet, Licensed under ASL 2.0   29
OSGi Blueprint Services



          <list>, <set> and <array>
          • Inserts a collection of objects

             <list>
                 <list>
                     <value>2</value>
                     <value>7</value>                        Arrays.asList(
                 </list>                                         Arrays.asList(“2”,”7”),
                 <list value-type=“int”>                         Arrays.asList(9,5)
                     <value>9</value>                        )
                     <value>5</value>
                 </list>
             </list>




OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0            30
OSGi Blueprint Services



          <list>, <set> and <array>
          • Inserts a collection of objects

             <list>
                 <list>
                     <value>2</value>
                     <value>7</value>                        Arrays.asList(
                 </list>                                         Arrays.asList(“2”,”7”),
                 <list value-type=“int”>                         Arrays.asList(9,5)
                     <value>9</value>                        )
                     <value>5</value>
                 </list>
             </list>



                                                                Type of the values

OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0            31
OSGi Blueprint Services


                                        <map>
          • Inserts a map of objects
             <map>
                 <entry key="cheese" value="cheddar"/>
                 <entry key="fruit" value="orange"/>
             </map>


             <map>
                 <entry key-ref="keyId" value="cheddar"/>
                 <entry key="fruit" value-ref="valueId"/>
             </map>


             <map key-type=”...” value-type="... ">
                 <entry ...>
             </map>



OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   32
OSGi Blueprint Services


                                        <map>
          • Inserts a map of objects
             <map>
                 <entry>
                     <key>
                          <value type="org.osgi.framework.Version">
                               3.2.1
                          </value>
                     </key>
                     <bean ... />
                 </entry>
             </map>




OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   33
OSGi Blueprint Services


                                  <props>
          • Inserts a java.util.Properties object

             <props>
                 <prop key="1">one</prop>
                 <prop key="2" value="two" />
             </props>




OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   34
OSGi Blueprint Services



                         Components as values
          • Instances provided by managers can be
            injected



                             <list>
                                 <bean class="com.acme.FooImpl"/>
                             </list>




OSGi DevCon, June 22, 2009           Copyright Guillaume Nodet, Licensed under ASL 2.0   35
OSGi Blueprint Services



                             Service References
          • Single service: <reference>
          • Multiple services: <ref-list>

                 <reference id="user1"
                            interface="osgi.devcon.User"
                            filter="(name=gnodet)" />




                 <ref-list id=”all-users"
                           interface="osgi.devcon.User” />




OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   36
OSGi Blueprint Services


                                         <reference>
          •    Provides a proxy to an OSGi service
          •    Availability: mandatory or optional
          •    Timeout
          •    Damping

                                                      proxy

                                                                 backing
                                                                 service




                             injected beans                                   services            service providers




OSGi DevCon, June 22, 2009                    Copyright Guillaume Nodet, Licensed under ASL 2.0                       37
OSGi Blueprint Services


                                       <ref-list>
          • Provides a read-only and dynamic list of
            OSGi service
          • Availability: mandatory or optional



                                                                      backing
                                                                      service


                                       list



                      injected beans                      proxies                 services   service providers




OSGi DevCon, June 22, 2009             Copyright Guillaume Nodet, Licensed under ASL 2.0                         38
OSGi Blueprint Services



            Service References Listeners
                 <bean id="listener" ... />

                 <ref-list interface="osgi.devcon.User">
                     <reference-listener ref="listener"
                                         bind-method="bind"
                                         unbind-method="unbind" />
                 </ref-list>



                 public class Listener {
                     public void bind(User user) { }
                     public void unbind(User user) { }
                 }


                 public void (T)
                 public void (T, Map)
                 public void (ServiceReference)


OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   39
OSGi Blueprint Services



            Service References Listeners
                 <bean id="listener" ... />

                 <ref-list interface="osgi.devcon.User">
                     <reference-listener ref="listener"
                                         bind-method="bind"
                                         unbind-method="unbind" />
                 </ref-list>

                                                                                    Bind method
                 public class Listener {
                     public void bind(User user) { }
                     public void unbind(User user) { }
                 }


                 public void (T)
                 public void (T, Map)
                 public void (ServiceReference)


OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0                 40
OSGi Blueprint Services



                             Service registrations
          • Expose an object as an OSGi service
          • Register a ServiceFactory
          • Dependencies on service references

                 <service ref="user"
                          interface="osgi.devcon.User" />




                 <service auto-export="interfaces">
                     <bean class="osgi.devcon.impl.UserImpl” />
                 </service>



OSGi DevCon, June 22, 2009       Copyright Guillaume Nodet, Licensed under ASL 2.0   41
OSGi Blueprint Services



                             Service properties
          • Expose an object as an OSGi service


                 <service ref="fooImpl" interface="osgi.devcon.User">
                     <service-properties>
                         <entry key="name" value="gnodet"/>
                     </service-properties>
                 </service>




OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   42
OSGi Blueprint Services



           Service Registration Listeners
                 <bean id="listener" ... />

                 <service ref="..." interface="osgi.devcon.User">
                     <registration-listener
                         ref="listener"
                         registration-method="register"
                         unregistration-method="unregister" />
                 </ref-list>


                 public class Listener {
                     public void register(User user, Map props) { }
                     public void unregister(User user, Map props) { }
                 }



                 public void (T, Map)



OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   43
OSGi Blueprint Services



                                   Lifecycle




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   44
OSGi Blueprint Services



                                   Lifecycle
                                                                                 Support for lazy
                                                                                   activattion




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0                      45
OSGi Blueprint Services



                                   Lifecycle
                                                                                 Track mandatory
                                                                                    references




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0                     46
OSGi Blueprint Services



                                   Lifecycle




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   47
OSGi Blueprint Services



                             Advanced use
          • Conversions
          • Disambiguation
          • Creating custom converters
          • Use of <idref>
          • <ref-list> can be injected as
               List<ServiceReference>
          • Use of the ranking attribute on
               <service>
          • Blueprint Events

OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   48
OSGi Blueprint Services



                             Conversions
          •    Arrays, collections, maps
          •    Primitives / wrapped primitives
          •    Simple types with a String constructor
          •    Locale, Pattern, Properties, Class
          •    JDK 5 Generics
          •    Custom converters



OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   49
OSGi Blueprint Services



                             Disambiguation
          • Constructors / factory methods can
            have multiple overloads
                 public class Bar {
                     public Bar(File file) { ... }
                     public Bar(URI uri) { ... }
                 }


                 <bean class="foo.Bar">
                     <argument type="java.net.URI"
                               value="file://hello.txt"/>
                 </bean>




OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   50
OSGi Blueprint Services



                             Custom converters
    <type-converters>
        <bean id="converter1" class=”foo.DateTypeConverter">
            <property name="format" value="yyyy.MM.dd"/>
        </bean>
    </type-converters>

    <bean class=“...”>
        <property name=“date” value=“2009.06.22” />
    </bean>


    public class DateTypeConverter {
        public boolean canConvert(Object fromValue,
                                  CollapsedType toType) {
            ...
        }
        public Object convert(Object fromValue,
                              CollapsedType toType) throws Exception {
            ...
        }
    }

OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   51
OSGi Blueprint Services

                                  <ref-list> as
                             List<ServiceReference>



    <ref-list interface=“osgi.devcon.User”
              member-type=“service-reference” />




OSGi DevCon, June 22, 2009        Copyright Guillaume Nodet, Licensed under ASL 2.0   52
OSGi Blueprint Services



                             Other advanced uses
          • <ref-list> as
            List<ServiceReference>
              <ref-list interface=“osgi.devcon.User”
                        member-type=“service-reference” />



          • Use of ranking attribute on
            <service>
              <service ref=“foo”
                       interface=“osgi.devcon.User”
                       ranking=“5” />



OSGi DevCon, June 22, 2009       Copyright Guillaume Nodet, Licensed under ASL 2.0   53
OSGi Blueprint Services



                             Use of <idref>
          • Prototypes
          • Use of the Blueprint API
    <bean id=“bar” class=“foo.Bar” scope=“prototype”>
        <property name=“prop” value=“val” />
    </bean>

    <bean class=“foo.BarCreator”>
        <property name=“blueprintContainer” ref=“blueprintContainer” />
        <property name=“id”>
            <idref component-id=“bar” />
        </property>
    </bean>



    Bar bar = (Bar) blueprintContainer.getComponent(id)


OSGi DevCon, June 22, 2009    Copyright Guillaume Nodet, Licensed under ASL 2.0   54
OSGi Blueprint Services



                             Blueprint events
          • Register listeners
          • Blueprint events
                 –    CREATING
                 –    CREATED
                 –    DESTROYING
                 –    DESTROYED
                 –    FAILURE
                 –    GRACE_PERIOD
                 –    WAITING


    public interface BlueprintListener {
        void blueprintEvent(BlueprintEvent event);
    }




OSGi DevCon, June 22, 2009       Copyright Guillaume Nodet, Licensed under ASL 2.0   55
OSGi Blueprint Services



                               Next steps
          • Custom namespace handlers
          • Config Admin support




OSGi DevCon, June 22, 2009   Copyright Guillaume Nodet, Licensed under ASL 2.0   56
OSGi Blueprint Services



                             Custom namespaces
              <ext:property-placeholder system-properties=“override”>
                 <ext:default-properties>
                     <ext:property name=“name” value=“value” />
                 </ext:default-properties>
              </ext:property>

              <bean ...>
                 <property name=“prop” value=“${name}” />
              </bean>

              <reference interface=“foo.Bar”
                         ext:proxy-method=“classes” />




OSGi DevCon, June 22, 2009      Copyright Guillaume Nodet, Licensed under ASL 2.0   57
OSGi Blueprint Services



                             Config Admin
          • Injection of values from a Configuration



              <cm:property-placeholder persistent-id=“foo.bar” />
                 <cm:default-properties>
                     <cm:property name=“name” value=“value” />
                 </cm:default-properties>
              </cm:property>

              <bean ...>
                 <property name=“prop” value=“${name}” />
              </bean>




OSGi DevCon, June 22, 2009     Copyright Guillaume Nodet, Licensed under ASL 2.0   58
OSGi Blueprint Services



                             Config Admin
          • Support for managed properties




              <bean class=“foo.Bar”>
                 <cm:managed-properties
                      persistent-id=“foo.bar”
                     updated-strategy=“component-managed”
                      update-method=“update” />
              </bean>




OSGi DevCon, June 22, 2009     Copyright Guillaume Nodet, Licensed under ASL 2.0   59
OSGi Blueprint Services



                             Config Admin
          • Support for managed service factories


              <cm:managed-service-factory
                      factory-pid=“foo.bar”
                      interface=“foo.Bar”>
                 <service-properties>
                    <entry key=“key1” value=“value1” />
                 </service-properties>
                 <cm:managed-component class=“foo.BarImpl” />
              </bean>




OSGi DevCon, June 22, 2009     Copyright Guillaume Nodet, Licensed under ASL 2.0   60
OSGi Blueprint Services



                             Implementations
          • Spring-DM (RI)
                 – Based on the Spring Framework
                 – > 2 Mo but provide more features
          • Geronimo blueprint
                 – Clean implementation of Blueprint
                 – Size < 300 Ko
                 – Integrated in Apache Felix Karaf



OSGi DevCon, June 22, 2009     Copyright Guillaume Nodet, Licensed under ASL 2.0   61
OSGi Blueprint Services



                                  Conclusion
          • Existing alternatives
                 – DS, iPojo, Peaberry
          • Strengths of blueprint
                 – Familiarity with Spring
                 – More powerful Dependency Injection
                 – Easily extensible through namespaces


                              gnodet@gmail.com
                 http://svn.apache.org/repos/asf/geronimo/sandbox/blueprint

OSGi DevCon, June 22, 2009       Copyright Guillaume Nodet, Licensed under ASL 2.0   62

Más contenido relacionado

La actualidad más candente

AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - ServicesNir Kaufman
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questionsGoa App
 
Spring Security
Spring SecuritySpring Security
Spring SecurityBoy Tech
 
Using Postman to Test OAuth/OIDC
Using Postman to Test OAuth/OIDCUsing Postman to Test OAuth/OIDC
Using Postman to Test OAuth/OIDCPostman
 
OAuth2 - Introduction
OAuth2 - IntroductionOAuth2 - Introduction
OAuth2 - IntroductionKnoldus Inc.
 
7 rules of simple and maintainable code
7 rules of simple and maintainable code7 rules of simple and maintainable code
7 rules of simple and maintainable codeGeshan Manandhar
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScriptAhmed El-Kady
 
Introduction to OpenID Connect
Introduction to OpenID Connect Introduction to OpenID Connect
Introduction to OpenID Connect Nat Sakimura
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events WebStackAcademy
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in GolangBo-Yi Wu
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSunghyouk Bae
 
Implementing OAuth
Implementing OAuthImplementing OAuth
Implementing OAuthleahculver
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with KeycloakJulien Pivotto
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineChun-Yu Wang
 
Design Patterns in XCUITest
Design Patterns in XCUITestDesign Patterns in XCUITest
Design Patterns in XCUITestVivian Liu
 
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang) [Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang) Johnny Sung
 
次世代 KYC に関する検討状況 - OpenID BizDay #15
次世代 KYC に関する検討状況 - OpenID BizDay #15次世代 KYC に関する検討状況 - OpenID BizDay #15
次世代 KYC に関する検討状況 - OpenID BizDay #15OpenID Foundation Japan
 

La actualidad más candente (20)

AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Using Postman to Test OAuth/OIDC
Using Postman to Test OAuth/OIDCUsing Postman to Test OAuth/OIDC
Using Postman to Test OAuth/OIDC
 
OAuth2 - Introduction
OAuth2 - IntroductionOAuth2 - Introduction
OAuth2 - Introduction
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
7 rules of simple and maintainable code
7 rules of simple and maintainable code7 rules of simple and maintainable code
7 rules of simple and maintainable code
 
Angular 4 and TypeScript
Angular 4 and TypeScriptAngular 4 and TypeScript
Angular 4 and TypeScript
 
Introduction to OpenID Connect
Introduction to OpenID Connect Introduction to OpenID Connect
Introduction to OpenID Connect
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
SpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSLSpringBoot with MyBatis, Flyway, QueryDSL
SpringBoot with MyBatis, Flyway, QueryDSL
 
Implementing OAuth
Implementing OAuthImplementing OAuth
Implementing OAuth
 
SIngle Sign On with Keycloak
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with Keycloak
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Design Patterns in XCUITest
Design Patterns in XCUITestDesign Patterns in XCUITest
Design Patterns in XCUITest
 
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang) [Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
 
次世代 KYC に関する検討状況 - OpenID BizDay #15
次世代 KYC に関する検討状況 - OpenID BizDay #15次世代 KYC に関する検討状況 - OpenID BizDay #15
次世代 KYC に関する検討状況 - OpenID BizDay #15
 

Destacado

Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A GrzesikApache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesikmfrancis
 
SCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitSCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitMike Pfaff
 
The ultimate dependency manager shoot out - X Uiterlinden & S Mak
The ultimate dependency manager shoot out - X Uiterlinden & S MakThe ultimate dependency manager shoot out - X Uiterlinden & S Mak
The ultimate dependency manager shoot out - X Uiterlinden & S Makmfrancis
 
ORDER INDEPENDENT INCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNER
ORDER INDEPENDENTINCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNERORDER INDEPENDENTINCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNER
ORDER INDEPENDENT INCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNERNurfadhlina Mohd Sharef
 
P2 Introduction
P2 IntroductionP2 Introduction
P2 Introductionirbull
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegelermfrancis
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application DevelopmentChristian Baranowski
 
Many Worlds, the Born Rule, and Self-Locating Uncertainty
Many Worlds, the Born Rule, and Self-Locating UncertaintyMany Worlds, the Born Rule, and Self-Locating Uncertainty
Many Worlds, the Born Rule, and Self-Locating UncertaintySean Carroll
 
7 bran Simonova Necronomiconu
7 bran Simonova Necronomiconu7 bran Simonova Necronomiconu
7 bran Simonova NecronomiconuBloxxterMagick
 
Krystalická hrůza H. P. Lovecrafta ve filmu
Krystalická hrůza H. P. Lovecrafta ve filmuKrystalická hrůza H. P. Lovecrafta ve filmu
Krystalická hrůza H. P. Lovecrafta ve filmuBloxxterMagick
 
Setting Time Aright
Setting Time ArightSetting Time Aright
Setting Time ArightSean Carroll
 
Microservices and OSGi: Better together?
Microservices and OSGi: Better together?Microservices and OSGi: Better together?
Microservices and OSGi: Better together?Graham Charters
 
Self adaptive based natural language interface for disambiguation of
Self adaptive based natural language interface for disambiguation ofSelf adaptive based natural language interface for disambiguation of
Self adaptive based natural language interface for disambiguation ofNurfadhlina Mohd Sharef
 
Magické myšlení aneb jak magie ovlivňuje náš život
Magické myšlení aneb jak magie ovlivňuje náš životMagické myšlení aneb jak magie ovlivňuje náš život
Magické myšlení aneb jak magie ovlivňuje náš životBloxxterMagick
 
Tajemná krajina severovýchodních Čech
Tajemná krajina severovýchodních ČechTajemná krajina severovýchodních Čech
Tajemná krajina severovýchodních ČechBloxxterMagick
 
Moved to https://slidr.io/azzazzel/osgi-for-outsiders
Moved to https://slidr.io/azzazzel/osgi-for-outsidersMoved to https://slidr.io/azzazzel/osgi-for-outsiders
Moved to https://slidr.io/azzazzel/osgi-for-outsidersMilen Dyankov
 

Destacado (20)

Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A GrzesikApache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
 
Teorema menelaya teorema_chevy
Teorema menelaya teorema_chevyTeorema menelaya teorema_chevy
Teorema menelaya teorema_chevy
 
SCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitSCR Annotations for Fun and Profit
SCR Annotations for Fun and Profit
 
Incremental Evolving Grammar Fragments
Incremental Evolving Grammar FragmentsIncremental Evolving Grammar Fragments
Incremental Evolving Grammar Fragments
 
The ultimate dependency manager shoot out - X Uiterlinden & S Mak
The ultimate dependency manager shoot out - X Uiterlinden & S MakThe ultimate dependency manager shoot out - X Uiterlinden & S Mak
The ultimate dependency manager shoot out - X Uiterlinden & S Mak
 
semantic web & natural language
semantic web & natural languagesemantic web & natural language
semantic web & natural language
 
ORDER INDEPENDENT INCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNER
ORDER INDEPENDENTINCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNERORDER INDEPENDENTINCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNER
ORDER INDEPENDENT INCREMENTAL EVOLVING FUZZY GRAMMAR FRAGMENT LEARNER
 
Incremental Evolving Grammar Fragments
Incremental Evolving Grammar FragmentsIncremental Evolving Grammar Fragments
Incremental Evolving Grammar Fragments
 
P2 Introduction
P2 IntroductionP2 Introduction
P2 Introduction
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application Development
 
Many Worlds, the Born Rule, and Self-Locating Uncertainty
Many Worlds, the Born Rule, and Self-Locating UncertaintyMany Worlds, the Born Rule, and Self-Locating Uncertainty
Many Worlds, the Born Rule, and Self-Locating Uncertainty
 
7 bran Simonova Necronomiconu
7 bran Simonova Necronomiconu7 bran Simonova Necronomiconu
7 bran Simonova Necronomiconu
 
Krystalická hrůza H. P. Lovecrafta ve filmu
Krystalická hrůza H. P. Lovecrafta ve filmuKrystalická hrůza H. P. Lovecrafta ve filmu
Krystalická hrůza H. P. Lovecrafta ve filmu
 
Setting Time Aright
Setting Time ArightSetting Time Aright
Setting Time Aright
 
Microservices and OSGi: Better together?
Microservices and OSGi: Better together?Microservices and OSGi: Better together?
Microservices and OSGi: Better together?
 
Self adaptive based natural language interface for disambiguation of
Self adaptive based natural language interface for disambiguation ofSelf adaptive based natural language interface for disambiguation of
Self adaptive based natural language interface for disambiguation of
 
Magické myšlení aneb jak magie ovlivňuje náš život
Magické myšlení aneb jak magie ovlivňuje náš životMagické myšlení aneb jak magie ovlivňuje náš život
Magické myšlení aneb jak magie ovlivňuje náš život
 
Tajemná krajina severovýchodních Čech
Tajemná krajina severovýchodních ČechTajemná krajina severovýchodních Čech
Tajemná krajina severovýchodních Čech
 
Moved to https://slidr.io/azzazzel/osgi-for-outsiders
Moved to https://slidr.io/azzazzel/osgi-for-outsidersMoved to https://slidr.io/azzazzel/osgi-for-outsiders
Moved to https://slidr.io/azzazzel/osgi-for-outsiders
 

Similar a OSGi Blueprint Services

OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Reviewnjbartlett
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.jsmattpardee
 
CDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily JiangCDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily Jiangmfrancis
 
OSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim VerbelenOSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim Verbelenmfrancis
 
Javascript, the GNOME way (JSConf EU 2011)
Javascript, the GNOME way (JSConf EU 2011)Javascript, the GNOME way (JSConf EU 2011)
Javascript, the GNOME way (JSConf EU 2011)Igalia
 
Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGiMarek Koniew
 
Saint2012 mod process security
Saint2012 mod process securitySaint2012 mod process security
Saint2012 mod process securityRyosuke MATSUMOTO
 
GR8Conf 2009: Groovy Usage Patterns by Dierk König
GR8Conf 2009: Groovy Usage Patterns by Dierk KönigGR8Conf 2009: Groovy Usage Patterns by Dierk König
GR8Conf 2009: Groovy Usage Patterns by Dierk KönigGR8Conf
 
Weld-OSGi, injecting easiness in OSGi
Weld-OSGi, injecting easiness in OSGiWeld-OSGi, injecting easiness in OSGi
Weld-OSGi, injecting easiness in OSGiMathieu Ancelin
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...mfrancis
 
Aws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, ImplementationAws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, Implementationserkancapkan
 
Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGiCarsten Ziegeler
 
OSGi-based Workflow Engine
OSGi-based Workflow EngineOSGi-based Workflow Engine
OSGi-based Workflow Engineyocaba
 
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application DevelopmentOSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application DevelopmentSanjeeb Sahoo
 
GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day DNG Consulting
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2JooinK
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OpenBlend society
 
Micro Services in JavaScript - Simon Kaegi
Micro Services in JavaScript - Simon KaegiMicro Services in JavaScript - Simon Kaegi
Micro Services in JavaScript - Simon Kaegimfrancis
 

Similar a OSGi Blueprint Services (20)

OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.js
 
Hybrid Applications
Hybrid ApplicationsHybrid Applications
Hybrid Applications
 
CDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily JiangCDI Integration in OSGi - Emily Jiang
CDI Integration in OSGi - Emily Jiang
 
OSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim VerbelenOSGi for IoT: the good, the bad and the ugly - Tim Verbelen
OSGi for IoT: the good, the bad and the ugly - Tim Verbelen
 
Javascript, the GNOME way (JSConf EU 2011)
Javascript, the GNOME way (JSConf EU 2011)Javascript, the GNOME way (JSConf EU 2011)
Javascript, the GNOME way (JSConf EU 2011)
 
Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGi
 
Saint2012 mod process security
Saint2012 mod process securitySaint2012 mod process security
Saint2012 mod process security
 
GR8Conf 2009: Groovy Usage Patterns by Dierk König
GR8Conf 2009: Groovy Usage Patterns by Dierk KönigGR8Conf 2009: Groovy Usage Patterns by Dierk König
GR8Conf 2009: Groovy Usage Patterns by Dierk König
 
Weld-OSGi, injecting easiness in OSGi
Weld-OSGi, injecting easiness in OSGiWeld-OSGi, injecting easiness in OSGi
Weld-OSGi, injecting easiness in OSGi
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
Aws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, ImplementationAws Deployment Tools - Overview, Details, Implementation
Aws Deployment Tools - Overview, Details, Implementation
 
Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGi
 
OSGi-based Workflow Engine
OSGi-based Workflow EngineOSGi-based Workflow Engine
OSGi-based Workflow Engine
 
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application DevelopmentOSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
OSGi and Java EE: A Hybrid Approach to Enterprise Java Application Development
 
GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day
 
JavaScript on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the Desktop
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
 
Micro Services in JavaScript - Simon Kaegi
Micro Services in JavaScript - Simon KaegiMicro Services in JavaScript - Simon Kaegi
Micro Services in JavaScript - Simon Kaegi
 

Último

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Último (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

OSGi Blueprint Services

  • 1. OSGi Blueprint Services Blueprint Services DI brought to OSGi Guillaume Nodet
  • 2. OSGi Blueprint Services Author • Guillaume Nodet • ASF Member, VP Apache ServiceMix, PMC member of various Apache projects (ServiceMix, Felix, Geronimo, Mina …) • Software Architect at Progress Software • OSGi Enterprise Expert Group OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 1
  • 3. OSGi Blueprint Services Agenda • Introduction • Configuration • Beans • Service references • Service registrations • Advanced uses • Next steps • Conclusion OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 2
  • 4. OSGi Blueprint Services Introduction • Dependency injection / IOC • Handle legacy code • Handle the OSGi dynamics • Hide the OSGi API OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 3
  • 5. OSGi Blueprint Services Configuration • Extender pattern • XML resources • Metadata Blueprint Bundle Metadata XML Blueprint Extender OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 4
  • 6. OSGi Blueprint Services Blueprint XML definition blueprint ::= <type-converters> manager * manager ::= <bean> | <service> | service-reference service-reference ::= <reference> | <ref-list> type-converter ::= <bean> | <ref> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 5
  • 7. OSGi Blueprint Services Simple example <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”> <service interface=“osgi.devcon.User”> <bean class=“osgi.devcon.impl.UserImpl”> <argument value=“gnodet” /> </bean> </service> </blueprint> bundleContext.registerService( osgi.devcon.User.class.getName(), new osgi.devcon.impl.UserImpl(“gnodet”), new Hashtable()); OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 6
  • 8. OSGi Blueprint Services Simple example <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”> <service interface=“osgi.devcon.User”> <bean class=“osgi.devcon.impl.UserImpl”> <argument value=“gnodet” /> </bean> </service> </blueprint> Top level element bundleContext.registerService( osgi.devcon.User.class.getName(), new osgi.devcon.impl.UserImpl(“gnodet”), new Hashtable()); OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 7
  • 9. OSGi Blueprint Services Simple example <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”> <service interface=“osgi.devcon.User”> <bean class=“osgi.devcon.impl.UserImpl”> <argument value=“gnodet” /> </bean> </service> </blueprint> Blueprint namespace bundleContext.registerService( osgi.devcon.User.class.getName(), new osgi.devcon.impl.UserImpl(“gnodet”), new Hashtable()); OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 8
  • 10. OSGi Blueprint Services Simple example <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0”> <service interface=“osgi.devcon.User”> <bean class=“osgi.devcon.impl.UserImpl”> <argument value=“gnodet” /> </bean> </service> </blueprint> Manager definition bundleContext.registerService( osgi.devcon.User.class.getName(), new osgi.devcon.impl.UserImpl(“gnodet”), new Hashtable()); OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 9
  • 11. OSGi Blueprint Services Manager types • Bean • Single Service Reference • Multiple Service References • Service Registration OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 10
  • 12. OSGi Blueprint Services Managers • Described by some metadata • Provide objects • Activation / deactivation • Dependencies (implicit or explicit) • Initialization – Eager – Lazy • Id • Inlined managers OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 11
  • 13. OSGi Blueprint Services Bean manager <bean class=“osgi.devcon.impl.UserImpl”> <argument value=”gnodet” /> <property name=“arrival” value=“22/06/09” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 12
  • 14. OSGi Blueprint Services Bean creation • Constructor creation <bean class=“osgi.devcon.impl.UserImpl” /> new osgi.devcon.impl.UserImpl() • Constructor creation with arguments <bean class=“osgi.devcon.impl.UserImpl”> <argument value=“gnodet” /> </bean> new osgi.devcon.impl.UserImpl(“gnodet”) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 13
  • 15. OSGi Blueprint Services Bean creation • Static factory <bean class=“osgi.devcon.impl.UserFactory” factory-method=“createUser”> <argument value=“gnodet” /> </bean> osgi.devcon.impl.UserFactory .createUser( “gnodet”) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 14
  • 16. OSGi Blueprint Services Bean creation • Instance factory <bean factory-ref=“userFactory” factory-method=“createUser”> <argument value=“gnodet” /> </bean> osgi.devcon.impl.UserFactory userFactory = … userFactory.createUser( “gnodet”) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 15
  • 17. OSGi Blueprint Services Bean arguments <argument value=“gnodet”/> <argument ref=“[refid]”/> <argument> [any value] </argument> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 16
  • 18. OSGi Blueprint Services Bean arguments <argument value=“gnodet”/> <argument ref=“[refid]”/> <argument> [any value] </argument> Plain value OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 17
  • 19. OSGi Blueprint Services Bean arguments <argument value=“gnodet”/> <argument ref=“[refid]”/> <argument> [any value] </argument> Reference to a top level manager OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 18
  • 20. OSGi Blueprint Services Bean arguments <argument value=“gnodet”/> <argument ref=“[refid]”/> <argument> [any value] </argument> Complex value OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 19
  • 21. OSGi Blueprint Services Bean properties <bean class=“osgi.devcon.impl.UserImpl”> <property name=“userId” value=“gnodet” /> </bean> UserImpl user = new osgi.devcon.impl.UserImpl(); user.setUserId(“gnodet”); OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 20
  • 22. OSGi Blueprint Services Bean properties <bean class=“osgi.devcon.impl.UserImpl”> <property name=“userId” value=“gnodet” /> </bean> UserImpl user = new osgi.devcon.impl.UserImpl(); user.setUserId(“gnodet”); Property name OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 21
  • 23. OSGi Blueprint Services Bean properties <bean class=“osgi.devcon.impl.UserImpl”> <property name=“userId” value=“gnodet” /> </bean> UserImpl user = new osgi.devcon.impl.UserImpl(); user.setUserId(“gnodet”); Property value OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 22
  • 24. OSGi Blueprint Services Bean properties <property name=“userId” value=“gnodet”/> <property name=“userId” ref=“[refid]”/> <property name=“userId”> [any value] </property> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 23
  • 25. OSGi Blueprint Services Bean scope • Singleton – a single instance will be reused • Prototype – a new instance will be created each time it is injected OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 24
  • 26. OSGi Blueprint Services Values • <null/> • <value> • <bean> • <list> • <reference> • <set> • <ref-list> • <map> • <service> • <array> • <ref> • <props> • <idref> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 25
  • 27. OSGi Blueprint Services <ref /> • Injects an object provided by the manager with the given id <bean id=“regId” … /> <bean class=“osgi.devcon.impl.UserImpl”> <property name=“registration”> <ref component-id=“regId” /> </property> </bean> <bean class=“osgi.devcon.impl.UserImpl”> <property name=“registration” ref=“regId” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 26
  • 28. OSGi Blueprint Services <ref /> • Injects an object provided by the manager with the given id Property value <bean id=“regId” … /> <bean class=“osgi.devcon.impl.UserImpl”> <property name=“registration”> <ref component-id=“regId” /> </property> </bean> <bean class=“osgi.devcon.impl.UserImpl”> <property name=“registration” ref=“regId” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 27
  • 29. OSGi Blueprint Services <idref /> • Injects the id of an existing object <bean id=“regId” … /> <bean class=“osgi.devcon.impl.UserImpl”> <property name=“registrationId”> <idref component-id=“regId” /> </property> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 28
  • 30. OSGi Blueprint Services <value> • Insert the content of the element text <bean class=“osgi.devcon.impl.UserImpl”> <property name=“userId”> <value>gnodet</value> </property> </bean> <bean class=“osgi.devcon.impl.UserImpl”> <property name=“userId” value=“gnodet” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 29
  • 31. OSGi Blueprint Services <list>, <set> and <array> • Inserts a collection of objects <list> <list> <value>2</value> <value>7</value> Arrays.asList( </list> Arrays.asList(“2”,”7”), <list value-type=“int”> Arrays.asList(9,5) <value>9</value> ) <value>5</value> </list> </list> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 30
  • 32. OSGi Blueprint Services <list>, <set> and <array> • Inserts a collection of objects <list> <list> <value>2</value> <value>7</value> Arrays.asList( </list> Arrays.asList(“2”,”7”), <list value-type=“int”> Arrays.asList(9,5) <value>9</value> ) <value>5</value> </list> </list> Type of the values OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 31
  • 33. OSGi Blueprint Services <map> • Inserts a map of objects <map> <entry key="cheese" value="cheddar"/> <entry key="fruit" value="orange"/> </map> <map> <entry key-ref="keyId" value="cheddar"/> <entry key="fruit" value-ref="valueId"/> </map> <map key-type=”...” value-type="... "> <entry ...> </map> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 32
  • 34. OSGi Blueprint Services <map> • Inserts a map of objects <map> <entry> <key> <value type="org.osgi.framework.Version"> 3.2.1 </value> </key> <bean ... /> </entry> </map> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 33
  • 35. OSGi Blueprint Services <props> • Inserts a java.util.Properties object <props> <prop key="1">one</prop> <prop key="2" value="two" /> </props> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 34
  • 36. OSGi Blueprint Services Components as values • Instances provided by managers can be injected <list> <bean class="com.acme.FooImpl"/> </list> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 35
  • 37. OSGi Blueprint Services Service References • Single service: <reference> • Multiple services: <ref-list> <reference id="user1" interface="osgi.devcon.User" filter="(name=gnodet)" /> <ref-list id=”all-users" interface="osgi.devcon.User” /> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 36
  • 38. OSGi Blueprint Services <reference> • Provides a proxy to an OSGi service • Availability: mandatory or optional • Timeout • Damping proxy backing service injected beans services service providers OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 37
  • 39. OSGi Blueprint Services <ref-list> • Provides a read-only and dynamic list of OSGi service • Availability: mandatory or optional backing service list injected beans proxies services service providers OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 38
  • 40. OSGi Blueprint Services Service References Listeners <bean id="listener" ... /> <ref-list interface="osgi.devcon.User"> <reference-listener ref="listener" bind-method="bind" unbind-method="unbind" /> </ref-list> public class Listener { public void bind(User user) { } public void unbind(User user) { } } public void (T) public void (T, Map) public void (ServiceReference) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 39
  • 41. OSGi Blueprint Services Service References Listeners <bean id="listener" ... /> <ref-list interface="osgi.devcon.User"> <reference-listener ref="listener" bind-method="bind" unbind-method="unbind" /> </ref-list> Bind method public class Listener { public void bind(User user) { } public void unbind(User user) { } } public void (T) public void (T, Map) public void (ServiceReference) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 40
  • 42. OSGi Blueprint Services Service registrations • Expose an object as an OSGi service • Register a ServiceFactory • Dependencies on service references <service ref="user" interface="osgi.devcon.User" /> <service auto-export="interfaces"> <bean class="osgi.devcon.impl.UserImpl” /> </service> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 41
  • 43. OSGi Blueprint Services Service properties • Expose an object as an OSGi service <service ref="fooImpl" interface="osgi.devcon.User"> <service-properties> <entry key="name" value="gnodet"/> </service-properties> </service> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 42
  • 44. OSGi Blueprint Services Service Registration Listeners <bean id="listener" ... /> <service ref="..." interface="osgi.devcon.User"> <registration-listener ref="listener" registration-method="register" unregistration-method="unregister" /> </ref-list> public class Listener { public void register(User user, Map props) { } public void unregister(User user, Map props) { } } public void (T, Map) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 43
  • 45. OSGi Blueprint Services Lifecycle OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 44
  • 46. OSGi Blueprint Services Lifecycle Support for lazy activattion OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 45
  • 47. OSGi Blueprint Services Lifecycle Track mandatory references OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 46
  • 48. OSGi Blueprint Services Lifecycle OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 47
  • 49. OSGi Blueprint Services Advanced use • Conversions • Disambiguation • Creating custom converters • Use of <idref> • <ref-list> can be injected as List<ServiceReference> • Use of the ranking attribute on <service> • Blueprint Events OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 48
  • 50. OSGi Blueprint Services Conversions • Arrays, collections, maps • Primitives / wrapped primitives • Simple types with a String constructor • Locale, Pattern, Properties, Class • JDK 5 Generics • Custom converters OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 49
  • 51. OSGi Blueprint Services Disambiguation • Constructors / factory methods can have multiple overloads public class Bar { public Bar(File file) { ... } public Bar(URI uri) { ... } } <bean class="foo.Bar"> <argument type="java.net.URI" value="file://hello.txt"/> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 50
  • 52. OSGi Blueprint Services Custom converters <type-converters> <bean id="converter1" class=”foo.DateTypeConverter"> <property name="format" value="yyyy.MM.dd"/> </bean> </type-converters> <bean class=“...”> <property name=“date” value=“2009.06.22” /> </bean> public class DateTypeConverter { public boolean canConvert(Object fromValue, CollapsedType toType) { ... } public Object convert(Object fromValue, CollapsedType toType) throws Exception { ... } } OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 51
  • 53. OSGi Blueprint Services <ref-list> as List<ServiceReference> <ref-list interface=“osgi.devcon.User” member-type=“service-reference” /> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 52
  • 54. OSGi Blueprint Services Other advanced uses • <ref-list> as List<ServiceReference> <ref-list interface=“osgi.devcon.User” member-type=“service-reference” /> • Use of ranking attribute on <service> <service ref=“foo” interface=“osgi.devcon.User” ranking=“5” /> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 53
  • 55. OSGi Blueprint Services Use of <idref> • Prototypes • Use of the Blueprint API <bean id=“bar” class=“foo.Bar” scope=“prototype”> <property name=“prop” value=“val” /> </bean> <bean class=“foo.BarCreator”> <property name=“blueprintContainer” ref=“blueprintContainer” /> <property name=“id”> <idref component-id=“bar” /> </property> </bean> Bar bar = (Bar) blueprintContainer.getComponent(id) OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 54
  • 56. OSGi Blueprint Services Blueprint events • Register listeners • Blueprint events – CREATING – CREATED – DESTROYING – DESTROYED – FAILURE – GRACE_PERIOD – WAITING public interface BlueprintListener { void blueprintEvent(BlueprintEvent event); } OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 55
  • 57. OSGi Blueprint Services Next steps • Custom namespace handlers • Config Admin support OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 56
  • 58. OSGi Blueprint Services Custom namespaces <ext:property-placeholder system-properties=“override”> <ext:default-properties> <ext:property name=“name” value=“value” /> </ext:default-properties> </ext:property> <bean ...> <property name=“prop” value=“${name}” /> </bean> <reference interface=“foo.Bar” ext:proxy-method=“classes” /> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 57
  • 59. OSGi Blueprint Services Config Admin • Injection of values from a Configuration <cm:property-placeholder persistent-id=“foo.bar” /> <cm:default-properties> <cm:property name=“name” value=“value” /> </cm:default-properties> </cm:property> <bean ...> <property name=“prop” value=“${name}” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 58
  • 60. OSGi Blueprint Services Config Admin • Support for managed properties <bean class=“foo.Bar”> <cm:managed-properties persistent-id=“foo.bar” updated-strategy=“component-managed” update-method=“update” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 59
  • 61. OSGi Blueprint Services Config Admin • Support for managed service factories <cm:managed-service-factory factory-pid=“foo.bar” interface=“foo.Bar”> <service-properties> <entry key=“key1” value=“value1” /> </service-properties> <cm:managed-component class=“foo.BarImpl” /> </bean> OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 60
  • 62. OSGi Blueprint Services Implementations • Spring-DM (RI) – Based on the Spring Framework – > 2 Mo but provide more features • Geronimo blueprint – Clean implementation of Blueprint – Size < 300 Ko – Integrated in Apache Felix Karaf OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 61
  • 63. OSGi Blueprint Services Conclusion • Existing alternatives – DS, iPojo, Peaberry • Strengths of blueprint – Familiarity with Spring – More powerful Dependency Injection – Easily extensible through namespaces gnodet@gmail.com http://svn.apache.org/repos/asf/geronimo/sandbox/blueprint OSGi DevCon, June 22, 2009 Copyright Guillaume Nodet, Licensed under ASL 2.0 62