move trace impl-blueprint.xml DI into TraceBindingBrokerWiring 61/72661/8
authorMichael Vorburger <vorburger@redhat.com>
Mon, 4 Jun 2018 14:18:49 +0000 (16:18 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 3 Oct 2018 14:08:14 +0000 (14:08 +0000)
JIRA: CONTROLLER-1831
Change-Id: I1621e94c43fd5ddef4f1697cf7b87422e7ce0e5b
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
opendaylight/md-sal/mdsal-trace/binding-impl/pom.xml
opendaylight/md-sal/mdsal-trace/binding-impl/src/main/java/org/opendaylight/controller/md/sal/trace/binding/impl/TracingBindingBrokerWiring.java [new file with mode: 0644]
opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml

index 1cfd7ea..be8ce5c 100644 (file)
@@ -31,6 +31,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <groupId>${project.groupId}</groupId>
       <artifactId>mdsal-trace-dom-impl</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-broker-impl</artifactId>
+    </dependency>
 
     <!-- Testing Dependencies -->
     <dependency>
diff --git a/opendaylight/md-sal/mdsal-trace/binding-impl/src/main/java/org/opendaylight/controller/md/sal/trace/binding/impl/TracingBindingBrokerWiring.java b/opendaylight/md-sal/mdsal-trace/binding-impl/src/main/java/org/opendaylight/controller/md/sal/trace/binding/impl/TracingBindingBrokerWiring.java
new file mode 100644 (file)
index 0000000..0876ae0
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.sal.trace.binding.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.spi.AdapterFactory;
+import org.opendaylight.controller.md.sal.trace.api.TracingDOMDataBroker;
+
+/**
+ * Programmatic "wiring" for dependency injection.
+ *
+ * <p>See org.opendaylight.controller.md.sal.binding.impl.BindingBrokerWiring.
+ *
+ * @author Michael Vorburger.ch
+ */
+public class TracingBindingBrokerWiring {
+
+    private final DataBroker dataBroker;
+    private final DataBroker pingPongDataBroker;
+
+    public TracingBindingBrokerWiring(TracingDOMDataBroker tracingDOMDataBroker,
+            TracingDOMDataBroker tracingPingPongDOMDataBroker, AdapterFactory adapterFactory) {
+
+        dataBroker = adapterFactory.createDataBroker(tracingDOMDataBroker);
+        pingPongDataBroker = adapterFactory.createDataBroker(tracingPingPongDOMDataBroker);
+    }
+
+    public DataBroker getTracingDataBroker() {
+        return dataBroker;
+    }
+
+    public DataBroker getTracingPingPongDataBroker() {
+        return pingPongDataBroker;
+    }
+
+}
index 6f36213..30b8a99 100644 (file)
@@ -12,28 +12,29 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
   odl:use-default-for-reference-types="true">
 
+  <reference id="adapterFactory" interface="org.opendaylight.controller.md.sal.binding.spi.AdapterFactory"/>
+
   <reference id="tracingDefaultDOMBroker"
       interface="org.opendaylight.controller.md.sal.trace.api.TracingDOMDataBroker"
       odl:type="default" />
 
-  <reference id="adapterFactory" interface="org.opendaylight.controller.md.sal.binding.spi.AdapterFactory"/>
-
-  <bean id="tracingBindingDataBroker" factory-ref="adapterFactory" factory-method="createDataBroker">
-    <argument ref="tracingDefaultDOMBroker"/>
-  </bean>
-
-  <service id="tracingBindingDataBrokerSvc" ref="tracingBindingDataBroker"
-            interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
-            odl:type="default" ranking="10"/>
-
   <reference id="tracingPingPongDOMDataBroker"
       interface="org.opendaylight.controller.md.sal.trace.api.TracingDOMDataBroker"
       odl:type="pingpong"/>
 
-  <bean id="bindingTracingPingPongDataBroker" factory-ref="adapterFactory" factory-method="createDataBroker">
+  <bean id="wiring" class="org.opendaylight.controller.md.sal.trace.binding.impl.TracingBindingBrokerWiring">
+    <argument ref="tracingDefaultDOMBroker"/>
     <argument ref="tracingPingPongDOMDataBroker"/>
+    <argument ref="adapterFactory"/>
   </bean>
 
-  <service ref="bindingTracingPingPongDataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
-                                                                                    odl:type="pingpong" ranking="10"/>
+  <bean id="tracingBindingDataBroker" factory-ref="wiring" factory-method="getTracingDataBroker" />
+  <service id="tracingBindingDataBrokerSvc" ref="tracingBindingDataBroker"
+           interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+           odl:type="default" ranking="10"/>
+
+  <bean id="bindingTracingPingPongDataBroker" factory-ref="wiring" factory-method="getTracingPingPongDataBroker" />
+  <service ref="bindingTracingPingPongDataBroker"
+           interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+           odl:type="pingpong" ranking="10"/>
 </blueprint>

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.