SlideShare a Scribd company logo
1 of 63
Download to read offline
OSGi Blueprint Services




                     Blueprint Services

                          DI brought to OSGi


                             Guillaume Nodet
OSGi Blueprint Services



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



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



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

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



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




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



                                   Configuration
          • Extender pattern
          • XML resources
          • Metadata


                Blueprint Bundle                                     Metadata
                                               XML




                                              Blueprint Extender




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



                       Blueprint XML definition

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




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



                             Simple example

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




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



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



                             Simple example

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



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



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



                             Simple example

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



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



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



                             Simple example

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



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



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



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



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



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



                               Bean manager




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




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



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



                             new osgi.devcon.impl.UserImpl()



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


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



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



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


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




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



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


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




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

                      <argument>
                          [any value]
                      </argument>




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

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




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

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




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



                             Bean arguments


                      <argument value=“gnodet”/>

                      <argument ref=“[refid]”/>

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




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



                              Bean properties

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


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




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



                              Bean properties

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


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




                                                                                       Property name




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



                              Bean properties

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


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




                               Property value


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



                              Bean properties


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

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

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




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



                             Bean scope

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




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



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




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


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

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



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



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


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

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



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



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


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


                      <bean id=“regId” … />

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




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


                                     <value>
          • Insert the content of the element text

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




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




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



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

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




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



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

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



                                                                Type of the values

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


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


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


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



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


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




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


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

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




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



                         Components as values
          • Instances provided by managers can be
            injected



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




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



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

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




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




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


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

                                                      proxy

                                                                 backing
                                                                 service




                             injected beans                                   services            service providers




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


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



                                                                      backing
                                                                      service


                                       list



                      injected beans                      proxies                 services   service providers




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



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

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



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


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


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



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

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

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


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


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



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

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




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



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



                             Service properties
          • Expose an object as an OSGi service


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




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



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

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


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



                 public void (T, Map)



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



                                   Lifecycle




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



                                   Lifecycle
                                                                                 Support for lazy
                                                                                   activattion




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



                                   Lifecycle
                                                                                 Track mandatory
                                                                                    references




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



                                   Lifecycle




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



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

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



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



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



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


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




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



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

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


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

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

                                  <ref-list> as
                             List<ServiceReference>



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




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



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



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



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



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

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



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


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



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


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




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



                               Next steps
          • Custom namespace handlers
          • Config Admin support




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



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

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

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




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



                             Config Admin
          • Injection of values from a Configuration



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

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




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



                             Config Admin
          • Support for managed properties




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




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



                             Config Admin
          • Support for managed service factories


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




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



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



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



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


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

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

More Related Content

What's hot

Integrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkIntegrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkHortonworks
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Jeremiah Grossman
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to SwaggerKnoldus Inc.
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiDataWorks Summit
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsMikhail Egorov
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeAbhishek L.R
 
API Security Best Practices and Guidelines
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and GuidelinesWSO2
 
Hacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesMikhail Egorov
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architectureIblesoft
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Omar Fathy
 
Web API authentication and authorization
Web API authentication and authorization Web API authentication and authorization
Web API authentication and authorization Chalermpon Areepong
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernateelliando dias
 
Exploring the Xcode Build Process
Exploring the Xcode Build Process Exploring the Xcode Build Process
Exploring the Xcode Build Process DianaKhersonskaia
 
Systemes authentification
Systemes authentificationSystemes authentification
Systemes authentificationLhouceine OUHAMZA
 
Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9ednilsoncampos
 

What's hot (20)

Integrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkIntegrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache Flink
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFi
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status Code
 
API Security Best Practices and Guidelines
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and Guidelines
 
Hacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sites
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
 
API for Beginners
API for BeginnersAPI for Beginners
API for Beginners
 
Web API authentication and authorization
Web API authentication and authorization Web API authentication and authorization
Web API authentication and authorization
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Kong
KongKong
Kong
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
Exploring the Xcode Build Process
Exploring the Xcode Build Process Exploring the Xcode Build Process
Exploring the Xcode Build Process
 
