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 static java.util.Objects.requireNonNull;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
15 import org.opendaylight.controller.cluster.datastore.Shard;
16 import org.opendaylight.controller.cluster.datastore.Shard.AbstractBuilder;
17 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
20 * A message sent to the ShardManager to dynamically create a new shard.
22 * @author Thomas Pantelis
24 public class CreateShard {
25 private final ModuleShardConfiguration moduleShardConfig;
26 private final Shard.AbstractBuilder<?, ?> shardBuilder;
27 private final DatastoreContext datastoreContext;
32 * @param moduleShardConfig the configuration of the new shard.
33 * @param shardBuilder 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 ModuleShardConfiguration moduleShardConfig, @NonNull AbstractBuilder<?, ?> shardBuilder,
37 @Nullable DatastoreContext datastoreContext) {
38 this.moduleShardConfig = requireNonNull(moduleShardConfig);
39 this.shardBuilder = requireNonNull(shardBuilder);
40 this.datastoreContext = datastoreContext;
43 public @NonNull ModuleShardConfiguration getModuleShardConfig() {
44 return moduleShardConfig;
47 public @NonNull AbstractBuilder<?, ?> getShardBuilder() {
51 public @Nullable DatastoreContext getDatastoreContext() {
52 return datastoreContext;
56 public String toString() {
57 return "CreateShard [moduleShardConfig=" + moduleShardConfig + ", shardPropsCreator=" + shardBuilder + "]";