View Javadoc

1   /*
2    * Copyright (c) 2011.  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  
21  package org.apache.hadoop.hbase.hbql.client;
22  
23  import org.apache.hadoop.conf.Configuration;
24  import org.apache.hadoop.hbase.HTableDescriptor;
25  
26  import java.util.List;
27  import java.util.Set;
28  
29  public interface HConnection {
30  
31      Configuration getConfiguration();
32  
33      // org.apache.hadoop.hbase.client.HTable newHTable(String tableName) throws HBqlException;
34  
35      Set<String> getFamilyNames(String tableName) throws HBqlException;
36  
37      void close();
38  
39      boolean isClosed() throws HBqlException;
40  
41      boolean isPooled();
42  
43      // Table Routines
44      boolean tableExists(String tableName) throws HBqlException;
45  
46      HTableDescriptor getHTableDescriptor(String tableName) throws HBqlException;
47  
48      boolean tableEnabled(String tableName) throws HBqlException;
49  
50      void dropTable(String tableName) throws HBqlException;
51  
52      void disableTable(String tableName) throws HBqlException;
53  
54      void enableTable(String tableName) throws HBqlException;
55  
56      Set<String> getTableNames() throws HBqlException;
57  
58      // Index Routines
59      boolean indexExistsForMapping(final String indexName, final String mappingName) throws HBqlException;
60  
61      void dropIndexForMapping(final String indexName, final String mappingName) throws HBqlException;
62  
63      boolean indexExistsForTable(final String indexName, final String tableName) throws HBqlException;
64  
65      void dropIndexForTable(final String tableName, final String indexName) throws HBqlException;
66  
67      // Statement Routines
68      HStatement createStatement() throws HBqlException;
69  
70      HPreparedStatement prepareStatement(String str) throws HBqlException;
71  
72      // Execute Routines
73      ExecutionResults execute(String sql) throws HBqlException;
74  
75      HResultSet<HRecord> executeQuery(String sql) throws HBqlException;
76  
77      <T> HResultSet<T> executeQuery(String sql, Class clazz) throws HBqlException;
78  
79      List<HRecord> executeQueryAndFetch(String sql) throws HBqlException;
80  
81      <T> List<T> executeQueryAndFetch(String sql, Class clazz) throws HBqlException;
82  
83      ExecutionResults executeUpdate(String sql) throws HBqlException;
84  
85      // Mapping Routines
86      HMapping getMapping(String mappingName) throws HBqlException;
87  
88      boolean mappingExists(String mappingName) throws HBqlException;
89  
90      boolean dropMapping(String mappingName) throws HBqlException;
91  
92      Set<HMapping> getAllMappings() throws HBqlException;
93  
94      // QueryExecutor routines
95      void setQueryExecutorPoolName(String name);
96  
97      String getQueryExecutorPoolName();
98  
99      // AsyncExecutor routines
100     void setAsyncExecutorName(String name);
101 
102     String getAsyncExecutorName();
103 
104     <T> HBatch<T> newHBatch();
105 }