X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fconfig%2Fdistributed_datastore_provider%2FDistributedOperationalDataStoreProviderModule.java;h=e7589e0d3621547bce0ee8fda1dd4e1280b18dcf;hb=dceb9db7853dabfbd4abdfb3d886a79871097831;hp=e89708f211e1a85a8657190c87c33cc8d57e1f30;hpb=288a70d15252b3c5fafd202fe7935563f05da9c8;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java index e89708f211..e7589e0d36 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java @@ -1,8 +1,17 @@ +/* + * Copyright (c) 2014, 2015 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.distributed_datastore_provider; import org.opendaylight.controller.cluster.datastore.DatastoreContext; -import org.opendaylight.controller.cluster.datastore.DatastoreSnapshotRestore; -import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory; +import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface; +import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.osgi.framework.BundleContext; public class DistributedOperationalDataStoreProviderModule extends @@ -35,14 +44,26 @@ public class DistributedOperationalDataStoreProviderModule extends @Override public java.lang.AutoCloseable createInstance() { + // The DistributedOperDataStore is provided via blueprint so wait for and return it here for + // backwards compatibility + WaitingServiceTracker tracker = WaitingServiceTracker.create( + DistributedDataStoreInterface.class, bundleContext, "(type=distributed-operational)"); + DistributedDataStoreInterface delegate = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES); + return new ForwardingDistributedDataStore(delegate, tracker); + } - OperationalProperties props = getOperationalProperties(); + public static DatastoreContext newDatastoreContext() { + return newDatastoreContext(null); + } + + private static DatastoreContext newDatastoreContext(OperationalProperties inProps) { + OperationalProperties props = inProps; if(props == null) { props = new OperationalProperties(); } - DatastoreContext datastoreContext = DatastoreContext.newBuilder() - .dataStoreType("operational") + return DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL) .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue()) .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue()) .maxShardDataChangeListenerQueueSize(props.getMaxShardDataChangeListenerQueueSize().getValue().intValue()) @@ -72,10 +93,6 @@ public class DistributedOperationalDataStoreProviderModule extends .customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation()) .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue()) .build(); - - return DistributedDataStoreFactory.createInstance(getOperationalSchemaServiceDependency(), - datastoreContext, DatastoreSnapshotRestore.instance().getAndRemove(datastoreContext.getDataStoreType()), - getOperationalActorSystemProviderDependency().getActorSystem(), bundleContext); } public void setBundleContext(BundleContext bundleContext) {