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 static java.util.Objects.requireNonNull;
12 import java.util.Collection;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16 import org.opendaylight.yangtools.yang.common.XMLNamespace;
19 * Encapsulates information for adding a new module shard configuration.
21 * @author Thomas Pantelis
23 public class ModuleShardConfiguration {
24 private final XMLNamespace namespace;
25 private final String moduleName;
26 private final String shardName;
27 private final String shardStrategyName;
28 private final Collection<MemberName> shardMemberNames;
31 * Constructs a new instance.
33 * @param namespace the name space of the module.
34 * @param moduleName the name of the module.
35 * @param shardName the name of the shard.
36 * @param shardStrategyName the name of the sharding strategy (eg "module"). If null the default strategy
38 * @param shardMemberNames the names of the shard's member replicas.
40 public ModuleShardConfiguration(final @NonNull XMLNamespace namespace, final @NonNull String moduleName,
41 final @NonNull String shardName, final @Nullable String shardStrategyName,
42 final @NonNull Collection<MemberName> shardMemberNames) {
43 this.namespace = requireNonNull(namespace, "nameSpace should not be null");
44 this.moduleName = requireNonNull(moduleName, "moduleName should not be null");
45 this.shardName = requireNonNull(shardName, "shardName should not be null");
46 this.shardStrategyName = shardStrategyName;
47 this.shardMemberNames = requireNonNull(shardMemberNames, "shardMemberNames");
50 public XMLNamespace getNamespace() {
54 public String getModuleName() {
58 public String getShardName() {
62 public String getShardStrategyName() {
63 return shardStrategyName;
66 public Collection<MemberName> getShardMemberNames() {
67 return shardMemberNames;
71 public String toString() {
72 return "ModuleShardConfiguration [namespace=" + namespace + ", moduleName=" + moduleName + ", shardName="
73 + shardName + ", shardMemberNames=" + shardMemberNames + ", shardStrategyName=" + shardStrategyName