Codota Logo
ThriftServerRunner$HBaseHandler
Code IndexAdd Codota to your IDE (free)

How to use
ThriftServerRunner$HBaseHandler
in
org.apache.hadoop.hbase.thrift

Best Java code snippets using org.apache.hadoop.hbase.thrift.ThriftServerRunner$HBaseHandler (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: com.aliyun.hbase/alihbase-thrift

/**
 * Appends the value to a cell and checks that the cell value is updated properly.
 *
 * @throws Exception
 */
public static void doTestAppend() throws Exception {
 ThriftServerRunner.HBaseHandler handler =
  new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
   UserProvider.instantiate(UTIL.getConfiguration()));
 handler.createTable(tableAname, getColumnDescriptors());
 try {
  List<Mutation> mutations = new ArrayList<>(1);
  mutations.add(new Mutation(false, columnAname, valueAname, true));
  handler.mutateRow(tableAname, rowAname, mutations, null);
  List<ByteBuffer> columnList = new ArrayList<>(1);
  columnList.add(columnAname);
  List<ByteBuffer> valueList = new ArrayList<>(1);
  valueList.add(valueBname);
  TAppend append = new TAppend(tableAname, rowAname, columnList, valueList);
  handler.append(append);
  TRowResult rowResult = handler.getRow(tableAname, rowAname, null).get(0);
  assertEquals(rowAname, rowResult.row);
  assertArrayEquals(Bytes.add(valueAname.array(), valueBname.array()),
   rowResult.columns.get(columnAname).value.array());
 } finally {
  handler.disableTable(tableAname);
  handler.deleteTable(tableAname);
 }
}
origin: com.aliyun.hbase/alihbase-thrift

 new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
  UserProvider.instantiate(UTIL.getConfiguration()));
handler.createTable(tableAname, getColumnDescriptors());
handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null);
handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null);
handler.mutateRowTs(tableAname, rowBname, getMutations(), time2, null);
assertEquals(2, handler.getVerTs(tableAname, rowAname, columnBname, time2,
 MAXVERSIONS, null).size());
assertEquals(1, handler.getVerTs(tableAname, rowAname, columnBname, time1,
 MAXVERSIONS, null).size());
TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1, null).get(0);
TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2, null).get(0);
rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns, null).get(0);
assertEquals(rowResult1.columns.get(columnBname).value, valueCname);
assertFalse(rowResult1.columns.containsKey(columnAname));
rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1, null).get(0);
assertEquals(rowResult1.columns.get(columnBname).value, valueBname);
assertFalse(rowResult1.columns.containsKey(columnAname));
handler.deleteAllTs(tableAname, rowAname, columnBname, time1, null);
handler.deleteAllRowTs(tableAname, rowBname, time2, null);
origin: com.aliyun.hbase/alihbase-thrift

public static void doTestIncrements(HBaseHandler handler) throws Exception {
 List<Mutation> mutations = new ArrayList<>(1);
 mutations.add(new Mutation(false, columnAAname, valueEname, true));
 mutations.add(new Mutation(false, columnAname, valueEname, true));
 handler.mutateRow(tableAname, rowAname, mutations, null);
 handler.mutateRow(tableAname, rowBname, mutations, null);
 List<TIncrement> increments = new ArrayList<>(3);
 increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
 increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
 increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
 int numIncrements = 60000;
 for (int i = 0; i < numIncrements; i++) {
  handler.increment(new TIncrement(tableAname, rowAname, columnAname, 2));
  handler.incrementRows(increments);
 }
 Thread.sleep(1000);
 long lv = handler.get(tableAname, rowAname, columnAname, null).get(0).value.getLong();
 // Wait on all increments being flushed
 while (handler.coalescer.getQueueSize() != 0) Threads.sleep(10);
 assertEquals((100 + (2 * numIncrements)), lv );
 lv = handler.get(tableAname, rowBname, columnAAname, null).get(0).value.getLong();
 assertEquals((100 + (3 * 7 * numIncrements)), lv);
 assertTrue(handler.coalescer.getSuccessfulCoalescings() > 0);
}
origin: org.apache.hbase/hbase-thrift

@Override
public void deleteAll(
  ByteBuffer tableName, ByteBuffer row, ByteBuffer column,
  Map<ByteBuffer, ByteBuffer> attributes)
  throws IOError {
 deleteAllTs(tableName, row, column, HConstants.LATEST_TIMESTAMP,
       attributes);
}
origin: com.aliyun.hbase/alihbase-thrift

/**
 * Tests for creating, enabling, disabling, and deleting tables.  Also
 * tests that creating a table with an invalid column name yields an
 * IllegalArgument exception.
 *
 * @throws Exception
 */
public void doTestTableCreateDrop() throws Exception {
 ThriftServerRunner.HBaseHandler handler =
  new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
   UserProvider.instantiate(UTIL.getConfiguration()));
 doTestTableCreateDrop(handler);
}
origin: org.apache.hbase/hbase-thrift

