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


Java Action.getAction方法代码示例

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


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

示例1: buildRegionAction

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multi request for a list of actions.
 * Propagates Actions original index.
 *
 * @param regionName
 * @param actions
 * @return a multi request
 * @throws IOException
 */
public static <R> RegionAction.Builder buildRegionAction(final byte[] regionName,
    final List<Action<R>> actions, final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder)
throws IOException {
  for (Action<R> action: actions) {
    Row row = action.getAction();
    actionBuilder.clear();
    actionBuilder.setIndex(action.getOriginalIndex());
    mutationBuilder.clear();
    if (row instanceof Get) {
      Get g = (Get)row;
      regionActionBuilder.addAction(actionBuilder.setGet(ProtobufUtil.toGet(g)));
    } else if (row instanceof Put) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.PUT, (Put)row, mutationBuilder)));
    } else if (row instanceof Delete) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.DELETE, (Delete)row, mutationBuilder)));
    } else if (row instanceof Append) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.APPEND, (Append)row, mutationBuilder)));
    } else if (row instanceof Increment) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation((Increment)row, mutationBuilder)));
    } else if (row instanceof RowMutations) {
      throw new UnsupportedOperationException("No RowMutations in multi calls; use mutateRow");
    } else {
      throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
    }
  }
  return regionActionBuilder;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:43,代码来源:RequestConverter.java

示例2: buildMultiRequest

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multi request for a list of actions.
 * RowMutations in the list (if any) will be ignored.
 *
 * @param regionName
 * @param actions
 * @return a multi request
 * @throws IOException
 */
public static <R> MultiRequest buildMultiRequest(final byte[] regionName,
    final List<Action<R>> actions) throws IOException {
  MultiRequest.Builder builder = MultiRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  for (Action<R> action: actions) {
    MultiAction.Builder protoAction = MultiAction.newBuilder();

    Row row = action.getAction();
    if (row instanceof Get) {
      protoAction.setGet(ProtobufUtil.toGet((Get)row));
    } else if (row instanceof Put) {
      protoAction.setMutate(ProtobufUtil.toMutate(MutateType.PUT, (Put)row));
    } else if (row instanceof Delete) {
      protoAction.setMutate(ProtobufUtil.toMutate(MutateType.DELETE, (Delete)row));
    } else if (row instanceof Append) {
      protoAction.setMutate(ProtobufUtil.toMutate(MutateType.APPEND, (Append)row));
    } else if (row instanceof Increment) {
      protoAction.setMutate(ProtobufUtil.toMutate((Increment)row));
    } else if (row instanceof RowMutations) {
      continue; // ignore RowMutations
    } else {
      throw new DoNotRetryIOException(
        "multi doesn't support " + row.getClass().getName());
    }
    builder.addAction(protoAction.build());
  }
  return builder.build();
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:40,代码来源:RequestConverter.java

示例3: buildRegionAction

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multi request for a list of actions.
 * Propagates Actions original index.
 *
 * @param regionName
 * @param actions
 * @return a multi request
 * @throws IOException
 */
public static <R> RegionAction.Builder buildRegionAction(final byte[] regionName,
    final List<Action<R>> actions, final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder) throws IOException {
  for (Action<R> action: actions) {
    Row row = action.getAction();
    actionBuilder.clear();
    actionBuilder.setIndex(action.getOriginalIndex());
    mutationBuilder.clear();
    if (row instanceof Get) {
      Get g = (Get)row;
      regionActionBuilder.addAction(actionBuilder.setGet(ProtobufUtil.toGet(g)));
    } else if (row instanceof Put) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.PUT, (Put)row, mutationBuilder)));
    } else if (row instanceof Delete) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.DELETE, (Delete)row, mutationBuilder)));
    } else if (row instanceof Append) {
      regionActionBuilder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutation(
          MutationType.APPEND, (Append)row, mutationBuilder, action.getNonce())));
    } else if (row instanceof Increment) {
      regionActionBuilder.addAction(actionBuilder.setMutation(
          ProtobufUtil.toMutation((Increment)row, mutationBuilder, action.getNonce())));
    } else if (row instanceof RegionCoprocessorServiceExec) {
      RegionCoprocessorServiceExec exec = (RegionCoprocessorServiceExec) row;
      regionActionBuilder.addAction(actionBuilder.setServiceCall(
          ClientProtos.CoprocessorServiceCall.newBuilder()
            .setRow(ByteStringer.wrap(exec.getRow()))
            .setServiceName(exec.getMethod().getService().getFullName())
            .setMethodName(exec.getMethod().getName())
            .setRequest(exec.getRequest().toByteString())));
    } else if (row instanceof RowMutations) {
      throw new UnsupportedOperationException("No RowMutations in multi calls; use mutateRow");
    } else {
      throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
    }
  }
  return regionActionBuilder;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:50,代码来源:RequestConverter.java

