public class VanillaHBaseConnection extends Object implements HBaseConnection
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.conf.Configuration |
conf |
protected org.apache.hadoop.hbase.client.HConnection |
conn |
protected Map<String,org.apache.hadoop.hbase.client.HTableInterface> |
tables |
Modifier and Type | Method and Description |
---|---|
void |
beginTransaction()
Begin a transaction.
|
protected org.apache.hadoop.hbase.HTableDescriptor |
buildDescriptor(String tableName,
List<byte[]> columnFamilies) |
void |
close()
Close the connection.
|
void |
commitTransaction()
Commit a transaction
|
void |
connect()
Connects to HBase.
|
void |
createHBaseTable(String tableName,
List<byte[]> columnFamilies)
Create a new table
|
void |
flush(org.apache.hadoop.hbase.client.HTableInterface htab)
Flush commits.
|
org.apache.hadoop.conf.Configuration |
getConf() |
org.apache.hadoop.hbase.client.HTableInterface |
getHBaseTable(String tableName)
Fetch an existing HBase table.
|
org.apache.hadoop.hbase.client.HTableInterface |
getHBaseTable(String tableName,
boolean force)
Fetch an existing HBase table and force a connection to it.
|
void |
rollbackTransaction()
Rollback a transaction
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
protected org.apache.hadoop.hbase.client.HConnection conn
protected org.apache.hadoop.conf.Configuration conf
public void connect() throws IOException
HBaseConnection
Configurable.setConf(org.apache.hadoop.conf.Configuration)
has been called.connect
in interface HBaseConnection
IOException
public void close() throws IOException
HBaseConnection
close
in interface HBaseConnection
IOException
public void beginTransaction() throws IOException
HBaseConnection
beginTransaction
in interface HBaseConnection
IOException
public void commitTransaction() throws IOException
HBaseConnection
commitTransaction
in interface HBaseConnection
IOException
- indicates the commit has failedpublic void rollbackTransaction() throws IOException
HBaseConnection
rollbackTransaction
in interface HBaseConnection
IOException
public void flush(org.apache.hadoop.hbase.client.HTableInterface htab) throws IOException
HBaseConnection
flush
in interface HBaseConnection
htab
- Table to flushIOException
public void createHBaseTable(String tableName, List<byte[]> columnFamilies) throws IOException
HBaseConnection
createHBaseTable
in interface HBaseConnection
tableName
- name of the tablecolumnFamilies
- name of the column families in the tableIOException
protected org.apache.hadoop.hbase.HTableDescriptor buildDescriptor(String tableName, List<byte[]> columnFamilies) throws IOException
IOException
public org.apache.hadoop.hbase.client.HTableInterface getHBaseTable(String tableName) throws IOException
HBaseConnection
getHBaseTable
in interface HBaseConnection
tableName
- name of the tableIOException
public org.apache.hadoop.hbase.client.HTableInterface getHBaseTable(String tableName, boolean force) throws IOException
HBaseConnection
getHBaseTable
in interface HBaseConnection
tableName
- name of the tableforce
- if true, force a connection by fetching a non-existant keyIOException
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
Copyright © 2016 The Apache Software Foundation. All rights reserved.