SlideShare ist ein Scribd-Unternehmen logo
1 von 63
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法
FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法
FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法Kentaro Sano
 
#ljstudy KVM勉強会
#ljstudy KVM勉強会#ljstudy KVM勉強会
#ljstudy KVM勉強会Etsuji Nakai
 
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...Henning Jacobs
 
Altinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouseAltinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouseAltinity Ltd
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법Open Source Consulting
 
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016Zabbix
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...Akihiro Suda
 
AEM - Binary less replication
AEM - Binary less replicationAEM - Binary less replication
AEM - Binary less replicationAshokkumar T A
 
BHyVeってなんや
BHyVeってなんやBHyVeってなんや
BHyVeってなんやTakuya ASADA
 
BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법
BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법
BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법철민 신
 
AWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターン
AWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターンAWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターン
AWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターンAmazon Web Services Japan
 
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018Amazon Web Services Korea
 
Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드Ji-Woong Choi
 
Redis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Labs
 
Minio Cloud Storage
Minio Cloud StorageMinio Cloud Storage
Minio Cloud StorageMinio
 
AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-
AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-
AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-Yosuke Takada
 
Inside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryInside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryEDB
 
MySQLとPostgreSQLにおける基本的なアカウント管理
MySQLとPostgreSQLにおける基本的なアカウント管理MySQLとPostgreSQLにおける基本的なアカウント管理
MySQLとPostgreSQLにおける基本的なアカウント管理Shinya Sugiyama
 

Was ist angesagt? (20)

FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法
FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法
FPGAによる津波シミュレーション -- GPUを超える高性能計算の手法
 
#ljstudy KVM勉強会
#ljstudy KVM勉強会#ljstudy KVM勉強会
#ljstudy KVM勉強会
 
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
 
SSH力をつけよう
SSH力をつけようSSH力をつけよう
SSH力をつけよう
 
Altinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouseAltinity Quickstart for ClickHouse
Altinity Quickstart for ClickHouse
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
 
AEM - Binary less replication
AEM - Binary less replicationAEM - Binary less replication
AEM - Binary less replication
 
BHyVeってなんや
BHyVeってなんやBHyVeってなんや
BHyVeってなんや
 
BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법
BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법
BPMN과 JIRA를 활용한 프로세스 중심 업무 혁신 실천법
 
AWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターン
AWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターンAWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターン
AWS Black Belt Online Seminar 2017 IoT向け最新アーキテクチャパターン
 
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
 
Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드
 
Redis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Reliability, Performance & Innovation
Redis Reliability, Performance & Innovation
 
Minio Cloud Storage
Minio Cloud StorageMinio Cloud Storage
Minio Cloud Storage
 
AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-
AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-
AWS上でのルート最適化サービス-Lambda&S3&大容量データによる試練-
 
Inside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryInside PostgreSQL Shared Memory
Inside PostgreSQL Shared Memory
 
MySQLとPostgreSQLにおける基本的なアカウント管理
MySQLとPostgreSQLにおける基本的なアカウント管理MySQLとPostgreSQLにおける基本的なアカウント管理
MySQLとPostgreSQLにおける基本的なアカウント管理
 
PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
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
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 

Kürzlich hochgeladen (20)

Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
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)
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 

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