示例4: buildNoDataRegionAction

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multirequest with NO data for a list of actions (data is carried
 * otherwise than via protobuf).  This means it just notes attributes, whether to write the
 * WAL, etc., and the presence in protobuf serves as place holder for the data which is
 * coming along otherwise.  Note that Get is different.  It does not contain 'data' and is always
 * carried by protobuf.  We return references to the data by adding them to the passed in
 * <code>data</code> param.
 *
 * <p>Propagates Actions original index.
 *
 * @param regionName
 * @param actions
 * @param cells Place to stuff references to actual data.
 * @return a multi request that does not carry any data.
 * @throws IOException
 */
public static <R> RegionAction.Builder buildNoDataRegionAction(final byte[] regionName,
    final List<Action<R>> actions, final List<CellScannable> cells,
    final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder) throws IOException {
  RegionAction.Builder builder = getRegionActionBuilderWithRegion(
    RegionAction.newBuilder(), regionName);
  for (Action<R> action: actions) {
    Row row = action.getAction();
    actionBuilder.clear();
    actionBuilder.setIndex(action.getOriginalIndex());
    mutationBuilder.clear();
    if (row instanceof Get) {
      Get g = (Get)row;
      builder.addAction(actionBuilder.setGet(ProtobufUtil.toGet(g)));
    } else if (row instanceof Put) {
      Put p = (Put)row;
      cells.add(p);
      builder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutationNoData(MutationType.PUT, p, mutationBuilder)));
    } else if (row instanceof Delete) {
      Delete d = (Delete)row;
      int size = d.size();
      // Note that a legitimate Delete may have a size of zero; i.e. a Delete that has nothing
      // in it but the row to delete.  In this case, the current implementation does not make
      // a KeyValue to represent a delete-of-all-the-row until we serialize... For such cases
      // where the size returned is zero, we will send the Delete fully pb'd rather than have
      // metadata only in the pb and then send the kv along the side in cells.
      if (size > 0) {
        cells.add(d);
        builder.addAction(actionBuilder.
          setMutation(ProtobufUtil.toMutationNoData(MutationType.DELETE, d, mutationBuilder)));
      } else {
        builder.addAction(actionBuilder.
          setMutation(ProtobufUtil.toMutation(MutationType.DELETE, d, mutationBuilder)));
      }
    } else if (row instanceof Append) {
      Append a = (Append)row;
      cells.add(a);
      builder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutationNoData(
        MutationType.APPEND, a, mutationBuilder, action.getNonce())));
    } else if (row instanceof Increment) {
      Increment i = (Increment)row;
      cells.add(i);
      builder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutationNoData(
        MutationType.INCREMENT, i, mutationBuilder, action.getNonce())));
    } else if (row instanceof RegionCoprocessorServiceExec) {
      RegionCoprocessorServiceExec exec = (RegionCoprocessorServiceExec) row;
      builder.addAction(actionBuilder.setServiceCall(ClientProtos.CoprocessorServiceCall
          .newBuilder().setRow(ByteStringer.wrap(exec.getRow()))
          .setServiceName(exec.getMethod().getService().getFullName())
          .setMethodName(exec.getMethod().getName())
          .setRequest(exec.getRequest().toByteString())));
    } else if (row instanceof RowMutations) {
      throw new UnsupportedOperationException("No RowMutations in multi calls; use mutateRow");
    } else {
      throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
    }
  }
  return builder;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:78,代码来源:RequestConverter.java

