Add odl-mdsal-singleton-dom feature and CSS yang 93/42093/2
authorTom Pantelis <tpanteli@brocade.com>
Tue, 19 Jul 2016 01:30:39 +0000 (21:30 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 19 Jul 2016 22:07:31 +0000 (22:07 +0000)
Added the odl-mdsal-singleton-dom feature to the odl-mdsal-local-broker
feature.

Also added CSS yang and Module class for the
DOMClusterSingletonServiceProvider and added the XML to the existing
06-clustered-entity-ownership.xml file.

Change-Id: I69c7224fd7aa12742778670e7aec53118bf98332
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
features/mdsal/src/main/features/features.xml
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/06-clustered-entity-ownership.xml.conf
opendaylight/md-sal/sal-dom-config/pom.xml
opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/DOMClusterSingletonServiceProviderModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/DOMClusterSingletonServiceProviderModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-impl-cfg.yang [new file with mode: 0644]
opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-spi-cfg.yang [new file with mode: 0644]

index dda7c73..4d10e2a 100644 (file)
@@ -41,6 +41,7 @@
         <!-- FIXME: Bug 4202: Add MD-SAL provided odl-mdsal-binding-adapter -->
         <!-- FIXME: Bug 4202: Add MD-SAL provided odl-mdsal-dom-broker -->
         <feature version='${mdsal.version}'>odl-mdsal-eos-dom</feature>
+        <feature version='${mdsal.version}'>odl-mdsal-singleton-dom</feature>
         <bundle>mvn:org.opendaylight.controller/sal-core-api/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.controller/sal-core-spi/{{VERSION}}</bundle>
         <bundle start-level="70">mvn:org.opendaylight.controller/sal-schema-service/{{VERSION}}</bundle>
index e7428c8..f6eabc4 100644 (file)
                     <type xmlns:legacy-eos="urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider">legacy-eos:legacy-entity-ownership-service-provider</type>
                     <name>legacy-entity-ownership-service-provider</name>
                 </module>
+
+                <module>
+                    <type xmlns:singleton="urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service">singleton:dom-cluster-singleton-service-impl</type>
+                    <name>dom-cluster-singleton-service-impl</name>
+                </module>
             </modules>
 
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                         <provider>/modules/module[type='legacy-entity-ownership-service-provider'][name='legacy-entity-ownership-service-provider']</provider>
                     </instance>
                 </service>
+
+                <service>
+                    <type xmlns:singleton="urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service">singleton:dom-cluster-singleton-service</type>
+                    <instance>
+                        <name>dom-cluster-singleton-service</name>
+                        <provider>/modules/module[type='dom-cluster-singleton-service-impl'][name='dom-cluster-singleton-service-impl']</provider>
+                    </instance>
+                </service>
             </services>
         </data>
     </configuration>
     <required-capabilities>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider?module=opendaylight-legacy-entity-ownership-service-provider&amp;revision=2016-02-26</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service?module=cluster-singleton-service-impl&amp;revision=2016-07-18</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service?module=cluster-singleton-service-spi&amp;revision=2016-07-18</capability>
     </required-capabilities>
 </snapshot>
index 97117c5..653fc4b 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-core-spi</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>mdsal-singleton-dom-api</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>*,com.google.common.base</Import-Package>
+            <Import-Package>
+              com.google.common.base,
+              org.opendaylight.mdsal.eos.common.api,
+              org.opendaylight.mdsal.eos.dom.api,
+              org.opendaylight.mdsal.singleton.common.api,
+              *
+            </Import-Package>
           </instructions>
         </configuration>
       </plugin>
diff --git a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/DOMClusterSingletonServiceProviderModule.java b/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/DOMClusterSingletonServiceProviderModule.java
new file mode 100644 (file)
index 0000000..72094da
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2016 Brocade Communications 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.config.impl.cluster.singleton.service.rev160718;
+
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+import java.lang.reflect.Method;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.opendaylight.mdsal.singleton.dom.api.DOMClusterSingletonServiceProvider;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
+ *             of the provided config system service are converted to blueprint.
+ */
+@Deprecated
+public class DOMClusterSingletonServiceProviderModule extends AbstractDOMClusterSingletonServiceProviderModule {
+    private BundleContext bundleContext;
+
+    public DOMClusterSingletonServiceProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public DOMClusterSingletonServiceProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver,
+            DOMClusterSingletonServiceProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+
+    @Override
+    public AutoCloseable createInstance() {
+        final WaitingServiceTracker<DOMClusterSingletonServiceProvider> tracker =
+                WaitingServiceTracker.create(DOMClusterSingletonServiceProvider.class, bundleContext);
+        final DOMClusterSingletonServiceProvider service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+        // Create a proxy to override close to close the ServiceTracker. The actual DOMClusterSingletonServiceProvider
+        // instance will be closed via blueprint.
+        return Reflection.newProxy(AutoCloseableDOMClusterSingletonServiceProvider.class, new AbstractInvocationHandler() {
+            @Override
+            protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+                if (method.getName().equals("close")) {
+                    tracker.close();
+                    return null;
+                } else {
+                    return method.invoke(service, args);
+                }
+            }
+        });
+
+    }
+
+    void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    private static interface AutoCloseableDOMClusterSingletonServiceProvider extends DOMClusterSingletonServiceProvider, AutoCloseable {
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/DOMClusterSingletonServiceProviderModuleFactory.java b/opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/md/sal/config/impl/cluster/singleton/service/rev160718/DOMClusterSingletonServiceProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..3d1f534
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016 Brocade Communications 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.config.impl.cluster.singleton.service.rev160718;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
+ *             of the provided config system service are converted to blueprint.
+ */
+@Deprecated
+public class DOMClusterSingletonServiceProviderModuleFactory extends AbstractDOMClusterSingletonServiceProviderModuleFactory {
+    @Override
+    public DOMClusterSingletonServiceProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            DOMClusterSingletonServiceProviderModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+        DOMClusterSingletonServiceProviderModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+                oldInstance, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+
+    @Override
+    public DOMClusterSingletonServiceProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        DOMClusterSingletonServiceProviderModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-impl-cfg.yang b/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-impl-cfg.yang
new file mode 100644 (file)
index 0000000..0084a43
--- /dev/null
@@ -0,0 +1,26 @@
+module cluster-singleton-service-impl {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service";
+    prefix "cluster-singleton-service";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import cluster-singleton-service-spi { prefix spi; revision-date 2016-07-18; }
+
+    description "MD-SAL ClusterSingletonServiceProvider service implementation definition";
+
+    revision 2016-07-18 {
+        description "Initial revision";
+    }
+
+    identity dom-cluster-singleton-service-impl {
+        base config:module-type;
+        config:provided-service spi:dom-cluster-singleton-service;
+        config:java-name-prefix DOMClusterSingletonServiceProvider;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case dom-cluster-singleton-service-impl {
+            when "/config:modules/config:module/config:type = 'dom-cluster-singleton-service-impl'";
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-spi-cfg.yang b/opendaylight/md-sal/sal-dom-config/src/main/yang/cluster-singleton-service-spi-cfg.yang
new file mode 100644 (file)
index 0000000..bc5f7e5
--- /dev/null
@@ -0,0 +1,19 @@
+module cluster-singleton-service-spi {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:md:sal:config:spi:cluster-singleton-service";
+    prefix "cluster-singleton-service";
+
+    import config { prefix config; revision-date 2013-04-05; }
+
+    description "MD-SAL ClusterSingletonServiceProvider service interface definition";
+
+    revision 2016-07-18 {
+        description "Initial revision";
+    }
+
+    identity dom-cluster-singleton-service {
+        base "config:service-type";
+        config:java-class "org.opendaylight.mdsal.singleton.dom.api.DOMClusterSingletonServiceProvider";
+        config:disable-osgi-service-registration;
+    }
+}