Bug 865: Changed Config subsystem module for ForwardedBindingDataBroker. 18/13018/4
authorTony Tkacik <ttkacik@cisco.com>
Thu, 20 Nov 2014 16:49:47 +0000 (17:49 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 21 Nov 2014 13:02:49 +0000 (13:02 +0000)
Implementation of new Bidning Data Broker was wired to deprecated APIs
and used broker to discover dependencies which did not allowed for
full-fledged customized wiring. Reworked configuration to explicitly
allow injection of each required depenency and to not use
deprecated APIs for dependency injection.

Change-Id: Iccbb20ee4bb1df380f5fc4a3a1bbc5748dcc5a38
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/md-sal/md-sal-config/src/main/resources/initial/01-md-sal.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingAsyncDataBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/yang/opendaylight-binding-broker-impl.yang
opendaylight/md-sal/sal-binding-it/src/test/resources/controller.xml
opendaylight/md-sal/samples/toaster-it/src/test/resources/controller.xml

index 7664a9b..1c0861a 100644 (file)
                     <name>binding-async-data-broker</name>
                     <binding-forwarded-data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
                         <dom-async-broker>
-                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
-                            <name>dom-broker</name>
+                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+                            <name>inmemory-data-broker</name>
                         </dom-async-broker>
+                        <schema-service>
+                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+                            <name>yang-schema-service</name>
+                        </schema-service>
                         <binding-mapping-service>
                             <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-dom-mapping-service</type>
                             <name>runtime-mapping-singleton</name>
index 93d99c8..d0d6821 100644 (file)
@@ -1,18 +1,12 @@
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
-import java.util.Collection;
-import java.util.Collections;
 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 
 public class BindingAsyncDataBrokerImplModule extends
-        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingAsyncDataBrokerImplModule implements
-        Provider {
+        org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingAsyncDataBrokerImplModule {
 
     public BindingAsyncDataBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
@@ -34,29 +28,10 @@ public class BindingAsyncDataBrokerImplModule extends
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        Broker domBroker = getDomAsyncBrokerDependency();
-        BindingToNormalizedNodeCodec mappingService = getBindingMappingServiceDependency();
-
-        // FIXME: Switch this to DOM Broker registration which would not require
-        // BundleContext when API are updated.
-        ProviderSession session = domBroker.registerProvider(this, null);
-        DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class);
-        SchemaService schemaService = session.getService(SchemaService.class);
+        final BindingToNormalizedNodeCodec mappingService = getBindingMappingServiceDependency();
+        final DOMDataBroker domDataBroker = getDomAsyncBrokerDependency();
+        final SchemaService schemaService = getSchemaServiceDependency();
         return new ForwardedBindingDataBroker(domDataBroker, mappingService, schemaService);
     }
 
-
-
-
-
-    @Override
-    public Collection<ProviderFunctionality> getProviderFunctionality() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public void onSessionInitiated(final ProviderSession arg0) {
-        // intentional NOOP
-    }
-
 }
index aec2723..de8ab63 100644 (file)
@@ -135,7 +135,32 @@ module opendaylight-sal-binding-broker-impl {
         case binding-forwarded-data-broker {
             when "/config:modules/config:module/config:type = 'binding-forwarded-data-broker'";
             container binding-forwarded-data-broker {
-                uses dom-forwarding-component;
+                container dom-async-broker {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory true;
+                            config:required-identity dom:dom-async-data-broker;
+                        }
+                    }
+                }
+
+                container binding-mapping-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory true;
+                            config:required-identity binding-dom-mapping-service;
+                        }
+                    }
+                }
+
+                container schema-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity dom:schema-service;
+                        }
+                    }
+                }
             }
         }
     }
index 5e37f36..1b5aca2 100644 (file)
                             <name>binding-async-data-broker</name>
                             <binding-forwarded-data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
                                 <dom-async-broker>
-                                    <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
-                                    <name>dom-broker</name>
+                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+                            <name>inmemory-data-broker</name>
                                 </dom-async-broker>
+                        <schema-service>
+                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+                            <name>yang-schema-service</name>
+                        </schema-service>
                                 <binding-mapping-service>
                                     <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-dom-mapping-service</type>
                                     <name>runtime-mapping-singleton</name>
index 4cce64d..cf61887 100644 (file)
                             <name>binding-async-data-broker</name>
                             <binding-forwarded-data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
                                 <dom-async-broker>
-                                    <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
-                                    <name>dom-broker</name>
+                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+                            <name>inmemory-data-broker</name>
                                 </dom-async-broker>
+                        <schema-service>
+                            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+                            <name>yang-schema-service</name>
+                        </schema-service>
                                 <binding-mapping-service>
                                     <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-dom-mapping-service</type>
                                     <name>runtime-mapping-singleton</name>