2 * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import com.google.common.base.Preconditions;
11 import java.util.Collection;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
15 import org.opendaylight.controller.cluster.datastore.ShardPropsCreator;
18 * A message sent to the ShardManager to dynamically create a new shard.
20 * @author Thomas Pantelis
22 public class CreateShard {
23 private final String shardName;
24 private final Collection<String> memberNames;
25 private final ShardPropsCreator shardPropsCreator;
26 private final DatastoreContext datastoreContext;
31 * @param shardName the name of the new shard.
32 * @param memberNames the names of all the member replicas.
33 * @param shardPropsCreator used to obtain the Props for creating the shard actor instance.
34 * @param datastoreContext the DatastoreContext for the new shard. If null, the default is used.
36 public CreateShard(@Nonnull String shardName, @Nonnull Collection<String> memberNames,
37 @Nonnull ShardPropsCreator shardPropsCreator, @Nullable DatastoreContext datastoreContext) {
38 this.shardName = Preconditions.checkNotNull(shardName);
39 this.memberNames = Preconditions.checkNotNull(memberNames);
40 this.shardPropsCreator = Preconditions.checkNotNull(shardPropsCreator);
41 this.datastoreContext = datastoreContext;
44 @Nonnull public String getShardName() {
48 @Nonnull public Collection<String> getMemberNames() {
52 @Nonnull public ShardPropsCreator getShardPropsCreator() {
53 return shardPropsCreator;
56 @Nullable public DatastoreContext getDatastoreContext() {
57 return datastoreContext;
61 public String toString() {
62 StringBuilder builder = new StringBuilder();
63 builder.append("CreateShard [shardName=").append(shardName).append(", memberNames=").append(memberNames)
65 return builder.toString();