org.apache.hadoop.hbase.client.Admin.listTableNames()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.apache.hadoop.hbase.client.Admin.listTableNames()方法的一些代码示例,展示了Admin.listTableNames()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.listTableNames()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:listTableNames

Admin.listTableNames介绍

[英]List all of the names of userspace tables.
[中]列出用户空间表的所有名称。

代码示例

代码示例来源:origin: apache/hbase

@Override
public void call(Admin admin) throws Exception {
 admin.listTableNames();
}
@Override

代码示例来源:origin: larsgeorge/hbase-book

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);

代码示例来源:origin: apache/hbase

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();
}

代码示例来源:origin: apache/hbase

@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);
 }
}

代码示例来源:origin: apache/hbase

@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);
 }
}

代码示例来源:origin: apache/hbase

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;
}

代码示例来源:origin: apache/hbase

@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);
   }
  }
 }
}

代码示例来源:origin: apache/hbase

@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();
  }
 }
};

代码示例来源:origin: apache/hbase

CustomInnerRegionObserver.throwException.set(false);
TableName[] listTableNames = TEST_UTIL.getAdmin().listTableNames();
for (TableName tableName : listTableNames) {
 if (!tableName.isSystemTable()) {

代码示例来源:origin: apache/nifi

final Admin admin = this.connection.getAdmin();
if (admin != null) {
  admin.listTableNames();

代码示例来源:origin: apache/nifi

final Admin admin = this.connection.getAdmin();
if (admin != null) {
  admin.listTableNames();

代码示例来源:origin: apache/hbase

@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);
 }
}

代码示例来源:origin: apache/phoenix

List<TableName> getSystemTableNamesInDefaultNamespace(Admin admin) throws IOException {
  return Lists.newArrayList(admin.listTableNames(Pattern.compile(QueryConstants.SYSTEM_SCHEMA_NAME + "\\..*"))); // TODO: replace to pattern
}

代码示例来源:origin: apache/phoenix

/**
 * 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;
}

代码示例来源:origin: apache/phoenix

TableName[] tables = admin2.listTableNames();
org.apache.hadoop.hbase.client.Connection hbaseConn = ConnectionFactory.createConnection(utility2.getConfiguration());
Table remoteTable = hbaseConn.getTable(tables[0]);

代码示例来源:origin: org.apache.hbase/hbase-server

@Override
public void call(Admin admin) throws Exception {
 admin.listTableNames();
}
@Override

代码示例来源:origin: com.github.hackerwin7/jlib-utils

/**
 * 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;
}

代码示例来源:origin: dremio/dremio-oss

@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);
   }});
 }
}

代码示例来源:origin: opencb/opencga

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);
    }
  }
}

代码示例来源:origin: org.apache.hbase/hbase-server

@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();
  }
 }
};

相关文章

Admin类方法