当前位置: 首页>>代码示例>>Java>>正文


Java TableModel类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.TableModel的典型用法代码示例。如果您正苦于以下问题:Java TableModel类的具体用法?Java TableModel怎么用?Java TableModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TableModel类属于org.apache.hadoop.hbase.rest.model包,在下文中一共展示了TableModel类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testListTables

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
@Test
public void testListTables() throws Exception {

  remoteAdmin.createTable(DESC_2);
  List<TableModel> tableList = remoteAdmin.getTableList().getTables();
  System.out.println("List of tables is: ");
  boolean found = false;
  for (TableModel tm : tableList) {

    if (tm.getName().equals(TABLE_2)) {
      found = true;
      break;
    }
  }
  assertTrue("Table " + TABLE_2 + " was not found by get request to '/'",
      found);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:TestRemoteAdmin.java

示例2: getTableList

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
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;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:RootResource.java

示例3: checkTableList

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
private static void checkTableList(TableListModel model) {
  boolean found = false;
  Iterator<TableModel> tables = model.getTables().iterator();
  assertTrue(tables.hasNext());
  while (tables.hasNext()) {
    TableModel table = tables.next();
    if (table.getName().equals(TABLE.getNameAsString())) {
      found = true;
      break;
    }
  }
  assertTrue(found);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:TestTableResource.java

示例4: checkNamespaceTables

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
private void checkNamespaceTables(List<TableModel> namespaceTables, List<String> testTables){
  assertEquals(namespaceTables.size(), testTables.size());
  for(int i = 0 ; i < namespaceTables.size() ; i++){
    String tableName = ((TableModel) namespaceTables.get(i)).getName();
    assertTrue(testTables.contains(tableName));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestNamespacesInstanceResource.java

示例5: getTableList

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
private final TableListModel getTableList() throws IOException {
  TableListModel tableList = new TableListModel();
  String[] tableNames = servlet.getAdmin().getTableNames();
  for (String name: tableNames) {
    tableList.add(new TableModel(name));
  }
  return tableList;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:9,代码来源:RootResource.java

示例6: checkTableList

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
private static void checkTableList(TableListModel model) {
  boolean found = false;
  Iterator<TableModel> tables = model.getTables().iterator();
  assertTrue(tables.hasNext());
  while (tables.hasNext()) {
    TableModel table = tables.next();
    if (table.getName().equals(TABLE)) {
      found = true;
      break;
    }
  }
  assertTrue(found);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:TestTableResource.java

示例7: getTableList

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
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;
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:10,代码来源:RootResource.java

示例8: getTableList

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
private final TableListModel getTableList() throws IOException {
  TableListModel tableList = new TableListModel();
  HTableDescriptor[] list = servlet.getAdmin().listTables();
  for (HTableDescriptor htd: list) {
    tableList.add(new TableModel(htd.getNameAsString()));
  }
  return tableList;
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:9,代码来源:RootResource.java

示例9: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster(3);
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(
      TableModel.class,
      TableInfoModel.class,
      TableListModel.class,
      TableRegionModel.class);
  Admin admin = TEST_UTIL.getHBaseAdmin();
  if (admin.tableExists(TABLE)) {
    return;
  }
  HTableDescriptor htd = new HTableDescriptor(TABLE);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  admin.createTable(htd);
  byte[] k = new byte[3];
  byte [][] famAndQf = KeyValue.parseColumn(Bytes.toBytes(COLUMN));
  List<Put> puts = new ArrayList<>();
  for (byte b1 = 'a'; b1 < 'z'; b1++) {
    for (byte b2 = 'a'; b2 < 'z'; b2++) {
      for (byte b3 = 'a'; b3 < 'z'; b3++) {
        k[0] = b1;
        k[1] = b2;
        k[2] = b3;
        Put put = new Put(k);
        put.setDurability(Durability.SKIP_WAL);
        put.add(famAndQf[0], famAndQf[1], k);
        puts.add(put);
      }
    }
  }
  Connection connection = TEST_UTIL.getConnection();
  
  Table table =  connection.getTable(TABLE);
  table.put(puts);
  table.close();
  // get the initial layout (should just be one region)
  
  RegionLocator regionLocator = connection.getRegionLocator(TABLE);
  List<HRegionLocation> m = regionLocator.getAllRegionLocations();
  assertEquals(m.size(), 1);
  // tell the master to split the table
  admin.split(TABLE);
  // give some time for the split to happen

  long timeout = System.currentTimeMillis() + (15 * 1000);
  while (System.currentTimeMillis() < timeout && m.size()!=2){
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
      LOG.warn(StringUtils.stringifyException(e));
    }
    // check again
    m = regionLocator.getAllRegionLocations();
  }

  // should have two regions now
  assertEquals(m.size(), 2);
  regionMap = m;
  LOG.info("regions: " + regionMap);
  regionLocator.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:66,代码来源:TestTableResource.java

示例10: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster(3);
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(
      TableModel.class,
      TableInfoModel.class,
      TableListModel.class,
      TableRegionModel.class);
  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  if (admin.tableExists(TABLE)) {
    return;
  }
  HTableDescriptor htd = new HTableDescriptor(TABLE);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  admin.createTable(htd);
  HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLE);
  byte[] k = new byte[3];
  byte [][] famAndQf = KeyValue.parseColumn(Bytes.toBytes(COLUMN));
  for (byte b1 = 'a'; b1 < 'z'; b1++) {
    for (byte b2 = 'a'; b2 < 'z'; b2++) {
      for (byte b3 = 'a'; b3 < 'z'; b3++) {
        k[0] = b1;
        k[1] = b2;
        k[2] = b3;
        Put put = new Put(k);
        put.setWriteToWAL(false);
        put.add(famAndQf[0], famAndQf[1], k);
        table.put(put);
      }
    }
  }
  table.flushCommits();
  // get the initial layout (should just be one region)
  Map<HRegionInfo,HServerAddress> m = table.getRegionsInfo();
  assertEquals(m.size(), 1);
  // tell the master to split the table
  admin.split(TABLE);
  // give some time for the split to happen

  long timeout = System.currentTimeMillis() + (15 * 1000);
  while (System.currentTimeMillis() < timeout && m.size()!=2){
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
      LOG.warn(StringUtils.stringifyException(e));
    }
    // check again
    m = table.getRegionsInfo();
  }

  // should have two regions now
  assertEquals(m.size(), 2);
  regionMap = m;
  LOG.info("regions: " + regionMap);
  table.close();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:60,代码来源:TestTableResource.java

示例11: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster(3);
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost", 
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(
      TableModel.class,
      TableInfoModel.class,
      TableListModel.class,
      TableRegionModel.class);
  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  if (admin.tableExists(TABLE)) {
    return;
  }
  HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  admin.createTable(htd);
  HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLE);
  byte[] k = new byte[3];
  byte [][] famAndQf = KeyValue.parseColumn(Bytes.toBytes(COLUMN));
  for (byte b1 = 'a'; b1 < 'z'; b1++) {
    for (byte b2 = 'a'; b2 < 'z'; b2++) {
      for (byte b3 = 'a'; b3 < 'z'; b3++) {
        k[0] = b1;
        k[1] = b2;
        k[2] = b3;
        Put put = new Put(k);
        put.setDurability(Durability.SKIP_WAL);
        put.add(famAndQf[0], famAndQf[1], k);
        table.put(put);
      }
    }
  }
  table.flushCommits();
  // get the initial layout (should just be one region)
  Map<HRegionInfo, ServerName> m = table.getRegionLocations();
  assertEquals(m.size(), 1);
  // tell the master to split the table
  admin.split(TABLE);
  // give some time for the split to happen

  long timeout = System.currentTimeMillis() + (15 * 1000);
  while (System.currentTimeMillis() < timeout && m.size()!=2){
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
      LOG.warn(StringUtils.stringifyException(e));
    }
    // check again
    m = table.getRegionLocations();
  }

  // should have two regions now
  assertEquals(m.size(), 2);
  regionMap = m;
  LOG.info("regions: " + regionMap);
  table.close();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:60,代码来源:TestTableResource.java

示例12: setUpBeforeClass

import org.apache.hadoop.hbase.rest.model.TableModel; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster(3);
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(
      TableModel.class,
      TableInfoModel.class,
      TableListModel.class,
      TableRegionModel.class);
  Admin admin = TEST_UTIL.getAdmin();
  if (admin.tableExists(TABLE)) {
    return;
  }
  HTableDescriptor htd = new HTableDescriptor(TABLE);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  admin.createTable(htd);
  byte[] k = new byte[3];
  byte [][] famAndQf = CellUtil.parseColumn(Bytes.toBytes(COLUMN));
  List<Put> puts = new ArrayList<>();
  for (byte b1 = 'a'; b1 < 'z'; b1++) {
    for (byte b2 = 'a'; b2 < 'z'; b2++) {
      for (byte b3 = 'a'; b3 < 'z'; b3++) {
        k[0] = b1;
        k[1] = b2;
        k[2] = b3;
        Put put = new Put(k);
        put.setDurability(Durability.SKIP_WAL);
        put.addColumn(famAndQf[0], famAndQf[1], k);
        puts.add(put);
      }
    }
  }
  Connection connection = TEST_UTIL.getConnection();

  Table table =  connection.getTable(TABLE);
  table.put(puts);
  table.close();
  // get the initial layout (should just be one region)

  RegionLocator regionLocator = connection.getRegionLocator(TABLE);
  List<HRegionLocation> m = regionLocator.getAllRegionLocations();
  assertEquals(1, m.size());
  // tell the master to split the table
  admin.split(TABLE);
  // give some time for the split to happen

  TestEndToEndSplitTransaction.blockUntilRegionSplit(TEST_UTIL.getConfiguration(), 60000,
    m.get(0).getRegionInfo().getRegionName(), true);
  long timeout = System.currentTimeMillis() + (15 * 1000);
  while (System.currentTimeMillis() < timeout && m.size()!=2){
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
      LOG.warn(StringUtils.stringifyException(e));
    }
    // check again
    m = regionLocator.getAllRegionLocations();
  }

  // should have two regions now
  assertEquals(2, m.size());
  regionMap = m;
  LOG.info("regions: " + regionMap);
  regionLocator.close();
}
 
开发者ID:apache,项目名称:hbase,代码行数:68,代码来源:TestTableResource.java


注:本文中的org.apache.hadoop.hbase.rest.model.TableModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。