org.springframework.data.hadoop.hbase
Class HbaseUtils

java.lang.Object
  extended by org.springframework.data.hadoop.hbase.HbaseUtils

public class HbaseUtils
extends Object

Helper class featuring methods for Hbase table handling and exception translation.

Author:
Costin Leau

Constructor Summary
HbaseUtils()
           
 
Method Summary
static DataAccessException convertHbaseException(Exception ex)
          Converts the given (Hbase) exception to an appropriate exception from org.springframework.dao hierarchy.
static HTable getHTable(Configuration configuration, String tableName)
          Retrieves an Hbase table instance identified by its name.
static HTable getHTable(HTableInterfaceFactory tableFactory, Charset charset, Configuration configuration, String tableName)
          Retrieves an Hbase table instance identified by its name and charset using the given table factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HbaseUtils

public HbaseUtils()
Method Detail

convertHbaseException

public static DataAccessException convertHbaseException(Exception ex)
Converts the given (Hbase) exception to an appropriate exception from org.springframework.dao hierarchy.

Parameters:
ex - Hbase exception that occurred
Returns:
the corresponding DataAccessException instance

getHTable

public static HTable getHTable(Configuration configuration,
                               String tableName)
Retrieves an Hbase table instance identified by its name.

Parameters:
configuration - Hbase configuration object
tableName - table name
Returns:
table instance

getHTable

public static HTable getHTable(HTableInterfaceFactory tableFactory,
                               Charset charset,
                               Configuration configuration,
                               String tableName)
Retrieves an Hbase table instance identified by its name and charset using the given table factory.

Parameters:
tableFactory - table factory (may be null)
charset - name charset (may be null)
configuration - Hbase configuration object
tableName - table name
Returns:
table instance