Convert toaster to mdsal APIs
[controller.git] / opendaylight / md-sal / samples / toaster-provider / src / main / resources / org / opendaylight / blueprint / toaster-provider.xml
index 01cb3132f174ed3953318a09b682eb94ba24b0b5..4c7af5b6355813871d17839a1b1b19ef75abe120 100644 (file)
     </cm:default-properties>
   </cm:property-placeholder>
 
+  <!-- "clustered-app-config" is an ODL extension that obtains an application configuration yang container
+       from the MD-SAL data store and makes the binding DataObject available as a bean that can be injected
+       into other beans. Here we obtain the ToasterAppConfig container DataObject. This also shows how to
+       specify default data via the "default-config" child element. While default leaf values defined in the
+       yang are returned, one may have more complex data, eg lists, that require default data. The
+       "default-config" must contain the XML representation of the yang data, including namespace, wrapped
+       in a CDATA section to prevent the blueprint container from treating it as markup.
+  -->
+  <odl:clustered-app-config id="toasterAppConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.toaster.app.config.rev160503.ToasterAppConfig">
+    <odl:default-config><![CDATA[
+      <toaster-app-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:toaster-app-config">
+        <max-make-toast-tries>3</max-make-toast-tries>
+      </toaster-app-config>
+    ]]></odl:default-config>
+  </odl:clustered-app-config>
+
   <!-- Import MD-SAL services. For the DataBroker, we explicitly specify the odl:type which is configurable
        via the cfg file. In this manner the toaster can be configured to use the default clustered DataBroker
        or the specialized "pingpong" DataBroker (or any other DataBroker implementation).
    -->
-  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="${databroker-type}" />
-  <reference id="notificationService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"/>
+  <reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker" odl:type="${databroker-type}" />
+  <reference id="notificationService" interface="org.opendaylight.mdsal.binding.api.NotificationPublishService"/>
 
   <!-- Create the OpendaylightToaster instance and inject its dependencies -->
   <bean id="toaster" class="org.opendaylight.controller.sample.toaster.provider.OpendaylightToaster"
-          init-method="register" destroy-method="unregister">
-    <property name="dataProvider" ref="dataBroker"/>
+          init-method="init" destroy-method="close">
+    <argument ref="toasterAppConfig"/>
+    <property name="dataBroker" ref="dataBroker"/>
     <property name="notificationProvider" ref="notificationService"/>
   </bean>
 
@@ -43,4 +61,4 @@
        element automatically figures out the RpcService interface although it can be explicitly specified.
    -->
   <odl:rpc-implementation ref="toaster"/>
-</blueprint>
\ No newline at end of file
+</blueprint>