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 javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
14 import org.opendaylight.controller.cluster.datastore.Shard;
15 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
18 * A message sent to the ShardManager to dynamically create a new shard.
20 * @author Thomas Pantelis
22 public class CreateShard {
23 private final ModuleShardConfiguration moduleShardConfig;
24 private final Shard.AbstractBuilder<?, ?> shardBuilder;
25 private final DatastoreContext datastoreContext;
30 * @param moduleShardConfig the configuration of the new shard.
31 * @param shardBuilder used to obtain the Props for creating the shard actor instance.
32 * @param datastoreContext the DatastoreContext for the new shard. If null, the default is used.
34 public CreateShard(@Nonnull ModuleShardConfiguration moduleShardConfig,
35 @Nonnull Shard.AbstractBuilder<?, ?> shardBuilder, @Nullable DatastoreContext datastoreContext) {
36 this.moduleShardConfig = Preconditions.checkNotNull(moduleShardConfig);
37 this.shardBuilder = Preconditions.checkNotNull(shardBuilder);
38 this.datastoreContext = datastoreContext;
42 public ModuleShardConfiguration getModuleShardConfig() {
43 return moduleShardConfig;
47 public Shard.AbstractBuilder<?, ?> getShardBuilder() {
52 public DatastoreContext getDatastoreContext() {
53 return datastoreContext;
57 public String toString() {
58 return "CreateShard [moduleShardConfig=" + moduleShardConfig + ", shardPropsCreator=" + shardBuilder + "]";