@Override
public List<TCell> get(
  ByteBuffer tableName, ByteBuffer row, ByteBuffer column,
  Map<ByteBuffer, ByteBuffer> attributes)
  throws IOError {
 byte [][] famAndQf = CellUtil.parseColumn(getBytes(column));
 if (famAndQf.length == 1) {
  return get(tableName, row, famAndQf[0], null, attributes);
 }
 if (famAndQf.length == 2) {
  return get(tableName, row, famAndQf[0], famAndQf[1], attributes);
 }
 throw new IllegalArgumentException("Invalid familyAndQualifier provided.");
}
origin: org.apache.hbase/hbase-thrift

@Override
public List<TCell> getVerTs(ByteBuffer tableName, ByteBuffer row, ByteBuffer column,
  long timestamp, int numVersions, Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 byte [][] famAndQf = CellUtil.parseColumn(getBytes(column));
 if (famAndQf.length == 1) {
  return getVerTs(tableName, row, famAndQf[0], null, timestamp, numVersions, attributes);
 }
 if (famAndQf.length == 2) {
  return getVerTs(tableName, row, famAndQf[0], famAndQf[1], timestamp, numVersions,
   attributes);
 }
 throw new IllegalArgumentException("Invalid familyAndQualifier provided.");
}
origin: org.apache.hbase/hbase-thrift

/**
 * Tests adding a series of Mutations and BatchMutations, including a
 * delete mutation.  Also tests data retrieval, and getting back multiple
 * versions.
 *
 * @throws Exception
 */
public void doTestTableMutations() throws Exception {
 ThriftServerRunner.HBaseHandler handler =
  new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
   UserProvider.instantiate(UTIL.getConfiguration()));
 doTestTableMutations(handler);
}
origin: org.apache.hbase/hbase-thrift

/**
 * For HBASE-2556
 * Tests for GetTableRegions
 *
 * @throws Exception
 */
public void doTestGetTableRegions() throws Exception {
 ThriftServerRunner.HBaseHandler handler =
  new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(),
   UserProvider.instantiate(UTIL.getConfiguration()));
 doTestGetTableRegions(handler);
}
origin: co.cask.hbase/hbase

public ThriftServerRunner(Configuration conf) throws IOException {
 this(conf, new ThriftServerRunner.HBaseHandler(conf));
}
origin: com.aliyun.hbase/alihbase-thrift

@Override
public List<TCell> get(
  ByteBuffer tableName, ByteBuffer row, ByteBuffer column,
  Map<ByteBuffer, ByteBuffer> attributes)
  throws IOError {
 byte [][] famAndQf = CellUtil.parseColumn(getBytes(column));
 if (famAndQf.length == 1) {
  return get(tableName, row, famAndQf[0], null, attributes);
 }
 if (famAndQf.length == 2) {
  return get(tableName, row, famAndQf[0], famAndQf[1], attributes);
 }
 throw new IllegalArgumentException("Invalid familyAndQualifier provided.");
}
origin: co.cask.hbase/hbase

@Deprecated
@Override
public List<TCell> getVerTs(ByteBuffer tableName,
                ByteBuffer row,
  ByteBuffer column,
  long timestamp,
  int numVersions,
  Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
 if(famAndQf.length == 1) {
  return getVerTs(tableName, row, famAndQf[0], new byte[0], timestamp,
    numVersions, attributes);
 }
 return getVerTs(tableName, row, famAndQf[0], famAndQf[1], timestamp,
   numVersions, attributes);
}
origin: org.apache.hbase/hbase-thrift

public static void doTestIncrements(HBaseHandler handler) throws Exception {
 List<Mutation> mutations = new ArrayList<>(1);
 mutations.add(new Mutation(false, columnAAname, valueEname, true));
 mutations.add(new Mutation(false, columnAname, valueEname, true));
 handler.mutateRow(tableAname, rowAname, mutations, null);
 handler.mutateRow(tableAname, rowBname, mutations, null);
 List<TIncrement> increments = new ArrayList<>(3);
 increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
 increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
 increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7));
 int numIncrements = 60000;
 for (int i = 0; i < numIncrements; i++) {
  handler.increment(new TIncrement(tableAname, rowAname, columnAname, 2));
  handler.incrementRows(increments);
 }
 Thread.sleep(1000);
 long lv = handler.get(tableAname, rowAname, columnAname, null).get(0).value.getLong();
 // Wait on all increments being flushed
 while (handler.coalescer.getQueueSize() != 0) Threads.sleep(10);
 assertEquals((100 + (2 * numIncrements)), lv );
 lv = handler.get(tableAname, rowBname, columnAAname, null).get(0).value.getLong();
 assertEquals((100 + (3 * 7 * numIncrements)), lv);
 assertTrue(handler.coalescer.getSuccessfulCoalescings() > 0);
}
origin: co.cask.hbase/hbase

