Bump upstreams
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / OSGiDOMStore.java
index d53a8bb4683bf81672fb4beb548cf60bb3a54829..43e9c3e6fd75326594c8ebfa3c4d6868e464e909 100644 (file)
@@ -13,10 +13,9 @@ import com.google.common.annotations.Beta;
 import java.util.Map;
 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker.CommitCohortExtension;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistration;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.spi.store.DOMStore;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
@@ -24,7 +23,7 @@ import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreTreeChangePublisher;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
@@ -39,7 +38,7 @@ import org.slf4j.LoggerFactory;
 @Beta
 @Component(factory = OSGiDOMStore.FACTORY_NAME, service = { DOMStore.class,  DistributedDataStoreInterface.class })
 public final class OSGiDOMStore
-        implements DistributedDataStoreInterface, DOMStoreTreeChangePublisher, DOMDataTreeCommitCohortRegistry {
+        implements DistributedDataStoreInterface, DOMStoreTreeChangePublisher, CommitCohortExtension {
     // OSGi DS Component Factory name
     static final String FACTORY_NAME = "org.opendaylight.controller.cluster.datastore.OSGiDOMStore";
     static final String DATASTORE_INST_PROP = ".datastore.instance";
@@ -47,30 +46,41 @@ public final class OSGiDOMStore
 
     private static final Logger LOG = LoggerFactory.getLogger(OSGiDOMStore.class);
 
-    private LogicalDatastoreType datastoreType;
+    private final LogicalDatastoreType datastoreType;
     private AbstractDataStore datastore;
 
+    @Activate
+    public OSGiDOMStore(final Map<String, ?> properties) {
+        datastoreType = (LogicalDatastoreType) verifyNotNull(properties.get(DATASTORE_TYPE_PROP));
+        datastore = (AbstractDataStore) verifyNotNull(properties.get(DATASTORE_INST_PROP));
+        LOG.info("Datastore service type {} activated", datastoreType);
+    }
+
+    @Deactivate
+    void deactivate() {
+        datastore = null;
+        LOG.info("Datastore service type {} deactivated", datastoreType);
+    }
+
     @Override
     public ActorUtils getActorUtils() {
         return datastore.getActorUtils();
     }
 
     @Override
-    public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerProxyListener(
-            final YangInstanceIdentifier shardLookup, final YangInstanceIdentifier insideShard,
-            final DOMDataTreeChangeListener delegate) {
+    public Registration registerProxyListener(final YangInstanceIdentifier shardLookup,
+            final YangInstanceIdentifier insideShard, final DOMDataTreeChangeListener delegate) {
         return datastore.registerProxyListener(shardLookup, insideShard, delegate);
     }
 
     @Override
-    public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
-            final YangInstanceIdentifier treeId, final L listener) {
+    public Registration registerTreeChangeListener(final YangInstanceIdentifier treeId,
+            final DOMDataTreeChangeListener listener) {
         return datastore.registerTreeChangeListener(treeId, listener);
     }
 
     @Override
-    public <T extends DOMDataTreeCommitCohort> DOMDataTreeCommitCohortRegistration<T> registerCommitCohort(
-            final DOMDataTreeIdentifier path, final T cohort) {
+    public Registration registerCommitCohort(final DOMDataTreeIdentifier path, final DOMDataTreeCommitCohort cohort) {
         return datastore.registerCommitCohort(path, cohort);
     }
 
@@ -94,16 +104,9 @@ public final class OSGiDOMStore
         return datastore.newReadWriteTransaction();
     }
 
-    @Activate
-    void activate(final Map<String, ?> properties) {
-        datastoreType = (LogicalDatastoreType) verifyNotNull(properties.get(DATASTORE_TYPE_PROP));
-        datastore = (AbstractDataStore) verifyNotNull(properties.get(DATASTORE_INST_PROP));
-        LOG.info("Datastore service type {} activated", datastoreType);
-    }
-
-    @Deactivate
-    void deactivate() {
-        datastore = null;
-        LOG.info("Datastore service type {} deactivated", datastoreType);
+    @Override
+    public Registration registerLegacyTreeChangeListener(final YangInstanceIdentifier treeId,
+            final DOMDataTreeChangeListener listener) {
+        return datastore.registerLegacyTreeChangeListener(treeId, listener);
     }
 }