SlideShare a Scribd company logo
1 of 63
Download to read offline
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

More Related Content

What's hot

Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDBAlex Sharp
 
[131]chromium binging 기술을 node.js에 적용해보자
[131]chromium binging 기술을 node.js에 적용해보자[131]chromium binging 기술을 node.js에 적용해보자
[131]chromium binging 기술을 node.js에 적용해보자NAVER D2
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django ArchitectureRami Sayar
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS ArchitectureEyal Vardi
 
【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat
【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat
【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMatYasuhiro Yoshimura
 
我的 Windows 平台自動化經驗:基礎批次檔撰寫實務
我的 Windows 平台自動化經驗:基礎批次檔撰寫實務我的 Windows 平台自動化經驗:基礎批次檔撰寫實務
我的 Windows 平台自動化經驗:基礎批次檔撰寫實務Will Huang
 
Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020
Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020
Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020Johnny Sung
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep DiveMartijn Dashorst
 
入門ClojureScript
入門ClojureScript入門ClojureScript
入門ClojureScriptsohta
 
JavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaJavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaChris Bailey
 
JVM code reading -- C2
JVM code reading -- C2JVM code reading -- C2
JVM code reading -- C2ytoshima
 
[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...
[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...
[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...CODE BLUE
 
Bypassing anti virus using powershell
Bypassing anti virus using powershellBypassing anti virus using powershell
Bypassing anti virus using powershellabend_cve_9999_0001
 
いまどき(これから)のPHP開発
いまどき(これから)のPHP開発いまどき(これから)のPHP開発
いまどき(これから)のPHP開発Kenjiro Kubota
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
[D2 오픈세미나]1.무한스크롤성능개선
[D2 오픈세미나]1.무한스크롤성능개선[D2 오픈세미나]1.무한스크롤성능개선
[D2 오픈세미나]1.무한스크롤성능개선NAVER D2
 

What's hot (20)

Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
 
Why rust?
Why rust?Why rust?
Why rust?
 
[131]chromium binging 기술을 node.js에 적용해보자
[131]chromium binging 기술을 node.js에 적용해보자[131]chromium binging 기술을 node.js에 적용해보자
[131]chromium binging 기술을 node.js에 적용해보자
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django Architecture
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat
【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat
【関東GPGPU勉強会#2】OpenCVのOpenCL実装oclMat
 
我的 Windows 平台自動化經驗:基礎批次檔撰寫實務
我的 Windows 平台自動化經驗:基礎批次檔撰寫實務我的 Windows 平台自動化經驗:基礎批次檔撰寫實務
我的 Windows 平台自動化經驗:基礎批次檔撰寫實務
 
Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020
Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020
Flutter 是什麼?用 Flutter 會省到時間嗎? @ GDG Devfest2020
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep Dive
 
入門ClojureScript
入門ClojureScript入門ClojureScript
入門ClojureScript
 
JavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaJavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient Java
 
JVM code reading -- C2
JVM code reading -- C2JVM code reading -- C2
JVM code reading -- C2
 
[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...
[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...
[CB16] Cyber Grand Challenge (CGC) : 世界初のマシン同士の全自動ハッキングトーナメント by Tyler Nighsw...
 
Ansible
AnsibleAnsible
Ansible
 
Bypassing anti virus using powershell
Bypassing anti virus using powershellBypassing anti virus using powershell
Bypassing anti virus using powershell
 
いまどき(これから)のPHP開発
いまどき(これから)のPHP開発いまどき(これから)のPHP開発
いまどき(これから)のPHP開発
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
[D2 오픈세미나]1.무한스크롤성능개선
[D2 오픈세미나]1.무한스크롤성능개선[D2 오픈세미나]1.무한스크롤성능개선
[D2 오픈세미나]1.무한스크롤성능개선
 
10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING10. funtions and closures IN SWIFT PROGRAMMING
10. funtions and closures IN SWIFT PROGRAMMING
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 

Viewers also liked

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
 

Viewers also liked (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 to 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 to 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
 

Recently uploaded

Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 

Recently uploaded (20)

Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 

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