@Override
public List<TRowResult> getRowTs(ByteBuffer tableName, ByteBuffer row,
  long timestamp, Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 return getRowWithColumnsTs(tableName, row, null,
               timestamp, attributes);
}
origin: com.aliyun.hbase/alihbase-thrift

@Override
public int scannerOpen(ByteBuffer tableName, ByteBuffer startRow,
  List<ByteBuffer> columns,
  Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 Table table = null;
 try {
  table = getTable(tableName);
  Scan scan = new Scan(getBytes(startRow));
  addAttributes(scan, attributes);
  if(columns != null && columns.size() != 0) {
   for(ByteBuffer column : columns) {
    byte [][] famQf = CellUtil.parseColumn(getBytes(column));
    if(famQf.length == 1) {
     scan.addFamily(famQf[0]);
    } else {
     scan.addColumn(famQf[0], famQf[1]);
    }
   }
  }
  return addScanner(table.getScanner(scan), false);
 } catch (IOException e) {
  LOG.warn(e.getMessage(), e);
  throw getIOError(e);
 } finally{
  closeTable(table);
 }
}
origin: org.apache.hbase/hbase-thrift

@Override
public List<TRowResult> getRow(ByteBuffer tableName, ByteBuffer row,
  Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 return getRowWithColumnsTs(tableName, row, null,
               HConstants.LATEST_TIMESTAMP,
               attributes);
}
origin: co.cask.hbase/hbase

@Override
public int scannerOpen(ByteBuffer tableName, ByteBuffer startRow,
  List<ByteBuffer> columns,
  Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 try {
  HTable table = getTable(tableName);
  Scan scan = new Scan(getBytes(startRow));
  addAttributes(scan, attributes);
  if(columns != null && columns.size() != 0) {
   for(ByteBuffer column : columns) {
    byte [][] famQf = KeyValue.parseColumn(getBytes(column));
    if(famQf.length == 1) {
     scan.addFamily(famQf[0]);
    } else {
     scan.addColumn(famQf[0], famQf[1]);
    }
   }
  }
  return addScanner(table.getScanner(scan));
 } catch (IOException e) {
  LOG.warn(e.getMessage(), e);
  throw new IOError(e.getMessage());
 }
}
origin: com.aliyun.hbase/alihbase-thrift

@Override
public void mutateRow(ByteBuffer tableName, ByteBuffer row,
  List<Mutation> mutations, Map<ByteBuffer, ByteBuffer> attributes)
  throws IOError, IllegalArgument {
 mutateRowTs(tableName, row, mutations, HConstants.LATEST_TIMESTAMP,
       attributes);
}
origin: co.cask.hbase/hbase

@Override
public int scannerOpenWithStop(ByteBuffer tableName, ByteBuffer startRow,
  ByteBuffer stopRow, List<ByteBuffer> columns,
  Map<ByteBuffer, ByteBuffer> attributes)
  throws IOError, TException {
 try {
  HTable table = getTable(tableName);
  Scan scan = new Scan(getBytes(startRow), getBytes(stopRow));
  addAttributes(scan, attributes);
  if(columns != null && columns.size() != 0) {
   for(ByteBuffer column : columns) {
    byte [][] famQf = KeyValue.parseColumn(getBytes(column));
    if(famQf.length == 1) {
     scan.addFamily(famQf[0]);
    } else {
     scan.addColumn(famQf[0], famQf[1]);
    }
   }
  }
  return addScanner(table.getScanner(scan));
 } catch (IOException e) {
  LOG.warn(e.getMessage(), e);
  throw new IOError(e.getMessage());
 }
}
origin: com.aliyun.hbase/alihbase-thrift

@Override
public void deleteAllRow(
  ByteBuffer tableName, ByteBuffer row,
  Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
 deleteAllRowTs(tableName, row, HConstants.LATEST_TIMESTAMP, attributes);
}
org.apache.hadoop.hbase.thriftThriftServerRunner$HBaseHandler

Javadoc

The HBaseHandler is a glue object that connects Thrift RPC calls to the HBase client API primarily defined in the Admin and Table objects.

Most used methods

  • <init>
  • deleteAllRowTs
  • deleteAllTs
  • get
    Note: this internal interface is slightly different from public APIs in regard to handling of the qu
  • getRowWithColumnsTs
  • getVerTs
    Note: this internal interface is slightly different from public APIs in regard to handling of the qu
  • increment
  • mutateRowTs
  • mutateRowsTs
  • addScanner
    Assigns a unique ID to the scanner and adds the mapping to an internal hash-map.
  • atomicIncrement
  • getRowsWithColumnsTs
  • atomicIncrement,
  • getRowsWithColumnsTs,
  • getScanner,
  • getTable,
  • getVer,
  • removeScanner,
  • scannerGetList,
  • append,
  • checkAndPut,
  • closeTable

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now