Examples of listTables()


Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

  
   public void CreateTable() throws IOException, ZooKeeperConnectionException{
     Configuration conf = HBaseConfiguration.create();
     
     HBaseAdmin hbase = new HBaseAdmin(conf);
     HTableDescriptor[] wordcounts = hbase.listTables("wordcount");
     
     if(wordcounts.length != 0){ //Drop Table if Exists
        hbase.disableTable(TABLE_NAME);
       hbase.deleteTable(TABLE_NAME);
     }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

  }
 
  public void updateSchema() throws IOException {
    Configuration config = HBaseConfiguration.create();
    HBaseAdmin admin = new HBaseAdmin(config);
    HTableDescriptor[] descriptors = admin.listTables();
   
    List<String> tables = new ArrayList<String>();
   
    for (HTableDescriptor hTableDescriptor : descriptors) {
      tables.add(hTableDescriptor.getNameAsString());
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

 
  public void dropTables() {
    HBaseConfiguration config = new HBaseConfiguration();
    try {
      HBaseAdmin admin = new HBaseAdmin(config);
      HTableDescriptor[] descriptors = admin.listTables();
      for (HTableDescriptor hTableDescriptor : descriptors) {
        String name = hTableDescriptor.getNameAsString();
        admin.disableTable(name);
        admin.deleteTable(name);
      }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

  }

  private final TableListModel getTableList() throws IOException {
    TableListModel tableList = new TableListModel();
    HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
    HTableDescriptor[] list = admin.listTables();
    for (HTableDescriptor htd: list) {
      tableList.add(new TableModel(htd.getNameAsString()));
    }
    return tableList;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

    if (user.isAdmin()) {
      tableList = getTableList();
    } else {
      tableList = new TableListModel();
      HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
      HTableDescriptor[] list = admin.listTables();
      String prefix = user.getName() + ".";
      for (HTableDescriptor htd: list) {
        String name = htd.getNameAsString();
        if (!name.startsWith(prefix)) {
          continue;
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

    PrivilegedExceptionAction listTablesAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
        try {
          admin.listTables();
        } finally {
          admin.close();
        }
        return null;
      }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

   
    MiniHBaseCluster cluster = new MiniHBaseCluster(this.conf, 1);
    try {
      HBaseAdmin hb = new HBaseAdmin(this.conf);
      assertTrue(hb.isMasterRunning());
      HTableDescriptor [] tables = hb.listTables();
      boolean foundTable = false;
      for (int i = 0; i < tables.length; i++) {
        if (Bytes.equals(Bytes.toBytes(TABLENAME), tables[i].getName())) {
          foundTable = true;
          break;
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

    PrivilegedExceptionAction listTablesAction = new PrivilegedExceptionAction() {
      public Object run() throws Exception {
        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
        try {
          admin.listTables();
        } finally {
          admin.close();
        }
        return null;
      }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

 
  public static Set<String> getTableNames() {
    Set<String> tableNames = new CopyOnWriteArraySet<String>();
    try {
      HBaseAdmin admin = new HBaseAdmin(hconf);
      HTableDescriptor[] td = admin.listTables();
      for(HTableDescriptor table : td) {
        tableNames.add(new String(table.getName()));
      }
    } catch(Exception e) {
      log.error(ExceptionUtil.getStackTrace(e));
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HBaseAdmin.listTables()

   * Truncates all tables
   * @throws Exception
   */
  public void truncateAllTables() throws Exception {
    HBaseAdmin admin = htu.getHBaseAdmin();
    for(HTableDescriptor table:admin.listTables()) {
      htu.truncateTable(table.getName());
    }
  }
 
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.