Systemes authentification
Systemes authentificationSystemes authentification
Systemes authentification
 
Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9
 

Viewers also liked

Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A GrzesikApache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesikmfrancis
 
SCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitSCR Annotations for Fun and Profit
SCR Annotations for Fun and ProfitMike Pfaff
 
Incremental Evolving Grammar Fragments
Incremental Evolving Grammar FragmentsIncremental Evolving Grammar Fragments
Incremental Evolving Grammar FragmentsNurfadhlina Mohd Sharef
 
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
 
Incremental Evolving Grammar Fragments
Incremental Evolving Grammar FragmentsIncremental Evolving Grammar Fragments
Incremental Evolving Grammar FragmentsNurfadhlina Mohd Sharef
 
P2 Introduction
P2 IntroductionP2 Introduction
P2 Introductionirbull
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegelermfrancis
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application DevelopmentChristian Baranowski
 
Many Worlds, the Born Rule, and Self-Locating Uncertainty
Many Worlds, the Born Rule, and Self-Locating UncertaintyMany Worlds, the Born Rule, and Self-Locating Uncertainty
Many Worlds, the Born Rule, and Self-Locating UncertaintySean Carroll
 
7 bran Simonova Necronomiconu
7 bran Simonova Necronomiconu7 bran Simonova Necronomiconu
7 bran Simonova NecronomiconuBloxxterMagick
 
KrystalickĂĄ hrĹŻza H. P. Lovecrafta ve filmu
KrystalickĂĄ hrĹŻza H. P. Lovecrafta ve filmuKrystalickĂĄ hrĹŻza H. P. Lovecrafta ve filmu
KrystalickĂĄ hrĹŻza H. P. Lovecrafta ve filmuBloxxterMagick
 
Setting Time Aright
Setting Time ArightSetting Time Aright
Setting Time ArightSean Carroll
 
Microservices and OSGi: Better together?
Microservices and OSGi: Better together?Microservices and OSGi: Better together?
Microservices and OSGi: Better together?Graham Charters
 
Self adaptive based natural language interface for disambiguation of
Self adaptive based natural language interface for disambiguation ofSelf adaptive based natural language interface for disambiguation of
Self adaptive based natural language interface for disambiguation ofNurfadhlina Mohd Sharef
 
MagickÊ myťlení aneb jak magie ovlivňuje nåť Şivot
MagickÊ myťlení aneb jak magie ovlivňuje nåť ŞivotMagickÊ myťlení aneb jak magie ovlivňuje nåť Şivot
MagickÊ myťlení aneb jak magie ovlivňuje nåť ŞivotBloxxterMagick
 
Tajemná krajina severovýchodních Čech
Tajemná krajina severovýchodních ČechTajemná krajina severovýchodních Čech
Tajemná krajina severovýchodních ČechBloxxterMagick
 
Moved to https://slidr.io/azzazzel/osgi-for-outsiders
Moved to https://slidr.io/azzazzel/osgi-for-outsidersMoved to https://slidr.io/azzazzel/osgi-for-outsiders
Moved to https://slidr.io/azzazzel/osgi-for-outsidersMilen Dyankov
 

Viewers also liked (20)

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

Similar to OSGi Blueprint Services

OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Reviewnjbartlett
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.jsmattpardee
 
Hybrid Applications
Hybrid ApplicationsHybrid Applications
Hybrid ApplicationsAndreas Enbohm
 
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 on the Desktop
JavaScript on the DesktopJavaScript on the Desktop
JavaScript on the DesktopDomenic Denicola
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2JooinK
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OpenBlend society
 
Micro Services in JavaScript - Simon Kaegi
Micro Services in JavaScript - Simon KaegiMicro Services in JavaScript - Simon Kaegi
Micro Services in JavaScript - Simon Kaegimfrancis
 

Similar to OSGi Blueprint Services (20)

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

Recently uploaded

AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 

Recently uploaded (20)

AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 

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