@Override public void call(Admin admin) throws Exception { admin.listTableNames(); } @Override
TableName[] names = admin.listTableNames(".*"); names = admin.listTableNames(".*", true); names = admin.listTableNames("hbase:.*", true); names = admin.listTableNames("def.*:.*", true); names = admin.listTableNames("test.*"); names = admin.listTableNames(pattern);
private boolean checkNoTableNames() { List<String> foundTableNames = new ArrayList<>(); TableName[] tableNames = null; LOG.debug("Reading list of tables"); try { tableNames = this.admin.listTableNames(); } catch (IOException e) { LOG.error("Get listTableNames failed", e); this.errorCode = INIT_ERROR_EXIT_CODE; return false; } if (this.targets == null || this.targets.length == 0) return true; for (String target : this.targets) { for (TableName tableName : tableNames) { if (target.equals(tableName.getNameAsString())) { foundTableNames.add(target); } } } if (foundTableNames.size() > 0) { System.err.println("Cannot pass a tablename when using the -regionserver " + "option, tablenames:" + foundTableNames.toString()); this.errorCode = USAGE_EXIT_CODE; } return foundTableNames.isEmpty(); }
@Override public List<ByteBuffer> getTableNames() throws IOError { try { TableName[] tableNames = this.getAdmin().listTableNames(); ArrayList<ByteBuffer> list = new ArrayList<>(tableNames.length); for (TableName tableName : tableNames) { list.add(ByteBuffer.wrap(tableName.getName())); } return list; } 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); } }
private final TableListModel getTableList() throws IOException { TableListModel tableList = new TableListModel(); TableName[] tableNames = servlet.getAdmin().listTableNames(); for (TableName name: tableNames) { tableList.add(new TableModel(name.getNameAsString())); } return tableList; }
@Override public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx, List<TableName> tableNamesList, List<TableDescriptor> descriptors, String regex) throws IOException { // We are delegating the authorization check to postGetTableDescriptors as we don't have // any concrete set of table names when a regex is present or the full list is requested. if (regex == null && tableNamesList != null && !tableNamesList.isEmpty()) { // Otherwise, if the requestor has ADMIN or CREATE privs for all listed tables, the // request can be granted. TableName [] sns = null; try (Admin admin = ctx.getEnvironment().getConnection().getAdmin()) { sns = admin.listTableNames(); if (sns == null) return; for (TableName tableName: tableNamesList) { // Skip checks for a table that does not exist if (!admin.tableExists(tableName)) continue; requirePermission(ctx, "getTableDescriptors", tableName, null, null, Action.ADMIN, Action.CREATE); } } } }
@Override public Object run() throws Exception { Connection unmanagedConnection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Admin admin = unmanagedConnection.getAdmin(); try { return Arrays.asList(admin.listTableNames()); } finally { admin.close(); unmanagedConnection.close(); } } };
CustomInnerRegionObserver.throwException.set(false); TableName[] listTableNames = TEST_UTIL.getAdmin().listTableNames(); for (TableName tableName : listTableNames) { if (!tableName.isSystemTable()) {
final Admin admin = this.connection.getAdmin(); if (admin != null) { admin.listTableNames();
final Admin admin = this.connection.getAdmin(); if (admin != null) { admin.listTableNames();
@Before public void clearTable() throws IOException { RegionObserverImpl.COUNT.set(0); tableName = TableName.valueOf(testName.getMethodName()); if (table != null) { table.close(); } try (Admin admin = UTIL.getAdmin()) { for (TableName name : admin.listTableNames()) { try { admin.disableTable(name); } catch (IOException e) { } admin.deleteTable(name); } table = UTIL.createTable(TableDescriptorBuilder.newBuilder(tableName) .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY)) .setCoprocessor(RegionObserverImpl.class.getName()) .build(), null); } }
List<TableName> getSystemTableNamesInDefaultNamespace(Admin admin) throws IOException { return Lists.newArrayList(admin.listTableNames(Pattern.compile(QueryConstants.SYSTEM_SCHEMA_NAME + "\\..*"))); // TODO: replace to pattern }
/** * Return all created HBase tables * @return Set of HBase table name strings * @throws IOException */ private Set<String> getHBaseTables() throws IOException { Set<String> tables = new HashSet<>(); for (TableName tn : testUtil.getAdmin().listTableNames()) { tables.add(tn.getNameAsString()); } return tables; }
TableName[] tables = admin2.listTableNames(); org.apache.hadoop.hbase.client.Connection hbaseConn = ConnectionFactory.createConnection(utility2.getConfiguration()); Table remoteTable = hbaseConn.getTable(tables[0]);
@Override public void call(Admin admin) throws Exception { admin.listTableNames(); } @Override
/** * getOrigin table name list * @return name list * @throws Exception */ public List<String> getTableNameList() throws Exception { TableName[] tableNames = admin.listTableNames(); List<String> tns = new ArrayList<>(); for(TableName tableName : tableNames) { tns.add(tableName.getNameAsString()); } return tns; }
@Override public Iterable<SourceTableDefinition> getDatasets(String user, DatasetRetrievalOptions ignored) throws Exception { try (Admin admin = connection.getConnection().getAdmin()) { return FluentIterable.of(admin.listTableNames()).transform(new Function<TableName, SourceTableDefinition>(){ @Override public SourceTableDefinition apply(TableName input) { final NamespaceKey key = new NamespaceKey(ImmutableList.<String>of(name, input.getNamespaceAsString(), input.getQualifierAsString())); return new HBaseTableBuilder(key, null, connection, storeConfig.isSizeCalcEnabled, context); }}); } }
default void clearHBase() throws Exception { try (Connection con = ConnectionFactory.createConnection(configuration.get()); Admin admin = con.getAdmin()) { for (TableName tableName : admin.listTableNames()) { utility.get().deleteTableIfAny(tableName); } } }
@Override public Object run() throws Exception { Connection unmanagedConnection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Admin admin = unmanagedConnection.getAdmin(); try { return Arrays.asList(admin.listTableNames()); } finally { admin.close(); unmanagedConnection.close(); } } };