Implement DOMDataTreeChangeListener.onInitialData
[controller.git] / opendaylight / md-sal / samples / toaster-provider / src / main / resources / OSGI-INF / 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   <!-- "clustered-app-config" is an ODL extension that obtains an application configuration yang container
29        from the MD-SAL data store and makes the binding DataObject available as a bean that can be injected
30        into other beans. Here we obtain the ToasterAppConfig container DataObject. This also shows how to
31        specify default data via the "default-config" child element. While default leaf values defined in the
32        yang are returned, one may have more complex data, eg lists, that require default data. The
33        "default-config" must contain the XML representation of the yang data, including namespace, wrapped
34        in a CDATA section to prevent the blueprint container from treating it as markup.
35   -->
36   <odl:clustered-app-config id="toasterAppConfig"
37       binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.toaster.app.config.rev160503.ToasterAppConfig">
38     <odl:default-config><![CDATA[
39       <toaster-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:toaster-app-config">
40         <max-make-toast-tries>3</max-make-toast-tries>
41       </toaster-app-config>
42     ]]></odl:default-config>
43   </odl:clustered-app-config>
44
45   <!-- Import MD-SAL services. For the DataBroker, we explicitly specify the odl:type which is configurable
46        via the cfg file. In this manner the toaster can be configured to use the default clustered DataBroker
47        or the specialized "pingpong" DataBroker (or any other DataBroker implementation).
48    -->
49   <reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker" odl:type="${databroker-type}" />
50   <reference id="notificationService" interface="org.opendaylight.mdsal.binding.api.NotificationPublishService"/>
51
52   <!-- Create the OpendaylightToaster instance and inject its dependencies -->
53   <bean id="toaster" class="org.opendaylight.controller.sample.toaster.provider.OpendaylightToaster"
54           init-method="init" destroy-method="close">
55     <argument ref="toasterAppConfig"/>
56     <property name="dataBroker" ref="dataBroker"/>
57     <property name="notificationProvider" ref="notificationService"/>
58   </bean>
59
60   <!-- Register the OpendaylightToaster instance as an RPC implementation provider. The "rpc-implementation"
61        element automatically figures out the RpcService interface although it can be explicitly specified.
62    -->
63   <odl:rpc-implementation ref="toaster"/>
64 </blueprint>