View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.replication;
20  
21  import java.io.IOException;
22  import java.util.UUID;
23  import java.util.concurrent.atomic.AtomicBoolean;
24  
25  import org.apache.hadoop.conf.Configuration;
26  import org.apache.hadoop.fs.FileSystem;
27  import org.apache.hadoop.fs.Path;
28  import org.apache.hadoop.hbase.Stoppable;
29  import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceInterface;
30  import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager;
31  
32  /**
33   * Source that does nothing at all, helpful to test ReplicationSourceManager
34   */
35  public class ReplicationSourceDummy implements ReplicationSourceInterface {
36  
37    ReplicationSourceManager manager;
38    String peerClusterId;
39    Path currentPath;
40  
41    @Override
42    public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
43        ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
44        UUID clusterId) throws IOException {
45  
46      this.manager = manager;
47      this.peerClusterId = peerClusterId;
48    }
49  
50    @Override
51    public void enqueueLog(Path log) {
52      this.currentPath = log;
53    }
54  
55    @Override
56    public Path getCurrentPath() {
57      return this.currentPath;
58    }
59  
60    @Override
61    public void startup() {
62  
63    }
64  
65    @Override
66    public void terminate(String reason) {
67  
68    }
69  
70    @Override
71    public void terminate(String reason, Exception e) {
72  
73    }
74  
75    @Override
76    public String getPeerClusterZnode() {
77      return peerClusterId;
78    }
79  
80    @Override
81    public String getPeerClusterId() {
82      return peerClusterId;
83    }
84  
85    @Override
86    public String getStats() {
87      return "";
88    }
89  }