Add blueprint wiring to the toaster sample
[controller.git] / opendaylight / md-sal / samples / toaster-provider / src / main / resources / org / opendaylight / blueprint / toaster-provider.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
3            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
4            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
5     odl:restart-dependents-on-updates="true" odl:use-default-for-reference-types="true">
6
7   <!-- "restart-dependents-on-updates" is an ODL extension attribute that processes any "property-placeholder"
8        elements and reacts to updates to the corresponding cfg file by restarting this blueprint container any
9        dependent containers that consume OSGi services provided by this container in an atomic and orderly
10        manner.
11
12        "use-default-for-reference-types" is an ODL extension attribute that adds a filter to all services
13        imported via "reference" elements where the "type" property is either not set or set to "default" if
14        the odl:type attribute isn't explicitly specified. This ensures the default implementation is imported
15        if there are other implementations advertised with other types.
16   -->
17
18   <!-- Accesses properties via the etc/org.opendaylight.toaster.cfg file. The properties are made available
19        as variables that can be referenced. The variables are substituted with the actual values read from
20        the cfg file, if present, or the default-properties.
21    -->
22   <cm:property-placeholder persistent-id="org.opendaylight.toaster" update-strategy="none">
23     <cm:default-properties>
24       <cm:property name="databroker-type" value="default"/>
25     </cm:default-properties>
26   </cm:property-placeholder>
27
28   <!-- Import MD-SAL services. For the DataBroker, we explicitly specify the odl:type which is configurable
29        via the cfg file. In this manner the toaster can be configured to use the default clustered DataBroker
30        or the specialized "pingpong" DataBroker (or any other DataBroker implementation).
31    -->
32   <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="${databroker-type}" />
33   <reference id="notificationService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"/>
34
35   <!-- Create the OpendaylightToaster instance and inject its dependencies -->
36   <bean id="toaster" class="org.opendaylight.controller.sample.toaster.provider.OpendaylightToaster"
37           init-method="register" destroy-method="unregister">
38     <property name="dataProvider" ref="dataBroker"/>
39     <property name="notificationProvider" ref="notificationService"/>
40   </bean>
41
42   <!-- Register the OpendaylightToaster instance as an RPC implementation provider. The "rpc-implementation"
43        element automatically figures out the RpcService interface although it can be explicitly specified.
44    -->
45   <odl:rpc-implementation ref="toaster"/>
46 </blueprint>