public static TableName[] tableNamesArrayFromThrift(List<TTableName> tableNames) { TableName[] out = new TableName[tableNames.size()]; int index = 0; for (TTableName tableName : tableNames) { out[index++] = tableNameFromThrift(tableName); } return out; }
public static List<TableName> tableNamesFromThrift(List<TTableName> tableNames) { List<TableName> out = new ArrayList<>(tableNames.size()); for (TTableName tableName : tableNames) { out.add(tableNameFromThrift(tableName)); } return out; }
@Override public void deleteColumnFamily(TTableName tableName, ByteBuffer column) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); connectionCache.getAdmin().deleteColumnFamily(table, column.array()); } 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 deleteTable(TTableName tableName) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); connectionCache.getAdmin().deleteTable(table); } catch (IOException e) { throw getTIOError(e); } }
@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); } }
@Override public void truncateTable(TTableName tableName, boolean preserveSplits) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); connectionCache.getAdmin().truncateTable(table, preserveSplits); } catch (IOException e) { throw getTIOError(e); } }
@Override public boolean isTableDisabled(TTableName tableName) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); return connectionCache.getAdmin().isTableDisabled(table); } catch (IOException e) { throw getTIOError(e); } }
@Override public void enableTable(TTableName tableName) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); connectionCache.getAdmin().enableTable(table); } catch (IOException e) { throw getTIOError(e); } }
@Override public void disableTable(TTableName tableName) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); connectionCache.getAdmin().disableTable(table); } catch (IOException e) { throw getTIOError(e); } }
@Override public boolean isTableEnabled(TTableName tableName) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); return connectionCache.getAdmin().isTableEnabled(table); } catch (IOException e) { throw getTIOError(e); } }
@Override public boolean isTableAvailableWithSplit(TTableName tableName, List<ByteBuffer> splitKeys) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); byte[][] split = splitKeyFromThrift(splitKeys); return connectionCache.getAdmin().isTableAvailable(table, split); } 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 TTableDescriptor getTableDescriptor(TTableName table) throws TIOError, TException { try { TableName tableName = ThriftUtilities.tableNameFromThrift(table); TableDescriptor tableDescriptor = connectionCache.getAdmin().getDescriptor(tableName); return tableDescriptorFromHBase(tableDescriptor); } catch (IOException e) { throw getTIOError(e); } }
@Override public void addColumnFamily(TTableName tableName, TColumnFamilyDescriptor column) throws TIOError, TException { try { TableName table = tableNameFromThrift(tableName); ColumnFamilyDescriptor columnFamilyDescriptor = columnFamilyDescriptorFromThrift(column); connectionCache.getAdmin().addColumnFamily(table, columnFamilyDescriptor); } catch (IOException e) { throw getTIOError(e); } }
public static TableDescriptor tableDescriptorFromThrift(TTableDescriptor in) { TableDescriptorBuilder builder = TableDescriptorBuilder .newBuilder(tableNameFromThrift(in.getTableName())); for (TColumnFamilyDescriptor column : in.getColumns()) { builder.setColumnFamily(columnFamilyDescriptorFromThrift(column)); } if (in.isSetAttributes()) { for (Map.Entry<ByteBuffer, ByteBuffer> attribute : in.getAttributes().entrySet()) { builder.setValue(attribute.getKey().array(), attribute.getValue().array()); } } if (in.isSetDurability()) { builder.setDurability(durabilityFromThrift(in.getDurability())); } return builder.build(); }