BUG 6396 ne-location-provider migration to blueprint 02/43502/5
authorMatej Perina <mperina@cisco.com>
Thu, 18 Aug 2016 15:11:23 +0000 (17:11 +0200)
committerMatej Perina <mperina@cisco.com>
Wed, 24 Aug 2016 07:02:23 +0000 (07:02 +0000)
Change-Id: I5c63e24e1f715cdb224abfb6d2c8315d6e9a6227
Signed-off-by: Matej Perina <mperina@cisco.com>
location-providers/ne-location-provider/src/main/config/default-config.xml
location-providers/ne-location-provider/src/main/java/org/opendaylight/controller/config/yang/config/ne/location/provider/cfg/NeLocationProviderInstance.java [new file with mode: 0644]
location-providers/ne-location-provider/src/main/java/org/opendaylight/controller/config/yang/config/ne/location/provider/cfg/NeLocationProviderModule.java
location-providers/ne-location-provider/src/main/resources/org/opendaylight/blueprint/ne-location-provider.xml [new file with mode: 0644]
location-providers/ne-location-provider/src/main/yang/ne-location-provider-cfg.yang

index 82b8b4b72831b3177190104816f0ddeecd141b84..115cf5199728fc6e88189ed86664b64dc7b71c1a 100644 (file)
                         ne-location:ne-location-provider
                     </type>
                     <name>ne-location-provider</name>
-
-                    <data-broker>
-                      <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
-                      <name>binding-data-broker</name>
-                    </data-broker>
                 </module>
             </modules>
         </data>
diff --git a/location-providers/ne-location-provider/src/main/java/org/opendaylight/controller/config/yang/config/ne/location/provider/cfg/NeLocationProviderInstance.java b/location-providers/ne-location-provider/src/main/java/org/opendaylight/controller/config/yang/config/ne/location/provider/cfg/NeLocationProviderInstance.java
new file mode 100644 (file)
index 0000000..f894a91
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, 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.config.yang.config.ne.location.provider.cfg;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.groupbasedpolicy.ne.location.provider.NeLocationProvider;
+
+public class NeLocationProviderInstance implements AutoCloseable {
+
+    private NeLocationProvider provider;
+
+    public NeLocationProviderInstance (DataBroker dataBroker) {
+        provider = new NeLocationProvider(dataBroker);
+    }
+
+    @Override
+    public void close() throws Exception {
+        provider.close();
+    }
+}
index 44b1643027a33566935488d5d1e0500b70080713..b0c7a9a2b842a71792c45864b010c4564195bb2e 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.controller.config.yang.config.ne.location.provider.cfg;
 
-import org.opendaylight.groupbasedpolicy.ne.location.provider.NeLocationProvider;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
 
 public class NeLocationProviderModule extends org.opendaylight.controller.config.yang.config.ne.location.provider.cfg.AbstractNeLocationProviderModule {
     public NeLocationProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
@@ -26,7 +26,7 @@ public class NeLocationProviderModule extends org.opendaylight.controller.config
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        return new NeLocationProvider(getDataBrokerDependency());
+        return NoopAutoCloseable.INSTANCE;
     }
 
 }
diff --git a/location-providers/ne-location-provider/src/main/resources/org/opendaylight/blueprint/ne-location-provider.xml b/location-providers/ne-location-provider/src/main/resources/org/opendaylight/blueprint/ne-location-provider.xml
new file mode 100644 (file)
index 0000000..d6598a3
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+           odl:use-default-for-reference-types="true">
+
+    <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
+
+    <bean id="nelocationProvider" class="org.opendaylight.controller.config.yang.config.ne.location.provider.cfg.NeLocationProviderInstance"
+        destroy-method="close">
+        <argument ref="dataBroker"/>
+    </bean>
+</blueprint>
index 8a58edac658a5c8d3b71692f5ec3fd1396a7c55c..16034dbd0696b993160b117f5c7c65e5f48def3d 100644 (file)
@@ -33,16 +33,6 @@ module ne-location-provider-cfg {
     augment "/config:modules/config:module/config:configuration" {
         case ne-location-provider {
             when "/config:modules/config:module/config:type = 'ne-location-provider'";
-
-            // Wires in the data-broker service
-            container data-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity mdsal:binding-async-data-broker;
-                    }
-                }
-            }
         }
     }
 }