Bug 4105: Pass ModuleShardConfiguration with CreateShard
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / CreateShard.java
index 11f3f13ec41f3e17b44ef26a16e60bb22fa6e950..625153799c6a96f105858e4d4c24393087ba6731 100644 (file)
@@ -8,11 +8,11 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import com.google.common.base.Preconditions;
-import java.util.Collection;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.ShardPropsCreator;
+import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
 
 /**
  * A message sent to the ShardManager to dynamically create a new shard.
@@ -20,33 +20,26 @@ import org.opendaylight.controller.cluster.datastore.ShardPropsCreator;
  * @author Thomas Pantelis
  */
 public class CreateShard {
-    private final String shardName;
-    private final Collection<String> memberNames;
+    private final ModuleShardConfiguration moduleShardConfig;
     private final ShardPropsCreator shardPropsCreator;
     private final DatastoreContext datastoreContext;
 
     /**
      * Constructor.
      *
-     * @param shardName the name of the new shard.
-     * @param memberNames the names of all the member replicas.
+     * @param moduleShardConfig the configuration of the new shard.
      * @param shardPropsCreator used to obtain the Props for creating the shard actor instance.
      * @param datastoreContext the DatastoreContext for the new shard. If null, the default is used.
      */
-    public CreateShard(@Nonnull String shardName, @Nonnull Collection<String> memberNames,
+    public CreateShard(@Nonnull ModuleShardConfiguration moduleShardConfig,
             @Nonnull ShardPropsCreator shardPropsCreator, @Nullable DatastoreContext datastoreContext) {
-        this.shardName = Preconditions.checkNotNull(shardName);
-        this.memberNames = Preconditions.checkNotNull(memberNames);
+        this.moduleShardConfig = Preconditions.checkNotNull(moduleShardConfig);
         this.shardPropsCreator = Preconditions.checkNotNull(shardPropsCreator);
         this.datastoreContext = datastoreContext;
     }
 
-    @Nonnull public String getShardName() {
-        return shardName;
-    }
-
-    @Nonnull public Collection<String> getMemberNames() {
-        return memberNames;
+    @Nonnull public ModuleShardConfiguration getModuleShardConfig() {
+        return moduleShardConfig;
     }
 
     @Nonnull public ShardPropsCreator getShardPropsCreator() {
@@ -59,9 +52,6 @@ public class CreateShard {
 
     @Override
     public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("CreateShard [shardName=").append(shardName).append(", memberNames=").append(memberNames)
-                .append("]");
-        return builder.toString();
+        return "CreateShard [moduleShardConfig=" + moduleShardConfig + ", shardPropsCreator=" + shardPropsCreator + "]";
     }
 }