Add blueprint wiring to sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / config / yang / config / distributed_datastore_provider / DistributedConfigDataStoreProviderModule.java
index 4d20b6f4f46fc31967feeccdf28df533a2e071c6..daa4c14cb2afdf995ce4753707074bd93bd364ad 100644 (file)
@@ -44,12 +44,24 @@ public class DistributedConfigDataStoreProviderModule extends
 
     @Override
     public java.lang.AutoCloseable createInstance() {
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        ConfigProperties props = getConfigProperties();
+        DatastoreContext datastoreContext = newDatastoreContext(getConfigProperties());
+
+        return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
+                datastoreContext, DatastoreSnapshotRestore.instance(),
+                getConfigActorSystemProviderDependency(), bundleContext);
+    }
+
+    public static DatastoreContext newDatastoreContext() {
+        return newDatastoreContext(null);
+    }
+
+    private static DatastoreContext newDatastoreContext(ConfigProperties inProps) {
+        ConfigProperties props = inProps;
         if(props == null) {
             props = new ConfigProperties();
         }
 
         if(props == null) {
             props = new ConfigProperties();
         }
 
-        DatastoreContext datastoreContext = DatastoreContext.newBuilder()
+        return DatastoreContext.newBuilder()
                 .logicalStoreType(LogicalDatastoreType.CONFIGURATION)
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
                 .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
                 .logicalStoreType(LogicalDatastoreType.CONFIGURATION)
                 .maxShardDataChangeExecutorPoolSize(props.getMaxShardDataChangeExecutorPoolSize().getValue().intValue())
                 .maxShardDataChangeExecutorQueueSize(props.getMaxShardDataChangeExecutorQueueSize().getValue().intValue())
@@ -80,10 +92,6 @@ public class DistributedConfigDataStoreProviderModule extends
                 .customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
                 .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
                 .build();
                 .customRaftPolicyImplementation(props.getCustomRaftPolicyImplementation())
                 .shardSnapshotChunkSize(props.getShardSnapshotChunkSize().getValue().intValue())
                 .build();
-
-        return DistributedDataStoreFactory.createInstance(getConfigSchemaServiceDependency(),
-                datastoreContext, DatastoreSnapshotRestore.instance().getAndRemove(datastoreContext.getDataStoreName()),
-                getConfigActorSystemProviderDependency().getActorSystem(), bundleContext);
     }
 
     public void setBundleContext(BundleContext bundleContext) {
     }
 
     public void setBundleContext(BundleContext bundleContext) {