Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HTable.checkAndPut()


      table.checkAndPut(row1, fam, qual, null, put);
      byte[] row2 = Bytes.toBytes("row2");
      put = new Put(row2);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET));
      table.checkAndPut(row2, fam, qual, null, put);
     
      Scan scan = new Scan();
      scan.setAuthorizations(new Authorizations(SECRET));
      ResultScanner scanner = table.getScanner(scan);
      Result result = scanner.next();
View Full Code Here


          new String[] {"hadPreCheckAndPut",
              "hadPreCheckAndPutAfterRowLock", "hadPostCheckAndPut"},
          tableName,
          new Boolean[] {false, false, false}
          );
      table.checkAndPut(Bytes.toBytes(0), A, A, A, p);
      verifyMethodResult(SimpleRegionObserver.class,
          new String[] {"hadPreCheckAndPut",
              "hadPreCheckAndPutAfterRowLock", "hadPostCheckAndPut"},
          tableName,
          new Boolean[] {true, true, true}
View Full Code Here

      public Object run() throws Exception {
        Put p = new Put(TEST_ROW);
        p.add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));
        HTable t = new HTable(conf, TEST_TABLE.getTableName());
        try {
          t.checkAndPut(TEST_ROW, TEST_FAMILY, TEST_QUALIFIER,
           Bytes.toBytes("test_value"), p);
        } finally {
          t.close();
        }
        return null;
View Full Code Here

      table = TEST_UTIL.createTable(tableName, fam);
      byte[] row1 = Bytes.toBytes("row1");
      Put put = new Put(row1);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET + " & " + CONFIDENTIAL));
      table.checkAndPut(row1, fam, qual, null, put);
      byte[] row2 = Bytes.toBytes("row2");
      put = new Put(row2);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET));
      table.checkAndPut(row2, fam, qual, null, put);
View Full Code Here

      table.checkAndPut(row1, fam, qual, null, put);
      byte[] row2 = Bytes.toBytes("row2");
      put = new Put(row2);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET));
      table.checkAndPut(row2, fam, qual, null, put);
     
      Scan scan = new Scan();
      scan.setAuthorizations(new Authorizations(SECRET));
      ResultScanner scanner = table.getScanner(scan);
      Result result = scanner.next();
View Full Code Here

      public Object run() throws Exception {
        Put p = new Put(Bytes.toBytes("random_row"));
        p.add(TEST_FAMILY, Bytes.toBytes("Qualifier"), Bytes.toBytes(1));

        HTable t = new HTable(conf, TEST_TABLE);
        t.checkAndPut(Bytes.toBytes("random_row"), TEST_FAMILY, Bytes.toBytes("q"),
          Bytes.toBytes("test_value"), p);
        return null;
      }
    };
    verifyReadWrite(checkAndPut);
View Full Code Here

      public Object run() throws Exception {
        Put p = new Put(Bytes.toBytes("random_row"));
        p.add(TEST_FAMILY, Bytes.toBytes("Qualifier"), Bytes.toBytes(1));

        HTable t = new HTable(conf, TEST_TABLE);
        t.checkAndPut(Bytes.toBytes("random_row"),
                      TEST_FAMILY, Bytes.toBytes("q"),
                      Bytes.toBytes("test_value"), p);
        return null;
      }
    };
View Full Code Here

      public Object run() throws Exception {
        Put p = new Put(Bytes.toBytes("random_row"));
        p.add(TEST_FAMILY, Bytes.toBytes("Qualifier"), Bytes.toBytes(1));

        HTable t = new HTable(conf, TEST_TABLE);
        t.checkAndPut(Bytes.toBytes("random_row"), TEST_FAMILY, Bytes.toBytes("q"),
          Bytes.toBytes("test_value"), p);
        return null;
      }
    };
    verifyReadWrite(checkAndPut);
View Full Code Here

    HTable table = rm.getTable(UserTable.NAME);
    try {
      Put put = new Put(ADMIN_LOGIN);
      put.add(UserTable.DATA_FAMILY, UserTable.CREDENTIALS, ADMIN_PASSWORD);
      put.add(UserTable.DATA_FAMILY, UserTable.ROLES, UserTable.ADMIN_ROLES);
      boolean hasPut = table.checkAndPut(ADMIN_LOGIN, UserTable.DATA_FAMILY,
        UserTable.ROLES, null, put);
      if (hasPut) {
        LOG.info("Admin user initialized.");
      }
    } catch (Exception e) {
View Full Code Here

    HTable table = rm.getTable(HushTable.NAME);
    try {
      Put put = new Put(HushTable.GLOBAL_ROW_KEY);
      put.add(HushTable.COUNTERS_FAMILY, HushTable.ANONYMOUS_USER_ID,
        Bytes.toBytes(HushUtil.hushDecode("0")));
      boolean hasPut = table.checkAndPut(HushTable.GLOBAL_ROW_KEY,
        HushTable.COUNTERS_FAMILY, HushTable.SHORT_ID, null, put);
      if (hasPut) {
        LOG.info("Anonymous User Id counter initialized.");
      }
      table.flushCommits();
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.