示例5: buildNoDataRegionAction

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multirequest with NO data for a list of actions (data is carried
 * otherwise than via protobuf).  This means it just notes attributes, whether to write the
 * WAL, etc., and the presence in protobuf serves as place holder for the data which is
 * coming along otherwise.  Note that Get is different.  It does not contain 'data' and is always
 * carried by protobuf.  We return references to the data by adding them to the passed in
 * <code>data</code> param.
 *
 * <p>Propagates Actions original index.
 *
 * @param regionName
 * @param actions
 * @param cells Place to stuff references to actual data.
 * @return a multi request that does not carry any data.
 * @throws IOException
 */
public static <R> RegionAction.Builder buildNoDataRegionAction(final byte[] regionName,
    final List<Action<R>> actions, final List<CellScannable> cells,
    final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder) throws IOException {
  RegionAction.Builder builder = getRegionActionBuilderWithRegion(
    RegionAction.newBuilder(), regionName);
  for (Action<R> action: actions) {
    Row row = action.getAction();
    actionBuilder.clear();
    actionBuilder.setIndex(action.getOriginalIndex());
    mutationBuilder.clear();
    if (row instanceof Get) {
      Get g = (Get)row;
      builder.addAction(actionBuilder.setGet(ProtobufUtil.toGet(g)));
    } else if (row instanceof Put) {
      Put p = (Put)row;
      cells.add(p);
      builder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutationNoData(MutationType.PUT, p, mutationBuilder)));
    } else if (row instanceof Delete) {
      Delete d = (Delete)row;
      int size = d.size();
      // Note that a legitimate Delete may have a size of zero; i.e. a Delete that has nothing
      // in it but the row to delete.  In this case, the current implementation does not make
      // a KeyValue to represent a delete-of-all-the-row until we serialize... For such cases
      // where the size returned is zero, we will send the Delete fully pb'd rather than have
      // metadata only in the pb and then send the kv along the side in cells.
      if (size > 0) {
        cells.add(d);
        builder.addAction(actionBuilder.
          setMutation(ProtobufUtil.toMutationNoData(MutationType.DELETE, d, mutationBuilder)));
      } else {
        builder.addAction(actionBuilder.
          setMutation(ProtobufUtil.toMutation(MutationType.DELETE, d, mutationBuilder)));
      }
    } else if (row instanceof Append) {
      Append a = (Append)row;
      cells.add(a);
      builder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutationNoData(
        MutationType.APPEND, a, mutationBuilder, action.getNonce())));
    } else if (row instanceof Increment) {
      Increment i = (Increment)row;
      cells.add(i);
      builder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutationNoData(
        MutationType.INCREMENT, i, mutationBuilder, action.getNonce())));
    } else if (row instanceof RowMutations) {
      continue; // ignore RowMutations
    } else {
      throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
    }
  }
  return builder;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:71,代码来源:RequestConverter.java

示例6: buildRegionAction

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multi request for a list of actions.
 * Propagates Actions original index.
 *
 * @param regionName
 * @param actions
 * @return a multi request
 * @throws IOException
 */
