From: Tom Pantelis Date: Tue, 29 Mar 2016 07:41:24 +0000 (-0400) Subject: Move ClusterAdminRpcService to its own bundle X-Git-Tag: release/boron~201 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=2b43286e7f65957e6ef73fd76ccac9d5db4089cc Move ClusterAdminRpcService to its own bundle The ClusterAdminRpcService can't be instantiated with the clustered datastore blueprint xml b/c it needs the binding RPC registry service so I moved it to its own bundle. I made the ClusterAdminProviderModule a no-op since the ClusterAdminRpcService is now created via blueprint. I also had to export some packages from the sal-distributed-datastore bundle. Change-Id: Icaf025517ed9b08a82a81310f1e5dd2ac0647559 Signed-off-by: Tom Pantelis --- diff --git a/features/mdsal/pom.xml b/features/mdsal/pom.xml index f12e9e1358..5c1a1ed78f 100644 --- a/features/mdsal/pom.xml +++ b/features/mdsal/pom.xml @@ -262,6 +262,11 @@ cfg datastore + + org.opendaylight.controller + sal-cluster-admin + ${controller.mdsal.version} + org.opendaylight.controller sal-distributed-datastore diff --git a/features/mdsal/src/main/features/features.xml b/features/mdsal/src/main/features/features.xml index 88a18f7543..d5d06f69e4 100644 --- a/features/mdsal/src/main/features/features.xml +++ b/features/mdsal/src/main/features/features.xml @@ -82,6 +82,7 @@ odl-mdsal-broker-local odl-mdsal-clustering-commons mvn:org.opendaylight.controller/sal-distributed-datastore/{{VERSION}} + mvn:org.opendaylight.controller/sal-cluster-admin/{{VERSION}} odl-mdsal-broker-local diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index 0b8e0d027f..03aa18cf69 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -64,6 +64,7 @@ sal-distributed-datastore sal-dummy-distributed-datastore + sal-cluster-admin sal-dom-xsql diff --git a/opendaylight/md-sal/sal-cluster-admin/pom.xml b/opendaylight/md-sal/sal-cluster-admin/pom.xml new file mode 100644 index 0000000000..7f80ea4036 --- /dev/null +++ b/opendaylight/md-sal/sal-cluster-admin/pom.xml @@ -0,0 +1,178 @@ + + + 4.0.0 + + org.opendaylight.controller + sal-parent + 1.4.0-SNAPSHOT + + sal-cluster-admin + bundle + + + + + junit + junit + test + + + org.mockito + mockito-all + test + + + org.slf4j + slf4j-simple + test + + + org.opendaylight.controller + sal-akka-raft + test-jar + test + + + org.opendaylight.controller + sal-distributed-datastore + test-jar + 1.4.0-SNAPSHOT + test + + + + + com.typesafe.akka + akka-actor_${scala.version} + + + com.typesafe.akka + akka-testkit_${scala.version} + + + + + com.google.guava + guava + + + + + org.scala-lang + scala-library + + + + + org.opendaylight.controller + config-api + + + org.opendaylight.controller + sal-binding-api + + + org.opendaylight.controller + sal-akka-raft + + + org.opendaylight.controller + sal-distributed-datastore + + + org.opendaylight.mdsal + yang-binding + + + org.opendaylight.yangtools + yang-common + + + org.apache.commons + commons-lang3 + + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.groupId}.${project.artifactId} + + + !*snappy; + !org.jboss.*; + !com.jcraft.*; + !*jetty*; + !sun.security.*; + *; + + + + + + + org.jacoco + jacoco-maven-plugin + + + org.opendaylight.controller.* + + + + org.opendaylight.controller.config.yang.config.* + + false + + + + pre-test + + prepare-agent + + + + post-test + + report + + test + + + + + org.opendaylight.yangtools + yang-maven-plugin + + + config + + generate-sources + + + + + org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + ${jmxGeneratorPath} + + urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang + + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + ${salGeneratorPath} + + + true + + + + + + + diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java b/opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java similarity index 100% rename from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java rename to opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java b/opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java similarity index 52% rename from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java rename to opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java index facc07f11d..270a6214ec 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java +++ b/opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModule.java @@ -8,11 +8,9 @@ package org.opendaylight.controller.config.yang.config.cluster_admin_provider; -import com.google.common.base.Preconditions; -import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface; -import org.opendaylight.controller.cluster.datastore.admin.ClusterAdminRpcService; import org.opendaylight.controller.config.api.DependencyResolver; import org.opendaylight.controller.config.api.ModuleIdentifier; +import org.opendaylight.controller.sal.common.util.NoopAutoCloseable; public class ClusterAdminProviderModule extends AbstractClusterAdminProviderModule { public ClusterAdminProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) { @@ -25,20 +23,13 @@ public class ClusterAdminProviderModule extends AbstractClusterAdminProviderModu } @Override - public void customValidation() { - // add custom validation form module attributes here. + public boolean canReuseInstance(AbstractClusterAdminProviderModule oldModule) { + return true; } @Override public AutoCloseable createInstance() { - Preconditions.checkArgument(getConfigDataStoreDependency() instanceof DistributedDataStoreInterface, - "Injected config DOMStore must be an instance of DistributedDataStoreInterface"); - Preconditions.checkArgument(getOperDataStoreDependency() instanceof DistributedDataStoreInterface, - "Injected operational DOMStore must be an instance of DistributedDataStoreInterface"); - ClusterAdminRpcService service = new ClusterAdminRpcService( - (DistributedDataStoreInterface)getConfigDataStoreDependency(), - (DistributedDataStoreInterface)getOperDataStoreDependency()); - service.start(getRpcRegistryDependency()); - return service; + // The ClusterAdminRpcService is created via blueprint so return a noop here for backwards compatibility. + return NoopAutoCloseable.INSTANCE; } } \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModuleFactory.java b/opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModuleFactory.java similarity index 100% rename from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModuleFactory.java rename to opendaylight/md-sal/sal-cluster-admin/src/main/java/org/opendaylight/controller/config/yang/config/cluster_admin_provider/ClusterAdminProviderModuleFactory.java diff --git a/opendaylight/md-sal/sal-cluster-admin/src/main/resources/org/opendaylight/blueprint/cluster-admin.xml b/opendaylight/md-sal/sal-cluster-admin/src/main/resources/org/opendaylight/blueprint/cluster-admin.xml new file mode 100644 index 0000000000..85edd2ef0b --- /dev/null +++ b/opendaylight/md-sal/sal-cluster-admin/src/main/resources/org/opendaylight/blueprint/cluster-admin.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/cluster-admin-service.yang b/opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin-service.yang similarity index 93% rename from opendaylight/md-sal/sal-distributed-datastore/src/main/yang/cluster-admin-service.yang rename to opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin-service.yang index 15cb54361d..6288f27717 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/cluster-admin-service.yang +++ b/opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin-service.yang @@ -28,7 +28,7 @@ module cluster-admin-provider { container config-data-store { uses config:service-ref { refine type { - mandatory true; + mandatory false; config:required-identity config-dom-store-spi:config-dom-datastore; } } @@ -37,7 +37,7 @@ module cluster-admin-provider { container oper-data-store { uses config:service-ref { refine type { - mandatory true; + mandatory false; config:required-identity operational-dom-store-spi:operational-dom-datastore; } } @@ -46,7 +46,7 @@ module cluster-admin-provider { container rpc-registry { uses config:service-ref { refine type { - mandatory true; + mandatory false; config:required-identity mdsal:binding-rpc-registry; } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/cluster-admin.yang b/opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin.yang similarity index 100% rename from opendaylight/md-sal/sal-distributed-datastore/src/main/yang/cluster-admin.yang rename to opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin.yang diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java b/opendaylight/md-sal/sal-cluster-admin/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java similarity index 100% rename from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java rename to opendaylight/md-sal/sal-cluster-admin/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/DataPersistenceProviderMonitor.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/DataPersistenceProviderMonitor.java deleted file mode 100644 index bad9fc31f4..0000000000 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/DataPersistenceProviderMonitor.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014 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.cluster.datastore; - -import akka.japi.Procedure; -import akka.persistence.SnapshotSelectionCriteria; -import java.util.concurrent.CountDownLatch; -import org.opendaylight.controller.cluster.DataPersistenceProvider; - -/** - * This class is intended for testing purposes. It just triggers CountDownLatch's in each method. - * This class really should be under src/test/java but it was problematic trying to uses it in other projects. - */ -public class DataPersistenceProviderMonitor implements DataPersistenceProvider { - - private CountDownLatch persistLatch = new CountDownLatch(1); - private CountDownLatch saveSnapshotLatch = new CountDownLatch(1); - private CountDownLatch deleteSnapshotsLatch = new CountDownLatch(1);; - private CountDownLatch deleteMessagesLatch = new CountDownLatch(1);; - - @Override - public boolean isRecoveryApplicable() { - return false; - } - - @Override - public void persist(T o, Procedure procedure) { - persistLatch.countDown(); - } - - @Override - public void saveSnapshot(Object o) { - saveSnapshotLatch.countDown(); - } - - @Override - public void deleteSnapshots(SnapshotSelectionCriteria criteria) { - deleteSnapshotsLatch.countDown(); - } - - @Override - public void deleteMessages(long sequenceNumber) { - deleteMessagesLatch.countDown(); - } - - public void setPersistLatch(CountDownLatch persistLatch) { - this.persistLatch = persistLatch; - } - - public void setSaveSnapshotLatch(CountDownLatch saveSnapshotLatch) { - this.saveSnapshotLatch = saveSnapshotLatch; - } - - public void setDeleteSnapshotsLatch(CountDownLatch deleteSnapshotsLatch) { - this.deleteSnapshotsLatch = deleteSnapshotsLatch; - } - - public void setDeleteMessagesLatch(CountDownLatch deleteMessagesLatch) { - this.deleteMessagesLatch = deleteMessagesLatch; - } - - @Override - public long getLastSequenceNumber() { - return -1; - } -} diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index f2719bccc8..8ce090e702 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -179,7 +179,12 @@ ${project.groupId}.${project.artifactId} org.opendaylight.controller.cluster.datastore.osgi.Activator - + + org.opendaylight.controller.cluster.datastore; + org.opendaylight.controller.cluster.datastore.config; + org.opendaylight.controller.cluster.datastore.messages; + org.opendaylight.controller.cluster.datastore.utils; + !*snappy; !org.jboss.*;