X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FOSGiDOMStore.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FOSGiDOMStore.java;h=43e9c3e6fd75326594c8ebfa3c4d6868e464e909;hp=d53a8bb4683bf81672fb4beb548cf60bb3a54829;hb=7526de25301597d670657400b541b10455311fbe;hpb=9917911b1a492b5f9fbeef1591569f7fc4a80f68 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OSGiDOMStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OSGiDOMStore.java index d53a8bb468..43e9c3e6fd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OSGiDOMStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OSGiDOMStore.java @@ -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 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 ListenerRegistration 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 ListenerRegistration registerTreeChangeListener( - final YangInstanceIdentifier treeId, final L listener) { + public Registration registerTreeChangeListener(final YangInstanceIdentifier treeId, + final DOMDataTreeChangeListener listener) { return datastore.registerTreeChangeListener(treeId, listener); } @Override - public DOMDataTreeCommitCohortRegistration 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 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); } }