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


Java ByteArrayComparable类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.filter.ByteArrayComparable的典型用法代码示例。如果您正苦于以下问题:Java ByteArrayComparable类的具体用法?Java ByteArrayComparable怎么用?Java ByteArrayComparable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ByteArrayComparable类属于org.apache.hadoop.hbase.filter包,在下文中一共展示了ByteArrayComparable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildMutateRequest

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * Create a protocol buffer MutateRequest for a conditioned delete
 *
 * @param regionName
 * @param row
 * @param family
 * @param qualifier
 * @param comparator
 * @param compareType
 * @param delete
 * @return a mutate request
 * @throws IOException
 */
public static MutateRequest buildMutateRequest(
    final byte[] regionName, final byte[] row, final byte[] family,
    final byte [] qualifier, final ByteArrayComparable comparator,
    final CompareType compareType, final Delete delete) throws IOException {
  MutateRequest.Builder builder = MutateRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  Condition condition = buildCondition(
    row, family, qualifier, comparator, compareType);
  builder.setMutation(ProtobufUtil.toMutation(MutationType.DELETE, delete,
    MutationProto.newBuilder()));
  builder.setCondition(condition);
  return builder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:RequestConverter.java

示例2: preCheckAndPutAfterRowLock

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
@Override
public boolean preCheckAndPutAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
    final byte[] row, final byte[] family, final byte[] qualifier,
    final CompareFilter.CompareOp compareOp, final ByteArrayComparable comparator, final Put put,
    final boolean result) throws IOException {
  if (put.getAttribute(CHECK_COVERING_PERM) != null) {
    // We had failure with table, cf and q perm checks and now giving a chance for cell
    // perm check
    TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
    Map<byte[], ? extends Collection<byte[]>> families = makeFamilyMap(family, qualifier);
    AuthResult authResult = null;
    if (checkCoveringPermission(OpType.CHECK_AND_PUT, c.getEnvironment(), row, families,
        HConstants.LATEST_TIMESTAMP, Action.READ)) {
      authResult = AuthResult.allow(OpType.CHECK_AND_PUT.toString(), "Covering cell set",
          getActiveUser(), Action.READ, table, families);
    } else {
      authResult = AuthResult.deny(OpType.CHECK_AND_PUT.toString(), "Covering cell set",
          getActiveUser(), Action.READ, table, families);
    }
    logResult(authResult);
    if (authorizationEnabled && !authResult.isAllowed()) {
      throw new AccessDeniedException("Insufficient permissions " + authResult.toContextString());
    }
  }
  return result;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:AccessController.java

示例3: toComparator

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * Convert a protocol buffer Comparator to a ByteArrayComparable
 *
 * @param proto the protocol buffer Comparator to convert
 * @return the converted ByteArrayComparable
 */
@SuppressWarnings("unchecked")
public static ByteArrayComparable toComparator(ComparatorProtos.Comparator proto)
throws IOException {
  String type = proto.getName();
  String funcName = "parseFrom";
  byte [] value = proto.getSerializedComparator().toByteArray();
  try {
    Class<? extends ByteArrayComparable> c =
      (Class<? extends ByteArrayComparable>)Class.forName(type, true, CLASS_LOADER);
    Method parseFrom = c.getMethod(funcName, byte[].class);
    if (parseFrom == null) {
      throw new IOException("Unable to locate function: " + funcName + " in type: " + type);
    }
    return (ByteArrayComparable)parseFrom.invoke(null, value);
  } catch (Exception e) {
    throw new IOException(e);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:ProtobufUtil.java

示例4: ByteArrayComparableModel

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
public ByteArrayComparableModel(
    ByteArrayComparable comparator) {
  String typeName = comparator.getClass().getSimpleName();
  ComparatorType type = ComparatorType.valueOf(typeName);
  this.type = typeName;
  switch (type) {
    case BinaryComparator:
    case BinaryPrefixComparator:
      this.value = Base64.encodeBytes(comparator.getValue());
      break;
    case BitComparator:
      this.value = Base64.encodeBytes(comparator.getValue());
      this.op = ((BitComparator)comparator).getOperator().toString();
      break;
    case NullComparator:
      break;
    case RegexStringComparator:
    case SubstringComparator:
      this.value = Bytes.toString(comparator.getValue());
      break;
    default:
      throw new RuntimeException("unhandled filter type: " + type);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:ScannerModel.java

示例5: preCheckAndPutAfterRowLock

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
@Override
public boolean preCheckAndPutAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
    final byte[] row, final byte[] family, final byte[] qualifier,
    final CompareFilter.CompareOp compareOp, final ByteArrayComparable comparator, final Put put,
    final boolean result) throws IOException {
  if (put.getAttribute(CHECK_COVERING_PERM) != null) {
    // We had failure with table, cf and q perm checks and now giving a chance for cell
    // perm check
    TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
    Map<byte[], ? extends Collection<byte[]>> families = makeFamilyMap(family, qualifier);
    AuthResult authResult = null;
    if (checkCoveringPermission(OpType.CHECK_AND_PUT, c.getEnvironment(), row, families,
        HConstants.LATEST_TIMESTAMP, Action.READ)) {
      authResult = AuthResult.allow(OpType.CHECK_AND_PUT.toString(), "Covering cell set",
          getActiveUser(), Action.READ, table, families);
    } else {
      authResult = AuthResult.deny(OpType.CHECK_AND_PUT.toString(), "Covering cell set",
          getActiveUser(), Action.READ, table, families);
    }
    logResult(authResult);
    if (!authResult.isAllowed()) {
      throw new AccessDeniedException("Insufficient permissions " + authResult.toContextString());
    }
  }
  return result;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:27,代码来源:AccessController.java

示例6: preCheckAndPut

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * Supports Coprocessor 'bypass'.
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param op the comparison operation
 * @param comparator the comparator
 * @param put data to put if check succeeds
 * @return true or false to return to client if default processing should be bypassed, or null
 * otherwise
 */
public Boolean preCheckAndPut(final byte [] row, final byte [] family,
    final byte [] qualifier, final CompareOperator op,
    final ByteArrayComparable comparator, final Put put)
    throws IOException {
  boolean bypassable = true;
  boolean defaultResult = false;
  if (coprocEnvironments.isEmpty()) {
    return null;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionObserver, Boolean>(regionObserverGetter,
          defaultResult,  bypassable) {
        @Override
        public Boolean call(RegionObserver observer) throws IOException {
          return observer.preCheckAndPut(this, row, family, qualifier,
              op, comparator, put, getResult());
        }
      });
}
 
开发者ID:apache,项目名称:hbase,代码行数:31,代码来源:RegionCoprocessorHost.java

示例7: preCheckAndPutAfterRowLock

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * Supports Coprocessor 'bypass'.
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param op the comparison operation
 * @param comparator the comparator
 * @param put data to put if check succeeds
 * @return true or false to return to client if default processing should be bypassed, or null
 * otherwise
 */
public Boolean preCheckAndPutAfterRowLock(
    final byte[] row, final byte[] family, final byte[] qualifier, final CompareOperator op,
    final ByteArrayComparable comparator, final Put put) throws IOException {
  boolean bypassable = true;
  boolean defaultResult = false;
  if (coprocEnvironments.isEmpty()) {
    return null;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionObserver, Boolean>(regionObserverGetter,
          defaultResult, bypassable) {
        @Override
        public Boolean call(RegionObserver observer) throws IOException {
          return observer.preCheckAndPutAfterRowLock(this, row, family, qualifier,
              op, comparator, put, getResult());
        }
      });
}
 
开发者ID:apache,项目名称:hbase,代码行数:30,代码来源:RegionCoprocessorHost.java

示例8: postCheckAndPut

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param op the comparison operation
 * @param comparator the comparator
 * @param put data to put if check succeeds
 * @throws IOException e
 */
public boolean postCheckAndPut(final byte [] row, final byte [] family,
    final byte [] qualifier, final CompareOperator op,
    final ByteArrayComparable comparator, final Put put,
    boolean result) throws IOException {
  if (this.coprocEnvironments.isEmpty()) {
    return result;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionObserver, Boolean>(regionObserverGetter, result) {
        @Override
        public Boolean call(RegionObserver observer) throws IOException {
          return observer.postCheckAndPut(this, row, family, qualifier,
              op, comparator, put, getResult());
        }
      });
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:RegionCoprocessorHost.java

示例9: preCheckAndDelete

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * Supports Coprocessor 'bypass'.
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param op the comparison operation
 * @param comparator the comparator
 * @param delete delete to commit if check succeeds
 * @return true or false to return to client if default processing should be bypassed,
 * or null otherwise
 */
public Boolean preCheckAndDelete(final byte [] row, final byte [] family,
    final byte [] qualifier, final CompareOperator op,
    final ByteArrayComparable comparator, final Delete delete)
    throws IOException {
  boolean bypassable = true;
  boolean defaultResult = false;
  if (coprocEnvironments.isEmpty()) {
    return null;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionObserver, Boolean>(regionObserverGetter,
          defaultResult, bypassable) {
        @Override
        public Boolean call(RegionObserver observer) throws IOException {
          return observer.preCheckAndDelete(this, row, family,
              qualifier, op, comparator, delete, getResult());
        }
      });
}
 
开发者ID:apache,项目名称:hbase,代码行数:31,代码来源:RegionCoprocessorHost.java

示例10: preCheckAndDeleteAfterRowLock

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * Supports Coprocessor 'bypass'.
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param op the comparison operation
 * @param comparator the comparator
 * @param delete delete to commit if check succeeds
 * @return true or false to return to client if default processing should be bypassed,
 * or null otherwise
 */
public Boolean preCheckAndDeleteAfterRowLock(final byte[] row, final byte[] family,
    final byte[] qualifier, final CompareOperator op, final ByteArrayComparable comparator,
    final Delete delete) throws IOException {
  boolean bypassable = true;
  boolean defaultResult = false;
  if (coprocEnvironments.isEmpty()) {
    return null;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionObserver, Boolean>(regionObserverGetter,
          defaultResult, bypassable) {
        @Override
        public Boolean call(RegionObserver observer) throws IOException {
          return observer.preCheckAndDeleteAfterRowLock(this, row,
              family, qualifier, op, comparator, delete, getResult());
        }
      });
}
 
开发者ID:apache,项目名称:hbase,代码行数:30,代码来源:RegionCoprocessorHost.java

示例11: postCheckAndDelete

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param op the comparison operation
 * @param comparator the comparator
 * @param delete delete to commit if check succeeds
 * @throws IOException e
 */
public boolean postCheckAndDelete(final byte [] row, final byte [] family,
    final byte [] qualifier, final CompareOperator op,
    final ByteArrayComparable comparator, final Delete delete,
    boolean result) throws IOException {
  if (this.coprocEnvironments.isEmpty()) {
    return result;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionObserver, Boolean>(regionObserverGetter, result) {
        @Override
        public Boolean call(RegionObserver observer) throws IOException {
          return observer.postCheckAndDelete(this, row, family,
              qualifier, op, comparator, delete, getResult());
        }
      });
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:RegionCoprocessorHost.java

示例12: checkAndPut

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
private boolean checkAndPut(MutationProto mutation, Condition condition) throws IOException {
  boolean success;
  final byte[] row = condition.getRow().array();
  final byte[] cf = condition.getFamily().array();
  final byte[] cq = condition.getQualifier().array();

  final CompareFilter.CompareOp compareOp = CompareFilter.CompareOp.valueOf(condition.getCompareType().name());
  final ByteArrayComparable comparator = ReverseProtobufUtil.toComparator(condition.getComparator());

  success = theRegion.checkAndMutate(row,
      cf,
      cq,
      compareOp,
      comparator,
      ReverseProtobufUtil.toPut(mutation),
      true);
  return success;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:19,代码来源:HRegionBridge.java

示例13: checkAndDelete

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
private boolean checkAndDelete(MutationProto mutation, Condition condition) throws IOException {
  boolean success;
  final byte[] row = condition.getRow().array();
  final byte[] cf = condition.getFamily().array();
  final byte[] cq = condition.getQualifier().array();

  final CompareFilter.CompareOp compareOp = CompareFilter.CompareOp.valueOf(condition.getCompareType().name());
  final ByteArrayComparable comparator = ReverseProtobufUtil.toComparator(condition.getComparator());

  success = theRegion.checkAndMutate(row,
      cf,
      cq,
      compareOp,
      comparator,
      ReverseProtobufUtil.toDelete(mutation),
      true);
  return success;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:19,代码来源:HRegionBridge.java

示例14: postCheckAndPut

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param compareOp the comparison operation
 * @param comparator the comparator
 * @param put data to put if check succeeds
 * @throws IOException e
 */
public boolean postCheckAndPut(final byte [] row, final byte [] family,
    final byte [] qualifier, final CompareOp compareOp,
    final ByteArrayComparable comparator, final Put put,
    boolean result)
  throws IOException {
  ObserverContext<RegionCoprocessorEnvironment> ctx = null;
  for (RegionEnvironment env: coprocessors) {
    if (env.getInstance() instanceof RegionObserver) {
      ctx = ObserverContext.createAndPrepare(env, ctx);
      try {
        result = ((RegionObserver)env.getInstance()).postCheckAndPut(ctx, row,
          family, qualifier, compareOp, comparator, put, result);
      } catch (Throwable e) {
        handleCoprocessorThrowable(env, e);
      }
      if (ctx.shouldComplete()) {
        break;
      }
    }
  }
  return result;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:32,代码来源:RegionCoprocessorHost.java

示例15: preCheckAndDelete

import org.apache.hadoop.hbase.filter.ByteArrayComparable; //导入依赖的package包/类
/**
 * @param row row to check
 * @param family column family
 * @param qualifier column qualifier
 * @param compareOp the comparison operation
 * @param comparator the comparator
 * @param delete delete to commit if check succeeds
 * @return true or false to return to client if default processing should
 * be bypassed, or null otherwise
 * @throws IOException e
 */
public Boolean preCheckAndDelete(final byte [] row, final byte [] family,
    final byte [] qualifier, final CompareOp compareOp,
    final ByteArrayComparable comparator, Delete delete)
    throws IOException {
  boolean bypass = false;
  boolean result = false;
  ObserverContext<RegionCoprocessorEnvironment> ctx = null;
  for (RegionEnvironment env: coprocessors) {
    if (env.getInstance() instanceof RegionObserver) {
      ctx = ObserverContext.createAndPrepare(env, ctx);
      try {
        result = ((RegionObserver)env.getInstance()).preCheckAndDelete(ctx, row,
          family, qualifier, compareOp, comparator, delete, result);
      } catch (Throwable e) {
        handleCoprocessorThrowable(env, e);
      }
      bypass |= ctx.shouldBypass();
      if (ctx.shouldComplete()) {
        break;
      }
    }
  }
  return bypass ? result : null;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:36,代码来源:RegionCoprocessorHost.java


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