Package org.apache.hadoop.hbase.rest.client

Examples of org.apache.hadoop.hbase.rest.client.RemoteHTable


      put.add(COLUMN_1, QUALIFIER_1, TS_2, VALUE_2);
      put.add(COLUMN_2, QUALIFIER_2, TS_2, VALUE_2);
      table.put(put);
      table.flushCommits();
    }
    remoteTable = new RemoteHTable(
      new Client(new Cluster().add("localhost",
          REST_TEST_UTIL.getServletPort())),
        TEST_UTIL.getConfiguration(), TABLE, null);
  }
View Full Code Here


    td.addFamily(cd);
    cd = new HColumnDescriptor(FAMILY2);
    td.addFamily(cd);
    remoteAdmin.createTable(td);

    RemoteHTable table = controller.getRemoteHTable(TABLE);

    Put put = new Put(ROW);
    put.add(FAMILY1, QUALIFIER, VALUE);
    table.put(put);

    Scan scan = new Scan();
    scan.addColumn(FAMILY2, Bytes.toBytes("bogus"));
    ResultScanner scanner = table.getScanner(scan);
    Result result = scanner.next();
    assertTrue("Expected null result", result == null);
    scanner.close();

    System.out.println("Done.");
View Full Code Here

      HBaseRestServerClusterActionHandler.ROLE)).getPublicAddress();
    restClient = new Client(new org.apache.hadoop.hbase.rest.client.Cluster()
      .add(restAddress.getHostName(), HBaseRestServerClusterActionHandler.
        PORT));
    remoteAdmin = new RemoteAdmin(restClient, conf);
    remoteMetaTable = new RemoteHTable(restClient, conf,
      HConstants.META_TABLE_NAME, null);
    waitForMaster();
    running = true;
  }
View Full Code Here

  public RemoteAdmin getRemoteAdmin() {
    return remoteAdmin;
  }

  public RemoteHTable getRemoteHTable(String tableName) {
    return new RemoteHTable(restClient, getConfiguration(), tableName, null);
  }
View Full Code Here

    Cluster cluster = new Cluster();
    cluster.add("localhost", 8080); // co RestExample-1-Cluster Set up a cluster list adding all known REST server hosts.

    Client client = new Client(cluster); // co RestExample-2-Client Create the client handling the HTTP communication.

    RemoteHTable table = new RemoteHTable(client, "testtable"); // co RestExample-3-Table Create a remote table instance, wrapping the REST access into a familiar interface.

    Get get = new Get(Bytes.toBytes("row-30")); // co RestExample-4-Get Perform a get operation as if it were a direct HBase connection.
    get.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("col-3"));
    Result result1 = table.get(get);

    System.out.println("Get result1: " + result1);

    Scan scan = new Scan();
    scan.setStartRow(Bytes.toBytes("row-10"));
    scan.setStopRow(Bytes.toBytes("row-15"));
    scan.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("col-5"));
    ResultScanner scanner = table.getScanner(scan); // co RestExample-5-Scan Scan the table, again, the same approach as if using the native Java API.

    for (Result result2 : scanner) {
      System.out.println("Scan row[" + Bytes.toString(result2.getRow()) +
        "]: " + result2);
    }
View Full Code Here

      put.add(COLUMN_1, QUALIFIER_1, TS_2, VALUE_2);
      put.add(COLUMN_2, QUALIFIER_2, TS_2, VALUE_2);
      table.put(put);
      table.flushCommits();
    }
    remoteTable = new RemoteHTable(
      new Client(new Cluster().add("localhost",
          REST_TEST_UTIL.getServletPort())),
        TEST_UTIL.getConfiguration(), TABLE);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.rest.client.RemoteHTable

Copyright © 2018 www.massapicom. 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.