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