1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.replication;
20
21 import java.util.Collection;
22 import java.util.HashMap;
23 import java.util.List;
24 import java.util.Map;
25 import java.util.TreeMap;
26
27 import org.apache.hadoop.hbase.TableName;
28 import org.apache.hadoop.hbase.classification.InterfaceAudience;
29 import org.apache.hadoop.hbase.classification.InterfaceStability;
30 import org.apache.hadoop.hbase.util.Bytes;
31
32
33
34
35 @InterfaceAudience.Public
36 @InterfaceStability.Evolving
37 public class ReplicationPeerConfig {
38
39 private String clusterKey;
40 private String replicationEndpointImpl;
41 private final Map<byte[], byte[]> peerData;
42 private final Map<String, String> configuration;
43 private Map<TableName, ? extends Collection<String>> tableCFsMap = null;
44 private long bandwidth = 0;
45
46 public ReplicationPeerConfig() {
47 this.peerData = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
48 this.configuration = new HashMap<String, String>(0);
49 }
50
51
52
53
54
55 public ReplicationPeerConfig setClusterKey(String clusterKey) {
56 this.clusterKey = clusterKey;
57 return this;
58 }
59
60
61
62
63
64 public ReplicationPeerConfig setReplicationEndpointImpl(String replicationEndpointImpl) {
65 this.replicationEndpointImpl = replicationEndpointImpl;
66 return this;
67 }
68
69 public String getClusterKey() {
70 return clusterKey;
71 }
72
73 public String getReplicationEndpointImpl() {
74 return replicationEndpointImpl;
75 }
76
77 public Map<byte[], byte[]> getPeerData() {
78 return peerData;
79 }
80
81 public Map<String, String> getConfiguration() {
82 return configuration;
83 }
84
85 public Map<TableName, List<String>> getTableCFsMap() {
86 return (Map<TableName, List<String>>) tableCFsMap;
87 }
88
89 public void setTableCFsMap(Map<TableName, ? extends Collection<String>> tableCFsMap) {
90 this.tableCFsMap = tableCFsMap;
91 }
92
93 public long getBandwidth() {
94 return this.bandwidth;
95 }
96
97 public ReplicationPeerConfig setBandwidth(long bandwidth) {
98 this.bandwidth = bandwidth;
99 return this;
100 }
101
102 @Override
103 public String toString() {
104 StringBuilder builder = new StringBuilder("clusterKey=").append(clusterKey).append(",");
105 builder.append("replicationEndpointImpl=").append(replicationEndpointImpl);
106 if (tableCFsMap != null) {
107 builder.append(tableCFsMap.toString()).append(",");
108 }
109 builder.append("bandwidth=").append(bandwidth);
110 return builder.toString();
111 }
112 }