@Override public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { htable.delete(deletesFromThrift(deletes)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } return Collections.emptyList(); }
@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 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 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 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 boolean checkAndMutate(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, TCompareOp compareOp, ByteBuffer value, TRowMutations rowMutations) throws TIOError, TException { checkReadOnlyMode(); try (final Table htable = getTable(table)) { return htable.checkAndMutate(byteBufferToByteArray(row), byteBufferToByteArray(family)) .qualifier(byteBufferToByteArray(qualifier)) .ifMatches(compareOpFromThrift(compareOp), byteBufferToByteArray(value)) .thenMutate(rowMutationsFromThrift(rowMutations)); } catch (IOException e) { throw getTIOError(e); } }
@Override public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { Table.CheckAndMutateBuilder builder = htable.checkAndMutate(byteBufferToByteArray(row), byteBufferToByteArray(family)).qualifier(byteBufferToByteArray(qualifier)); if (value == null) { return builder.ifNotExists().thenPut(putFromThrift(put)); } else { return builder.ifEquals(byteBufferToByteArray(value)).thenPut(putFromThrift(put)); } } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }
@Override public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, TDelete deleteSingle) throws TIOError, TException { checkReadOnlyMode(); Table htable = getTable(table); try { Table.CheckAndMutateBuilder mutateBuilder = htable.checkAndMutate(byteBufferToByteArray(row), byteBufferToByteArray(family)) .qualifier(byteBufferToByteArray(qualifier)); if (value == null) { return mutateBuilder.ifNotExists().thenDelete(deleteFromThrift(deleteSingle)); } else { return mutateBuilder.ifEquals(byteBufferToByteArray(value)) .thenDelete(deleteFromThrift(deleteSingle)); } } 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 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 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 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 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 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 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 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 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 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); } }