public class HBaseFacade extends Object
Constructor and Description |
---|
HBaseFacade()
Create a new HBaseService.
|
HBaseFacade(Map<String,String> props)
Create a new HBaseService.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(String tableName,
String key,
Map<String,Map<String,byte[]>> dataMap)
Adds a row to a HBase table.
|
void |
createTable(String name,
List<String> columnFamilies)
Creates a new HBase table.
|
void |
createTable(String name,
List<String> columnFamilies,
int maxVersions)
Creates a new HBase table.
|
void |
deleteTable(String name)
Deletes a HBase table.
|
Map<String,Map<String,byte[]>> |
readRow(String tableName,
String key,
List<String> columnFamilies)
Reads the values in a row from a table.
|
Map<String,Map<String,Map<String,byte[]>>> |
readRows(String tableName,
String keyPrefix,
long ts,
String columnFamily,
String qualifier)
Reads the values from multiple rows from a table, using a key prefix and a timestamp.
|
boolean |
removeRow(String tableName,
String key)
Removes a row from a table.
|
void |
removeRows(String tableName,
Set<Object> keys)
Removes rows from a table.
|
Map<String,byte[]> |
scan(String tableName,
int numEntries,
String columnFamily,
String qualifier)
Scans an entire table, returning the values from the given column family and field for each
row.
|
Map<String,byte[]> |
scan(String tableName,
String columnFamily,
String qualifier)
Scans an entire table, returning the values from the given column family and field for each
row.
|
Set<Object> |
scanForKeys(String tableName)
Returns a set of all unique keys for a given table.
|
boolean |
tableExists(String name)
Checks to see if a table exists.
|
public void createTable(String name, List<String> columnFamilies) throws HBaseException
name
- the name of the tablecolumnFamilies
- a list of column family names to useHBaseException
public void createTable(String name, List<String> columnFamilies, int maxVersions) throws HBaseException
name
- the name of the tablecolumnFamilies
- a list of column family names to createmaxVersions
- the max number of versions to maintain for the column familiesHBaseException
public void deleteTable(String name) throws HBaseException
name
- the name of the tableHBaseException
public boolean tableExists(String name) throws HBaseException
name
- the name of the tableHBaseException
public void addRow(String tableName, String key, Map<String,Map<String,byte[]>> dataMap) throws HBaseException
tableName
- the table to add tokey
- the unique key for the rowdataMap
- the data to add, where the outer map's keys are column family name and values are
maps that contain the fields and values to add into that column family.HBaseException
public Map<String,Map<String,byte[]>> readRow(String tableName, String key, List<String> columnFamilies) throws HBaseException
tableName
- the table to read fromkey
- the key for the rowcolumnFamilies
- which column families to returnHBaseException
public Map<String,Map<String,Map<String,byte[]>>> readRows(String tableName, String keyPrefix, long ts, String columnFamily, String qualifier) throws HBaseException
tableName
- the table to read fromkeyPrefix
- the key prefix to use for the queryts
- timestamp before which rows should be returnedcolumnFamily
- which column family to returnqualifier
- which qualifier (ie field) to returnHBaseException
public boolean removeRow(String tableName, String key) throws HBaseException
tableName
- the table to remove fromkey
- the key for the row to removeHBaseException
public void removeRows(String tableName, Set<Object> keys) throws HBaseException
tableName
- the table to remove fromkeys
- a list of keys for the row to removeHBaseException
public Map<String,byte[]> scan(String tableName, String columnFamily, String qualifier) throws HBaseException
tableName
- the table to scancolumnFamily
- the column family of the field to returnqualifier
- the field to returnHBaseException
public Map<String,byte[]> scan(String tableName, int numEntries, String columnFamily, String qualifier) throws HBaseException
tableName
- the table to scannumEntries
- the max number of entries to return; if < 0, defaults to Integer.MAX_VALUEcolumnFamily
- the column family of the field to returnqualifier
- the field to returnHBaseException
public Set<Object> scanForKeys(String tableName) throws HBaseException
tableName
- the table to return the keys forHBaseException
Copyright © 2017 JBoss, a division of Red Hat. All Rights Reserved.