1   /*
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.replication;
21  
22  import org.apache.hadoop.conf.Configuration;
23  import org.apache.hadoop.fs.FileSystem;
24  import org.apache.hadoop.fs.Path;
25  import org.apache.hadoop.hbase.Stoppable;
26  import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceInterface;
27  import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager;
28  
29  import java.io.IOException;
30  import java.util.concurrent.atomic.AtomicBoolean;
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,
43                     ReplicationSourceManager manager, Stoppable stopper,
44                     AtomicBoolean replicating, String peerClusterId)
45        throws IOException {
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 void setSourceEnabled(boolean status) {
87  
88    }
89  
90  }