Package org.apache.hadoop.hbase.client

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


      final UriInfo uriInfo) {
    try {
      servlet.invalidateMaxAge(tableName);
      byte[] tableName = Bytes.toBytes(actualTableName);
      HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
      if (replace || !admin.tableExists(tableName)) {
        return replace(tableName, model, uriInfo, admin);
      } else {
        return update(tableName, model, uriInfo, admin);
      }
    } catch (IOException e) {
View Full Code Here


    if (!servlet.userRequestLimit(user, 1)) {
      Response.status(509).build();
    }
    try {
      HBaseAdmin admin = new HBaseAdmin(servlet.getConfiguration());
      if (!admin.tableExists(actualTableName)) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
      }
    } catch (IOException e) {
      throw new WebApplicationException(Response.Status.SERVICE_UNAVAILABLE);
    }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    HBaseAdmin admin = new HBaseAdmin(conf);
    if (!admin.tableExists(TABLE)) {
      HTableDescriptor htd = new HTableDescriptor(TABLE);
      htd.addFamily(new HColumnDescriptor(USER));
      admin.createTable(htd);
      HTable table = new HTable(conf, TABLE);
      Put put = new Put(Bytes.toBytes(ADMIN_TOKEN));
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    HBaseAdmin admin = new HBaseAdmin(conf);
    if (!admin.tableExists(TABLE)) {
      HTableDescriptor htd = new HTableDescriptor(TABLE);
      htd.addFamily(new HColumnDescriptor(USER));
      admin.createTable(htd);
      HTable table = new HTable(TABLE);
      Put put = new Put(Bytes.toBytes(USER_TOKEN));
View Full Code Here

     
      log.info("Connecting to hbase...");
      HBaseAdmin hba = new HBaseAdmin(hc);
      log.info("Creating Table {}", output);
     
      if (hba.tableExists(output)) {
        hba.disableTable(output);
        hba.deleteTable(output);
        hba.majorCompact(".META.");
      }
      hba.createTable(ht);
View Full Code Here

    marshaller = context.createMarshaller();
    unmarshaller = context.createUnmarshaller();
    client = new Client(new Cluster().add("localhost",
      REST_TEST_UTIL.getServletPort()));
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    if (admin.tableExists(TABLE)) {
      return;
    }
    HTableDescriptor htd = new HTableDescriptor(TABLE);
    htd.addFamily(new HColumnDescriptor(CFA));
    htd.addFamily(new HColumnDescriptor(CFB));
View Full Code Here

    TEST_UTIL.startMiniCluster();
    REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
    client = new Client(new Cluster().add("localhost",
      REST_TEST_UTIL.getServletPort()));
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    if (admin.tableExists(TABLE)) {
      return;
    }
    HTableDescriptor htd = new HTableDescriptor(TABLE);
    htd.addFamily(new HColumnDescriptor(CFA));
    admin.createTable(htd);
View Full Code Here

    String schemaPath = "/" + TABLE1 + "/schema";
    TableSchemaModel model;
    Response response;

    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    assertFalse(admin.tableExists(TABLE1));

    // create the table
    model = TestTableSchemaModel.buildTestModel(TABLE1);
    TestTableSchemaModel.checkModel(model, TABLE1);
    response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
View Full Code Here

    conf.set("hbase.rest.readonly", "false");

    // delete the table and make sure HBase concurs
    response = client.delete(schemaPath);
    assertEquals(response.getCode(), 200);
    assertFalse(admin.tableExists(TABLE1));
  }

  @Test
  public void testTableCreateAndDeletePB() throws IOException, JAXBException {
    String schemaPath = "/" + TABLE2 + "/schema";
View Full Code Here

    String schemaPath = "/" + TABLE2 + "/schema";
    TableSchemaModel model;
    Response response;

    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    assertFalse(admin.tableExists(TABLE2));

    // create the table
    model = TestTableSchemaModel.buildTestModel(TABLE2);
    TestTableSchemaModel.checkModel(model, TABLE2);
    response = client.put(schemaPath, Constants.MIMETYPE_PROTOBUF,
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.