@Override protected HBaseServiceHandler createHandler(Configuration conf, UserProvider userProvider) throws IOException { return new ThriftHBaseServiceHandler(conf, userProvider); }
private void checkReadOnlyMode() throws TIOError { if (isReadOnly()) { throw getTIOError(ioe); } }
@Override public Void run() throws Exception { client.run(); return null; } });
@Override public TResult increment(ByteBuffer table, TIncrement increment) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { return resultFromHBase(htable.increment(incrementFromThrift(increment))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public TResult get(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return resultFromHBase(htable.get(getFromThrift(get))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public int openScanner(ByteBuffer table, TScan scan) throws TIOError, TException { Table htable = getTable(table); ResultScanner resultScanner = null; try { resultScanner = htable.getScanner(scanFromThrift(scan)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } return addScanner(resultScanner); }
@Override public TResult append(ByteBuffer table, TAppend append) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { return resultFromHBase(htable.append(appendFromThrift(append))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public void deleteSingle(ByteBuffer table, TDelete deleteSingle) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { htable.delete(deleteFromThrift(deleteSingle)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public void put(ByteBuffer table, TPut put) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { htable.put(putFromThrift(put)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public List<TResult> getMultiple(ByteBuffer table, List<TGet> gets) throws TIOError, TException { Table htable = getTable(table); try { return resultsFromHBase(htable.get(getsFromThrift(gets))); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public void putMultiple(ByteBuffer table, List<TPut> puts) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { htable.put(putsFromThrift(puts)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public void mutateRow(ByteBuffer table, TRowMutations rowMutations) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { htable.mutateRow(rowMutationsFromThrift(rowMutations)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public void createTable(TTableDescriptor desc, List<ByteBuffer> splitKeys) throws TIOError, TException { try { TableDescriptor descriptor = tableDescriptorFromThrift(desc); byte[][] split = splitKeyFromThrift(splitKeys); connectionCache.getAdmin().createTable(descriptor, split); } catch (IOException e) { throw getTIOError(e); } }
@Override public List<TTableDescriptor> getTableDescriptors(List<TTableName> tables) throws TIOError, TException { try { List<TableName> tableNames = ThriftUtilities.tableNamesFromThrift(tables); List<TableDescriptor> tableDescriptors = connectionCache.getAdmin() .listTableDescriptors(tableNames); return tableDescriptorsFromHBase(tableDescriptors); } catch (IOException e) { throw getTIOError(e); } }
@Override public void modifyColumnFamily(TTableName tableName, TColumnFamilyDescriptor column) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); ColumnFamilyDescriptor columnFamilyDescriptor = columnFamilyDescriptorFromThrift(column); connectionCache.getAdmin().modifyColumnFamily(table, columnFamilyDescriptor); } catch (IOException e) { throw getTIOError(e); } }
@Override public void modifyTable(TTableDescriptor desc) throws TIOError, TException { try { TableDescriptor descriptor = tableDescriptorFromThrift(desc); connectionCache.getAdmin().modifyTable(descriptor); } catch (IOException e) { throw getTIOError(e); } }
@Override public boolean isTableAvailable(TTableName tableName) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); return connectionCache.getAdmin().isTableAvailable(table); } catch (IOException e) { throw getTIOError(e); } }
@Override public void createNamespace(TNamespaceDescriptor namespaceDesc) throws TIOError, TException { try { NamespaceDescriptor descriptor = namespaceDescriptorFromThrift(namespaceDesc); connectionCache.getAdmin().createNamespace(descriptor); } catch (IOException e) { throw getTIOError(e); } }
@Override public boolean exists(ByteBuffer table, TGet get) throws TIOError, TException { Table htable = getTable(table); try { return htable.exists(getFromThrift(get)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public boolean tableExists(TTableName tTableName) throws TIOError, TException { try { TableName tableName = tableNameFromThrift(tTableName); return connectionCache.getAdmin().tableExists(tableName); } catch (IOException e) { throw getTIOError(e); } }