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.config;
10 import com.google.common.base.Preconditions;
12 import java.util.Collection;
13 import javax.annotation.Nonnull;
14 import javax.annotation.Nullable;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
18 * Encapsulates information for adding a new module shard configuration.
20 * @author Thomas Pantelis
22 public class ModuleShardConfiguration {
23 private final URI namespace;
24 private final String moduleName;
25 private final String shardName;
26 private final String shardStrategyName;
27 private final Collection<MemberName> shardMemberNames;
30 * Constructs a new instance.
32 * @param namespace the name space of the module.
33 * @param moduleName the name of the module.
34 * @param shardName the name of the shard.
35 * @param shardStrategyName the name of the sharding strategy (eg "module"). If null the default strategy
37 * @param shardMemberNames the names of the shard's member replicas.
39 public ModuleShardConfiguration(@Nonnull URI namespace, @Nonnull String moduleName, @Nonnull String shardName,
40 @Nullable String shardStrategyName, @Nonnull Collection<MemberName> shardMemberNames) {
41 this.namespace = Preconditions.checkNotNull(namespace, "nameSpace should not be null");
42 this.moduleName = Preconditions.checkNotNull(moduleName, "moduleName should not be null");
43 this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
44 this.shardStrategyName = shardStrategyName;
45 this.shardMemberNames = Preconditions.checkNotNull(shardMemberNames, "shardMemberNames");
48 public URI getNamespace() {
52 public String getModuleName() {
56 public String getShardName() {
60 public String getShardStrategyName() {
61 return shardStrategyName;
64 public Collection<MemberName> getShardMemberNames() {
65 return shardMemberNames;
69 public String toString() {
70 return "ModuleShardConfiguration [namespace=" + namespace + ", moduleName=" + moduleName + ", shardName="
71 + shardName + ", shardMemberNames=" + shardMemberNames + ", shardStrategyName=" + shardStrategyName