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


Java CellSetModel.getObjectFromMessage方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.CellSetModel.getObjectFromMessage方法的典型用法代码示例。如果您正苦于以下问题:Java CellSetModel.getObjectFromMessage方法的具体用法?Java CellSetModel.getObjectFromMessage怎么用?Java CellSetModel.getObjectFromMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.rest.model.CellSetModel的用法示例。


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

示例1: getResults

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private Result[] getResults(String spec) throws IOException {
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(spec, Constants.MIMETYPE_PROTOBUF);
    int code = response.getCode();
    switch (code) {
      case 200:
        CellSetModel model = new CellSetModel();
        model.getObjectFromMessage(response.getBody());
        Result[] results = buildResultFromModel(model);
        if ( results.length > 0) {
          return results;
        }
        // fall through
      case 404:
        return new Result[0];

      case 509:
        try {
          Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
          throw (InterruptedIOException)new InterruptedIOException().initCause(e);
        }
        break;
      default:
        throw new IOException("get request returned " + code);
    }
  }
  throw new IOException("get request timed out");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:RemoteHTable.java

示例2: next

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
@Override
public Result[] next(int nbRows) throws IOException {
  StringBuilder sb = new StringBuilder(uri);
  sb.append("?n=");
  sb.append(nbRows);
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(sb.toString(),
      Constants.MIMETYPE_PROTOBUF);
    int code = response.getCode();
    switch (code) {
    case 200:
      CellSetModel model = new CellSetModel();
      model.getObjectFromMessage(response.getBody());
      return buildResultFromModel(model);
    case 204:
    case 206:
      return null;
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
      break;
    default:
      throw new IOException("scanner.next request failed with " + code);
    }
  }
  throw new IOException("scanner.next request timed out");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:RemoteHTable.java

