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




                     Blueprint Services

                          DI brought to OSGi


                             Guillaume Nodet
OSGi Blueprint Services



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



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



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

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



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




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



                                   Configuration
          • Extender pattern
          • XML resources
          • Metadata


                Blueprint Bundle                                     Metadata
                                               XML




                                              Blueprint Extender




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



                       Blueprint XML definition

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




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



                             Simple example

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




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



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



                             Simple example

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



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



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



                             Simple example

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



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



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



                             Simple example

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



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



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



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



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



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



                               Bean manager




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




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



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



                             new osgi.devcon.impl.UserImpl()



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


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



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



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


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




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



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


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




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

                      <argument>
                          [any value]
                      </argument>




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

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




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

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




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

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




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



                              Bean properties

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


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




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



                              Bean properties

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


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




                                                                                       Property name




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



                              Bean properties

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


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




                               Property value


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



                              Bean properties


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

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

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




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



                             Bean scope

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




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



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




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


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

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



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



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


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

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



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



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


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


                      <bean id=“regId” … />

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




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


                                     <value>
          • Insert the content of the element text

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




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




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



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

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




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



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

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



                                                                Type of the values

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


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


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


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



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


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




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


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

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




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



                         Components as values
          • Instances provided by managers can be
            injected



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




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



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

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




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




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


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

                                                      proxy

                                                                 backing
                                                                 service




                             injected beans                                   services            service providers




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


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



                                                                      backing
                                                                      service


                                       list



                      injected beans                      proxies                 services   service providers




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



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

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



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


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


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



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

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

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


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


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



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

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




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



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



                             Service properties
          • Expose an object as an OSGi service


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




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



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

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


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



                 public void (T, Map)



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



                                   Lifecycle




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



                                   Lifecycle
                                                                                 Support for lazy
                                                                                   activattion




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



                                   Lifecycle
                                                                                 Track mandatory
                                                                                    references




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



                                   Lifecycle




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



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

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



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



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



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


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




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



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

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


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

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

                                  <ref-list> as
                             List<ServiceReference>



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




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



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



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



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



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

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



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


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



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


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




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



                               Next steps
          • Custom namespace handlers
          • Config Admin support




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



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

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

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




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



                             Config Admin
          • Injection of values from a Configuration



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

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




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



                             Config Admin
          • Support for managed properties




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




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



                             Config Admin
          • Support for managed service factories


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




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



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



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



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


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

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

Más contenido relacionado

La actualidad más candente

오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향Nalee Jang
 
Adobe AEM - From Eventing to Job Processing
Adobe AEM - From Eventing to Job ProcessingAdobe AEM - From Eventing to Job Processing
Adobe AEM - From Eventing to Job ProcessingCarsten Ziegeler
 
20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기Doyoon Kim
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with TerraformAll Things Open
 
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APIMario Fusco
 
Authentification et autorisation d'accès avec AWS IAM
Authentification et autorisation d'accès avec AWS IAMAuthentification et autorisation d'accès avec AWS IAM
Authentification et autorisation d'accès avec AWS IAMJulien SIMON
 
Java null survival guide
Java null survival guideJava null survival guide
Java null survival guideSungchul Park
 
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...Citus Data
 
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기NAVER D2
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...Yevgeniy Brikman
 
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021AWSKRUG - AWS한국사용자모임
 
(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWSAmazon Web Services
 
Gatekeeper: API gateway
Gatekeeper: API gatewayGatekeeper: API gateway
Gatekeeper: API gatewayChengHui Weng
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellThomas Pierrain
 
gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!Alex Borysov
 
Notions de base de JavaScript
Notions de base de JavaScriptNotions de base de JavaScript
Notions de base de JavaScriptKristen Le Liboux
 
DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개
DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개
DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개태준 문
 
Sequence and Traverse - Part 1
Sequence and Traverse - Part 1Sequence and Traverse - Part 1
Sequence and Traverse - Part 1Philip Schwarz
 

La actualidad más candente (20)

오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향오픈스택 커뮤니티 소개 및 기술 동향
오픈스택 커뮤니티 소개 및 기술 동향
 
Adobe AEM - From Eventing to Job Processing
Adobe AEM - From Eventing to Job ProcessingAdobe AEM - From Eventing to Job Processing
Adobe AEM - From Eventing to Job Processing
 
20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기20명 규모의 팀에서 Vault 사용하기
20명 규모의 팀에서 Vault 사용하기
 
Everything as Code with Terraform
Everything as Code with TerraformEverything as Code with Terraform
Everything as Code with Terraform
 
AWS Code Services
AWS Code ServicesAWS Code Services
AWS Code Services
 
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
 
Authentification et autorisation d'accès avec AWS IAM
Authentification et autorisation d'accès avec AWS IAMAuthentification et autorisation d'accès avec AWS IAM
Authentification et autorisation d'accès avec AWS IAM
 
Java null survival guide
Java null survival guideJava null survival guide
Java null survival guide
 
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
 
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
 
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
 
(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS
 
Gatekeeper: API gateway
Gatekeeper: API gatewayGatekeeper: API gateway
Gatekeeper: API gateway
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shell
 
gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!gRPC vs REST: let the battle begin!
gRPC vs REST: let the battle begin!
 
AWS CDK Introduction
AWS CDK IntroductionAWS CDK Introduction
AWS CDK Introduction
 
Notions de base de JavaScript
Notions de base de JavaScriptNotions de base de JavaScript
Notions de base de JavaScript
 
DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개
DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개
DEVOPS 에 대한 전반적인 소개 및 자동화툴 소개
 
Sequence and Traverse - Part 1
Sequence and Traverse - Part 1Sequence and Traverse - Part 1
Sequence and Traverse - Part 1
 

Destacado

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

Destacado (20)

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

Similar a OSGi Blueprint Services

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

Similar a OSGi Blueprint Services (20)

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

Último

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

Último (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

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