001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.ipc;
019
020import java.io.IOException;
021import java.util.Map;
022import org.apache.hadoop.hbase.CellScanner;
023import org.apache.hadoop.hbase.TableName;
024import org.apache.yetus.audience.InterfaceAudience;
025
026import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
027
028/**
029 * Simple delegating controller for use with the {@link RpcControllerFactory} to help override
030 * standard behavior of a {@link HBaseRpcController}. Used testing.
031 */
032@InterfaceAudience.Private
033public class DelegatingHBaseRpcController implements HBaseRpcController {
034
035  private final HBaseRpcController delegate;
036
037  public DelegatingHBaseRpcController(HBaseRpcController delegate) {
038    this.delegate = delegate;
039  }
040
041  @Override
042  public void reset() {
043    delegate.reset();
044  }
045
046  @Override
047  public boolean failed() {
048    return delegate.failed();
049  }
050
051  @Override
052  public String errorText() {
053    return delegate.errorText();
054  }
055
056  @Override
057  public void startCancel() {
058    delegate.startCancel();
059  }
060
061  @Override
062  public void setFailed(String reason) {
063    delegate.setFailed(reason);
064  }
065
066  @Override
067  public boolean isCanceled() {
068    return delegate.isCanceled();
069  }
070
071  @Override
072  public void notifyOnCancel(RpcCallback<Object> callback) {
073    delegate.notifyOnCancel(callback);
074  }
075
076  @Override
077  public CellScanner cellScanner() {
078    return delegate.cellScanner();
079  }
080
081  @Override
082  public void setCellScanner(CellScanner cellScanner) {
083    delegate.setCellScanner(cellScanner);
084  }
085
086  @Override
087  public void setPriority(int priority) {
088    delegate.setPriority(priority);
089  }
090
091  @Override
092  public void setPriority(TableName tn) {
093    delegate.setPriority(tn);
094  }
095
096  @Override
097  public int getPriority() {
098    return delegate.getPriority();
099  }
100
101  @Override
102  public int getCallTimeout() {
103    return delegate.getCallTimeout();
104  }
105
106  @Override
107  public void setCallTimeout(int callTimeout) {
108    delegate.setCallTimeout(callTimeout);
109  }
110
111  @Override
112  public boolean hasCallTimeout() {
113    return delegate.hasCallTimeout();
114  }
115
116  @Override
117  public Map<String, byte[]> getRequestAttributes() {
118    return delegate.getRequestAttributes();
119  }
120
121  @Override
122  public void setRequestAttributes(Map<String, byte[]> requestAttributes) {
123    delegate.setRequestAttributes(requestAttributes);
124  }
125
126  @Override
127  public void setFailed(IOException e) {
128    delegate.setFailed(e);
129  }
130
131  @Override
132  public IOException getFailed() {
133    return delegate.getFailed();
134  }
135
136  @Override
137  public void setDone(CellScanner cellScanner) {
138    delegate.setDone(cellScanner);
139  }
140
141  @Override
142  public void notifyOnCancel(RpcCallback<Object> callback, CancellationCallback action)
143    throws IOException {
144    delegate.notifyOnCancel(callback, action);
145  }
146
147  @Override
148  public void setTableName(TableName tableName) {
149    delegate.setTableName(tableName);
150  }
151
152  @Override
153  public TableName getTableName() {
154    return delegate.getTableName();
155  }
156}