示例3: fullTableScan

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private static int fullTableScan(ScannerModel model) throws IOException {
  model.setBatch(100);
  Response response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
  assertEquals(response.getCode(), 201);
  String scannerURI = response.getLocation();
  assertNotNull(scannerURI);
  int count = 0;
  while (true) {
    response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
    assertTrue(response.getCode() == 200 || response.getCode() == 204);
    if (response.getCode() == 200) {
      assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
      CellSetModel cellSet = new CellSetModel();
      cellSet.getObjectFromMessage(response.getBody());
      Iterator<RowModel> rows = cellSet.getRows().iterator();
      while (rows.hasNext()) {
        RowModel row = rows.next();
        Iterator<CellModel> cells = row.getCells().iterator();
        while (cells.hasNext()) {
          cells.next();
          count++;
        }
      }
    } else {
      break;
    }
  }
  // delete the scanner
  response = client.delete(scannerURI);
  assertEquals(response.getCode(), 200);
  return count;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:TestScannerResource.java

示例4: checkValuePB

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
protected static void checkValuePB(String table, String row, String column,
    String value) throws IOException {
  Response response = getValuePB(table, row, column);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
  CellSetModel cellSet = new CellSetModel();
  cellSet.getObjectFromMessage(response.getBody());
  RowModel rowModel = cellSet.getRows().get(0);
  CellModel cell = rowModel.getCells().get(0);
  assertEquals(Bytes.toString(cell.getColumn()), column);
  assertEquals(Bytes.toString(cell.getValue()), value);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:RowResourceBase.java

示例5: getResults

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private Result[] getResults(String spec) throws IOException {
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(spec, Constants.MIMETYPE_PROTOBUF);
    int code = response.getCode();
    switch (code) {
      case 200:
        CellSetModel model = new CellSetModel();
        model.getObjectFromMessage(response.getBody());
        Result[] results = buildResultFromModel(model);
        if (results.length > 0) {
          return results;
        }
        // fall through
      case 404:
        return new Result[0];

      case 509:
        try {
          Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
        }
        break;
      default:
        throw new IOException("get request returned " + code);
    }
  }
  throw new IOException("get request timed out");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:RemoteHTable.java

示例6: next

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
@Override
public Result[] next(int nbRows) throws IOException {
  StringBuilder sb = new StringBuilder(uri);
  sb.append("?n=");
  sb.append(nbRows);
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(sb.toString(),
      Constants.MIMETYPE_PROTOBUF);
    int code = response.getCode();
    switch (code) {
    case 200:
      CellSetModel model = new CellSetModel();
      model.getObjectFromMessage(response.getBody());
      return buildResultFromModel(model);
    case 204:
    case 206:
      return null;
    case 509:
      try {
        Thread.sleep(sleepTime);
      } catch (InterruptedException e) { }
      break;
    default:
      throw new IOException("scanner.next request failed with " + code);
    }
  }
  throw new IOException("scanner.next request timed out");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:RemoteHTable.java

示例7: checkValuePB

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private static void checkValuePB(String table, String row, String column, 
    String value) throws IOException {
  Response response = getValuePB(table, row, column);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
  CellSetModel cellSet = new CellSetModel();
  cellSet.getObjectFromMessage(response.getBody());
  RowModel rowModel = cellSet.getRows().get(0);
  CellModel cell = rowModel.getCells().get(0);
  assertEquals(Bytes.toString(cell.getColumn()), column);
  assertEquals(Bytes.toString(cell.getValue()), value);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:TestRowResource.java

示例8: getResults

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private Result[] getResults(String spec) throws IOException {
  for (int i = 0; i < maxRetries; i++) {
    Response response = client.get(spec, Constants.MIMETYPE_PROTOBUF);
    int code = response.getCode();
    switch (code) {
      case 200:
        CellSetModel model = new CellSetModel();
        model.getObjectFromMessage(response.getBody());
        Result[] results = buildResultFromModel(model);
        if ( results.length > 0) {
          return results;
        }
        // fall through
      case 404:
        return new Result[0];

      case 509:
        try {
          Thread.sleep(sleepTime);
        } catch (InterruptedException e) { }
        break;
      default:
        throw new IOException("get request returned " + code);
    }
  }
  throw new IOException("get request timed out");
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:28,代码来源:RemoteHTable.java

示例9: fullTableScan

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private static int fullTableScan(ScannerModel model) throws IOException {
  model.setBatch(100);
  Response response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
  assertEquals(201, response.getCode());
  String scannerURI = response.getLocation();
  assertNotNull(scannerURI);
  int count = 0;
  while (true) {
    response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
    assertTrue(response.getCode() == 200 || response.getCode() == 204);
    if (response.getCode() == 200) {
      assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
      CellSetModel cellSet = new CellSetModel();
      cellSet.getObjectFromMessage(response.getBody());
      Iterator<RowModel> rows = cellSet.getRows().iterator();
      while (rows.hasNext()) {
        RowModel row = rows.next();
        Iterator<CellModel> cells = row.getCells().iterator();
        while (cells.hasNext()) {
          cells.next();
          count++;
        }
      }
    } else {
      break;
    }
  }
  // delete the scanner
  response = client.delete(scannerURI);
  assertEquals(200, response.getCode());
  return count;
}
 
开发者ID:apache,项目名称:hbase,代码行数:34,代码来源:TestScannerResource.java

示例10: checkValuePB

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
protected static void checkValuePB(String table, String row, String column,
    String value) throws IOException {
  Response response = getValuePB(table, row, column);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
  CellSetModel cellSet = new CellSetModel();
  cellSet.getObjectFromMessage(response.getBody());
  RowModel rowModel = cellSet.getRows().get(0);
  CellModel cell = rowModel.getCells().get(0);
  assertEquals(Bytes.toString(cell.getColumn()), column);
  assertEquals(Bytes.toString(cell.getValue()), value);
}
 
开发者ID:apache,项目名称:hbase,代码行数:13,代码来源:RowResourceBase.java

示例11: testSimpleScannerPB

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
@Test
public void testSimpleScannerPB() throws IOException {
  final int BATCH_SIZE = 10;
  // new scanner
  ScannerModel model = new ScannerModel();
  model.setBatch(BATCH_SIZE);
  model.addColumn(Bytes.toBytes(COLUMN_1));

  // test put operation is forbidden in read-only mode
  conf.set("hbase.rest.readonly", "true");
  Response response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
  assertEquals(response.getCode(), 403);
  String scannerURI = response.getLocation();
  assertNull(scannerURI);

  // recall previous put operation with read-only off
  conf.set("hbase.rest.readonly", "false");
  response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
  assertEquals(response.getCode(), 201);
  scannerURI = response.getLocation();
  assertNotNull(scannerURI);

  // get a cell set
  response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
  CellSetModel cellSet = new CellSetModel();
  cellSet.getObjectFromMessage(response.getBody());
  // confirm batch size conformance
  assertEquals(countCellSet(cellSet), BATCH_SIZE);

  // test delete scanner operation is forbidden in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.delete(scannerURI);
  assertEquals(response.getCode(), 403);

  // recall previous delete scanner operation with read-only off
  conf.set("hbase.rest.readonly", "false");
  response = client.delete(scannerURI);
  assertEquals(response.getCode(), 200);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:44,代码来源:TestScannerResource.java

示例12: testSimpleScannerPB

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
@Test
public void testSimpleScannerPB() throws IOException {
  final int BATCH_SIZE = 10;
  // new scanner
  ScannerModel model = new ScannerModel();
  model.setBatch(BATCH_SIZE);
  model.addColumn(Bytes.toBytes(COLUMN_1));

  // test put operation is forbidden in read-only mode
  conf.set("hbase.rest.readonly", "true");
  Response response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
  assertEquals(403, response.getCode());
  String scannerURI = response.getLocation();
  assertNull(scannerURI);

  // recall previous put operation with read-only off
  conf.set("hbase.rest.readonly", "false");
  response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
  assertEquals(201, response.getCode());
  scannerURI = response.getLocation();
  assertNotNull(scannerURI);

  // get a cell set
  response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
  CellSetModel cellSet = new CellSetModel();
  cellSet.getObjectFromMessage(response.getBody());
  // confirm batch size conformance
  assertEquals(BATCH_SIZE, countCellSet(cellSet));

  // test delete scanner operation is forbidden in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.delete(scannerURI);
  assertEquals(403, response.getCode());

  // recall previous delete scanner operation with read-only off
  conf.set("hbase.rest.readonly", "false");
  response = client.delete(scannerURI);
  assertEquals(200, response.getCode());
}
 
开发者ID:apache,项目名称:hbase,代码行数:44,代码来源:TestScannerResource.java


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