public class

RPCHBaseService

extends Object
implements HBaseService
java.lang.Object
   ↳ org.mule.module.hbase.api.impl.RPCHBaseService

Class Overview

HBaseService that uses the official RPC client to connect with the database.

Important It requires HBase >= 0.90.3-SNAPSHOT because of this two issues:

Summary

Fields
private static final ByteArrayConverter BYTE_ARRAY_CONVERTER
private static final Charset UTF8
private Configuration configuration
private HTableInterfaceFactory hTableInterfaceFactory
Public Constructors
RPCHBaseService()
Public Methods
void addColumn(String name, String someColumnFamilyName, Integer maxVersions, Boolean inMemory, Integer scope)
void addProperties(Map<String, String> properties)
Add the properties to the main configuration.
boolean alive()
boolean checkAndDelete(String tableName, String row, String checkColumnFamilyName, String checkColumnQualifier, Object checkValue, String deleteColumnFamilyName, String deleteColumnQualifier, Long deleteTimestamp, Boolean deleteAllVersions, RowLock deleteLock)
Atomically checks if a row/family/qualifier value matches the expected value.
boolean checkAndPut(String tableName, String row, String checkColumnFamilyName, String checkColumnQualifier, Object checkValue, String putColumnFamilyName, String putColumnQualifier, Long putTimestamp, Object putValue, boolean putWriteToWAL, RowLock putLock)
Atomically checks if a row/family/qualifier value matches the expected value.
HTableInterface createHTable(String tableName)
void createTable(String name)
void delete(String tableName, String row, String columnFamilyName, String columnQualifier, Long timestamp, boolean deleteAllVersions, RowLock lock)
This method can delete a row in several levels depending on the parameters combination.
void deleteColumn(String tableName, String columnFamilyName)
void deleteTable(String name)
void disabeTable(String name)
void enableTable(String name)
boolean exists(String tableName, String row, Integer maxVersions, Long timestamp)
boolean existsColumn(String tableName, String columnFamilyName)
boolean existsTable(String name)
Result get(String tableName, String rowKey, String columnFamilyName, String columnQualifier, Integer maxVersions, Long timestamp)
long increment(String tableName, String row, String columnFamilyName, String columnQualifier, long amount, boolean writeToWAL)
Atomically increments a column value.
boolean isDisabledTable(String name)
RowLock lock(String tableName, String row)
Locks a row in a table.
void modifyColumn(String tableName, String columnFamilyName, Integer maxVersions, Integer blocksize, CompressionType compressionType, CompressionType compactionCompressionType, Boolean inMemory, Integer timeToLive, Boolean blockCacheEnabled, BloomFilterType bloomFilterType, Integer replicationScope, Map<String, String> values)
Changes a column family in a table, all null parameters will be ignored.
void put(String tableName, String row, String columnFamilyName, String columnQualifier, Long timestamp, Object value, boolean writeToWAL, RowLock lock)
Saves the value at the specified cell (row + family:qualifier + timestamp)
Iterable<Result> scan(String tableName, String columnFamilyName, String columnQualifier, Long timestamp, Long maxTimestamp, Integer caching, boolean cacheBlocks, int maxVersions, String startRow, String stopRow, int fetchSize)
Scan across all rows in a table.
void unlock(String tableName, RowLock lock)
Unlock the row
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.mule.module.hbase.api.HBaseService

Fields

private static final ByteArrayConverter BYTE_ARRAY_CONVERTER

private static final Charset UTF8

private Configuration configuration

private HTableInterfaceFactory hTableInterfaceFactory

Public Constructors

public RPCHBaseService ()

Public Methods

public void addColumn (String name, String someColumnFamilyName, Integer maxVersions, Boolean inMemory, Integer scope)

Parameters
name
someColumnFamilyName
maxVersions
inMemory
scope

public void addProperties (Map<String, String> properties)

Add the properties to the main configuration. It overrides old properties if they where already added.

Parameters
properties

public boolean alive ()

See Also

public boolean checkAndDelete (String tableName, String row, String checkColumnFamilyName, String checkColumnQualifier, Object checkValue, String deleteColumnFamilyName, String deleteColumnQualifier, Long deleteTimestamp, Boolean deleteAllVersions, RowLock deleteLock)

Atomically checks if a row/family/qualifier value matches the expected value. If it does, it adds the delete.

Parameters
tableName
row
checkColumnFamilyName
checkColumnQualifier
checkValue
deleteColumnFamilyName
deleteColumnQualifier
deleteTimestamp
deleteAllVersions
deleteLock
Returns
  • true if the new delete was executed, false otherwise
See Also
  • HBaseService#checkAndDelete(String, String, String, String, String, String, String, Long, Boolean, RowLock)

public boolean checkAndPut (String tableName, String row, String checkColumnFamilyName, String checkColumnQualifier, Object checkValue, String putColumnFamilyName, String putColumnQualifier, Long putTimestamp, Object putValue, boolean putWriteToWAL, RowLock putLock)

