/** * Obtain HBaseAdmin. Creates the instance if it is not already created. */ protected Admin getAdmin() throws IOException { return connectionCache.getAdmin(); }
@Override public boolean isTableEnabled(ByteBuffer tableName) throws IOError { try { return this.connectionCache.getAdmin().isTableEnabled(getTableName(tableName)); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw getIOError(e); } }
@Override public List<TTableName> getTableNamesByPattern(String regex, boolean includeSysTables) throws TIOError, TException { try { Pattern pattern = (regex == null ? null : Pattern.compile(regex)); TableName[] tableNames = connectionCache.getAdmin() .listTableNames(pattern, includeSysTables); return tableNamesFromHBase(tableNames); } catch (IOException e) { throw getTIOError(e); } }
@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 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 modifyTable(TTableDescriptor desc) throws TIOError, TException { try { TableDescriptor descriptor = tableDescriptorFromThrift(desc); connectionCache.getAdmin().modifyTable(descriptor); } 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 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 void modifyNamespace(TNamespaceDescriptor namespaceDesc) throws TIOError, TException { try { NamespaceDescriptor descriptor = namespaceDescriptorFromThrift(namespaceDesc); connectionCache.getAdmin().modifyNamespace(descriptor); } catch (IOException e) { throw getTIOError(e); } }
@Override public TNamespaceDescriptor getNamespaceDescriptor(String name) throws TIOError, TException { try { NamespaceDescriptor descriptor = connectionCache.getAdmin().getNamespaceDescriptor(name); return namespaceDescriptorFromHBase(descriptor); } 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 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); } }
@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); } }