1 /** 2 * Copyright 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.client; 21 22 import java.io.IOException; 23 24 import org.apache.hadoop.hbase.classification.InterfaceAudience; 25 import org.apache.hadoop.conf.Configuration; 26 27 /** 28 * This class makes it convenient for one to execute a command in the context 29 * of a {@link HConnection} instance based on the given {@link Configuration}. 30 * 31 * <p> 32 * If you find yourself wanting to use a {@link HConnection} for a relatively 33 * short duration of time, and do not want to deal with the hassle of creating 34 * and cleaning up that resource, then you should consider using this 35 * convenience class. 36 * 37 * @param <T> 38 * the return type of the {@link HConnectable#connect(HConnection)} 39 * method. 40 */ 41 @InterfaceAudience.Private 42 public abstract class HConnectable<T> { 43 public Configuration conf; 44 45 protected HConnectable(Configuration conf) { 46 this.conf = conf; 47 } 48 49 public abstract T connect(HConnection connection) throws IOException; 50 }