Atomically checks if a row/family/qualifier value matches the expected value. If it does, it adds the put.

Parameters
tableName
row
checkColumnFamilyName
checkColumnQualifier
checkValue
putColumnFamilyName
putColumnQualifier
putTimestamp
putValue
putWriteToWAL
putLock
Returns
  • true if the new put was executed, false otherwise
See Also
  • HBaseService#checkAndPut(String, String, String, String, String, String, String, Long, String, Boolean, RowLock)

public HTableInterface createHTable (String tableName)

Parameters
tableName

public void createTable (String name)

Parameters
name

public void delete (String tableName, String row, String columnFamilyName, String columnQualifier, Long timestamp, boolean deleteAllVersions, RowLock lock)

This method can delete a row in several levels depending on the parameters combination.

Parameters
tableName
row
columnFamilyName Set null to delete all column families in the specified row
columnQualifier Set null to delete all columns in the specified column family
timestamp Set it to delete all versions of the specified column or column family with a timestamp less than or equal to the specified timestamp
deleteAllVersions Set false to delete only the latest version of the specified column
lock
See Also
  • HBaseService#delete(String, String, String, String, Long, Boolean, RowLock)

public void deleteColumn (String tableName, String columnFamilyName)

Parameters
tableName
columnFamilyName

public void deleteTable (String name)

Parameters
name

public void disabeTable (String name)

Parameters
name

public void enableTable (String name)

Parameters
name

public boolean exists (String tableName, String row, Integer maxVersions, Long timestamp)

Parameters
tableName
row
maxVersions
timestamp

public boolean existsColumn (String tableName, String columnFamilyName)

Parameters
tableName
columnFamilyName

public boolean existsTable (String name)

Parameters
name

public Result get (String tableName, String rowKey, String columnFamilyName, String columnQualifier, Integer maxVersions, Long timestamp)

Parameters
tableName
rowKey
columnFamilyName
columnQualifier
maxVersions
timestamp
See Also
  • HBaseService#get(String, String, Integer, Long)

public long increment (String tableName, String row, String columnFamilyName, String columnQualifier, long amount, boolean writeToWAL)

Atomically increments a column value. If the column value does not yet exist it is initialized to amount and written to the specified column.

Parameters
tableName
row
columnFamilyName
columnQualifier
amount
writeToWAL Set it to false means that in a fail scenario, you will lose any increments that have not been flushed.
Returns
  • the new value, post increment

public boolean isDisabledTable (String name)

Parameters
name

public RowLock lock (String tableName, String row)

Locks a row in a table. You should eventually call unlock(String, RowLock).

Parameters
tableName
row
Returns
  • the lock

public void modifyColumn (String tableName, String columnFamilyName, Integer maxVersions, Integer blocksize, CompressionType compressionType, CompressionType compactionCompressionType, Boolean inMemory, Integer timeToLive, Boolean blockCacheEnabled, BloomFilterType bloomFilterType, Integer replicationScope, Map<String, String> values)

Changes a column family in a table, all null parameters will be ignored.

Parameters
tableName Required
columnFamilyName Required
maxVersions
blocksize
compressionType
compactionCompressionType
inMemory
timeToLive
blockCacheEnabled
bloomFilterType
replicationScope
values (optional) an extension point for arbitrary data
See Also
  • HBaseService#modifyColumn(String, String, Integer, Integer, String, String, Boolean, Integer, Boolean, String, Integer, Map)

public void put (String tableName, String row, String columnFamilyName, String columnQualifier, Long timestamp, Object value, boolean writeToWAL, RowLock lock)

Saves the value at the specified cell (row + family:qualifier + timestamp)

Parameters
tableName
row
columnFamilyName
columnQualifier
timestamp (optional) a specific version
value
writeToWAL
lock
See Also
  • HBaseService#put(String, String, String, String, Long, String, Boolean, RowLock)

public Iterable<Result> scan (String tableName, String columnFamilyName, String columnQualifier, Long timestamp, Long maxTimestamp, Integer caching, boolean cacheBlocks, int maxVersions, String startRow, String stopRow, int fetchSize)

Scan across all rows in a table.

Parameters
tableName Limits the scan to a specific table. This is the only required argument.
columnFamilyName Limits the scan to a specific column family or null
columnQualifier Limits the scan to a specific column or null. Requires a columnFamilyName to be defined.
timestamp Limits the scan to a specific timestamp
maxTimestamp Get versions of columns only within the specified timestamp range: [timestamp, maxTimestamp)
caching The number of rows for caching
cacheBlocks The number of rows for caching that will be passed to scanners
maxVersions Limits the number of versions on each column
startRow Limits the beginning of the scan to the specified row inclusive
stopRow Limits the end of the scan to the specified row exclusive
fetchSize
See Also
  • HBaseService#scan(String, String, String, Long, Long, Integer, Integer, Boolean, Integer, String, String)

public void unlock (String tableName, RowLock lock)

Unlock the row

Parameters
tableName
lock