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.io.IOException;
22 import java.util.ArrayList;
23
24 import org.apache.hadoop.hbase.classification.InterfaceAudience;
25 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
26 import com.google.common.collect.Lists;
27 import com.google.common.util.concurrent.AbstractService;
28
29
30
31
32
33
34 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION)
35 public abstract class BaseReplicationEndpoint extends AbstractService
36 implements ReplicationEndpoint {
37
38 protected Context ctx;
39
40 @Override
41 public void init(Context context) throws IOException {
42 this.ctx = context;
43 }
44
45
46 @Override
47 public WALEntryFilter getWALEntryfilter() {
48 ArrayList<WALEntryFilter> filters = Lists.newArrayList();
49 WALEntryFilter scopeFilter = getScopeWALEntryFilter();
50 if (scopeFilter != null) {
51 filters.add(scopeFilter);
52 }
53 WALEntryFilter tableCfFilter = getTableCfWALEntryFilter();
54 if (tableCfFilter != null) {
55 filters.add(tableCfFilter);
56 }
57 return filters.isEmpty() ? null : new ChainWALEntryFilter(filters);
58 }
59
60
61
62 protected WALEntryFilter getScopeWALEntryFilter() {
63 return new ScopeWALEntryFilter();
64 }
65
66
67
68 protected WALEntryFilter getTableCfWALEntryFilter() {
69 return new TableCfWALEntryFilter(ctx.getReplicationPeer());
70 }
71
72 @Override
73 public boolean canReplicateToSameCluster() {
74 return false;
75 }
76
77 }