public static <R> RegionAction.Builder buildRegionAction(final byte[] regionName,
    final List<Action<R>> actions, final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder) throws IOException {
  for (Action<R> action: actions) {
    Row row = action.getAction();
    actionBuilder.clear();
    actionBuilder.setIndex(action.getOriginalIndex());
    mutationBuilder.clear();
    if (row instanceof Get) {
      Get g = (Get)row;
      regionActionBuilder.addAction(actionBuilder.setGet(ProtobufUtil.toGet(g)));
    } else if (row instanceof Put) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.PUT, (Put)row, mutationBuilder)));
    } else if (row instanceof Delete) {
      regionActionBuilder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutation(MutationType.DELETE, (Delete)row, mutationBuilder)));
    } else if (row instanceof Append) {
      regionActionBuilder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutation(
          MutationType.APPEND, (Append)row, mutationBuilder, action.getNonce())));
    } else if (row instanceof Increment) {
      regionActionBuilder.addAction(actionBuilder.setMutation(
          ProtobufUtil.toMutation((Increment)row, mutationBuilder, action.getNonce())));
    } else if (row instanceof RegionCoprocessorServiceExec) {
      RegionCoprocessorServiceExec exec = (RegionCoprocessorServiceExec) row;
      regionActionBuilder.addAction(actionBuilder.setServiceCall(
          ClientProtos.CoprocessorServiceCall.newBuilder()
            .setRow(HBaseZeroCopyByteString.wrap(exec.getRow()))
            .setServiceName(exec.getMethod().getService().getFullName())
            .setMethodName(exec.getMethod().getName())
            .setRequest(exec.getRequest().toByteString())));
    } else if (row instanceof RowMutations) {
      throw new UnsupportedOperationException("No RowMutations in multi calls; use mutateRow");
    } else {
      throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
    }
  }
  return regionActionBuilder;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:50,代码来源:RequestConverter.java

示例7: buildNoDataRegionAction

import org.apache.hadoop.hbase.client.Action; //导入方法依赖的package包/类
/**
 * Create a protocol buffer multirequest with NO data for a list of actions (data is carried
 * otherwise than via protobuf).  This means it just notes attributes, whether to write the
 * WAL, etc., and the presence in protobuf serves as place holder for the data which is
 * coming along otherwise.  Note that Get is different.  It does not contain 'data' and is always
 * carried by protobuf.  We return references to the data by adding them to the passed in
 * <code>data</code> param.
 *
 * <p>Propagates Actions original index.
 *
 * @param regionName
 * @param actions
 * @param cells Place to stuff references to actual data.
 * @return a multi request that does not carry any data.
 * @throws IOException
 */
public static <R> RegionAction.Builder buildNoDataRegionAction(final byte[] regionName,
    final List<Action<R>> actions, final List<CellScannable> cells,
    final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder)
throws IOException {
  RegionAction.Builder builder =
    getRegionActionBuilderWithRegion(RegionAction.newBuilder(), regionName);
  for (Action<R> action: actions) {
    Row row = action.getAction();
    actionBuilder.clear();
    actionBuilder.setIndex(action.getOriginalIndex());
    mutationBuilder.clear();
    if (row instanceof Get) {
      Get g = (Get)row;
      builder.addAction(actionBuilder.setGet(ProtobufUtil.toGet(g)));
    } else if (row instanceof Put) {
      Put p = (Put)row;
      cells.add(p);
      builder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutationNoData(MutationType.PUT, p, mutationBuilder)));
    } else if (row instanceof Delete) {
      Delete d = (Delete)row;
      int size = d.size();
      // Note that a legitimate Delete may have a size of zero; i.e. a Delete that has nothing
      // in it but the row to delete.  In this case, the current implementation does not make
      // a KeyValue to represent a delete-of-all-the-row until we serialize... For such cases
      // where the size returned is zero, we will send the Delete fully pb'd rather than have
      // metadata only in the pb and then send the kv along the side in cells.
      if (size > 0) {
        cells.add(d);
        builder.addAction(actionBuilder.
          setMutation(ProtobufUtil.toMutationNoData(MutationType.DELETE, d, mutationBuilder)));
      } else {
        builder.addAction(actionBuilder.
          setMutation(ProtobufUtil.toMutation(MutationType.DELETE, d, mutationBuilder)));
      }
    } else if (row instanceof Append) {
      Append a = (Append)row;
      cells.add(a);
      builder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutationNoData(MutationType.APPEND, a, mutationBuilder)));
    } else if (row instanceof Increment) {
      Increment i = (Increment)row;
      cells.add(i);
      builder.addAction(actionBuilder.
        setMutation(ProtobufUtil.toMutationNoData(MutationType.INCREMENT, i, mutationBuilder)));
    } else if (row instanceof RowMutations) {
      continue; // ignore RowMutations
    } else {
      throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
    }
  }
  return builder;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:72,代码来源:RequestConverter.java


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