Depend on odl-mdsal-common
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / config / yang / config / distributed_datastore_provider / DistributedConfigDataStoreProviderModule.java
index e30b324a46aaaf0759e80ba12fb2abb7e48eb157..79b276d8be5049600172416567c724152be5e073 100644 (file)
@@ -10,23 +10,26 @@ package org.opendaylight.controller.config.yang.config.distributed_datastore_pro
 
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
+import org.opendaylight.controller.cluster.datastore.compat.LegacyDOMStoreAdapter;
 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.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.osgi.framework.BundleContext;
 
+@Deprecated
 public class DistributedConfigDataStoreProviderModule extends AbstractDistributedConfigDataStoreProviderModule {
     private BundleContext bundleContext;
 
     public DistributedConfigDataStoreProviderModule(
-        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+        final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public DistributedConfigDataStoreProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver,
-            DistributedConfigDataStoreProviderModule oldModule, AutoCloseable oldInstance) {
+    public DistributedConfigDataStoreProviderModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver, final DistributedConfigDataStoreProviderModule oldModule,
+            final AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
@@ -36,7 +39,7 @@ public class DistributedConfigDataStoreProviderModule extends AbstractDistribute
     }
 
     @Override
-    public boolean canReuseInstance(AbstractDistributedConfigDataStoreProviderModule oldModule) {
+    public boolean canReuseInstance(final AbstractDistributedConfigDataStoreProviderModule oldModule) {
         return true;
     }
 
@@ -47,14 +50,19 @@ public class DistributedConfigDataStoreProviderModule extends AbstractDistribute
         WaitingServiceTracker<DistributedDataStoreInterface> tracker = WaitingServiceTracker.create(
                 DistributedDataStoreInterface.class, bundleContext, "(type=distributed-config)");
         DistributedDataStoreInterface delegate = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-        return new ForwardingDistributedDataStore(delegate, tracker);
+        return new LegacyDOMStoreAdapter(delegate) {
+            @Override
+            public void close() {
+                tracker.close();
+            }
+        };
     }
 
     public static DatastoreContext newDatastoreContext() {
         return newDatastoreContext(null);
     }
 
-    private static DatastoreContext newDatastoreContext(ConfigProperties inProps) {
+    private static DatastoreContext newDatastoreContext(final ConfigProperties inProps) {
         ConfigProperties props = inProps;
         if (props == null) {
             props = new ConfigProperties();
@@ -62,6 +70,9 @@ public class DistributedConfigDataStoreProviderModule extends AbstractDistribute
 
         return DatastoreContext.newBuilder()
                 .logicalStoreType(LogicalDatastoreType.CONFIGURATION)
+                .tempFileDirectory("./data")
+                .fileBackedStreamingThresholdInMegabytes(props.getFileBackedStreamingThresholdInMegabytes()
+                        .getValue().intValue())
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
                 .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize()
                         .getValue().intValue())
@@ -92,11 +103,16 @@ public class DistributedConfigDataStoreProviderModule extends AbstractDistribute
                         props.getShardCommitQueueExpiryTimeoutInSeconds().getValue().intValue())
                 .transactionDebugContextEnabled(props.getTransactionDebugContextEnabled())
                 .customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
-                .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
+                .maximumMessageSliceSize(props.getMaximumMessageSliceSize().getValue().intValue())
+                .useTellBasedProtocol(props.getUseTellBasedProtocol())
+                .syncIndexThreshold(props.getSyncIndexThreshold().getValue())
+                .backendAlivenessTimerIntervalInSeconds(props.getBackendAlivenessTimerIntervalInSeconds().getValue())
+                .frontendRequestTimeoutInSeconds(props.getFrontendRequestTimeoutInSeconds().getValue())
+                .frontendNoProgressTimeoutInSeconds(props.getFrontendNoProgressTimeoutInSeconds().getValue())
                 .build();
     }
 
-    public void setBundleContext(BundleContext bundleContext) {
+    public void setBundleContext(final BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }
 }