类org.apache.hadoop.hbase.exceptions.DeserializationException源码实例Demo

下面列出了怎么用org.apache.hadoop.hbase.exceptions.DeserializationException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: hbase   文件: ClusterId.java
/**
 * @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix
 * @return An instance of {@link ClusterId} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static ClusterId parseFrom(final byte [] bytes) throws DeserializationException {
  if (ProtobufUtil.isPBMagicPrefix(bytes)) {
    int pblen = ProtobufUtil.lengthOfPBMagic();
    ClusterIdProtos.ClusterId.Builder builder = ClusterIdProtos.ClusterId.newBuilder();
    ClusterIdProtos.ClusterId cid = null;
    try {
      ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen);
      cid = builder.build();
    } catch (IOException e) {
      throw new DeserializationException(e);
    }
    return convert(cid);
  } else {
    // Presume it was written out this way, the old way.
    return new ClusterId(Bytes.toString(bytes));
  }
}
 
源代码2 项目: hbase   文件: ZKReplicationQueueStorage.java
/**
 * Return the {lastPushedSequenceId, ZNodeDataVersion} pair. if ZNodeDataVersion is -1, it means
 * that the ZNode does not exist.
 */
@VisibleForTesting
protected Pair<Long, Integer> getLastSequenceIdWithVersion(String encodedRegionName,
    String peerId) throws KeeperException {
  Stat stat = new Stat();
  String path = getSerialReplicationRegionPeerNode(encodedRegionName, peerId);
  byte[] data = ZKUtil.getDataNoWatch(zookeeper, path, stat);
  if (data == null) {
    // ZNode does not exist, so just return version -1 to indicate that no node exist.
    return Pair.newPair(HConstants.NO_SEQNUM, -1);
  }
  try {
    return Pair.newPair(ZKUtil.parseWALPositionFrom(data), stat.getVersion());
  } catch (DeserializationException de) {
    LOG.warn("Failed to parse log position (region=" + encodedRegionName + ", peerId=" + peerId
        + "), data=" + Bytes.toStringBinary(data));
  }
  return Pair.newPair(HConstants.NO_SEQNUM, stat.getVersion());
}
 
源代码3 项目: geowave   文件: HBaseNumericIndexStrategyFilter.java
public static HBaseNumericIndexStrategyFilter parseFrom(final byte[] pbBytes)
    throws DeserializationException {
  final ByteBuffer buf = ByteBuffer.wrap(pbBytes);
  NumericIndexStrategy indexStrategy;
  MultiDimensionalCoordinateRangesArray[] coordinateRanges;
  try {
    final int indexStrategyLength = VarintUtils.readUnsignedInt(buf);
    final byte[] indexStrategyBytes = new byte[indexStrategyLength];
    buf.get(indexStrategyBytes);
    indexStrategy = (NumericIndexStrategy) URLClassloaderUtils.fromBinary(indexStrategyBytes);
    final byte[] coordRangeBytes = new byte[buf.remaining()];
    buf.get(coordRangeBytes);
    final ArrayOfArrays arrays = new ArrayOfArrays();
    arrays.fromBinary(coordRangeBytes);
    coordinateRanges = arrays.getCoordinateArrays();
  } catch (final Exception e) {
    throw new DeserializationException("Unable to read parameters", e);
  }

  return new HBaseNumericIndexStrategyFilter(indexStrategy, coordinateRanges);
}
 
源代码4 项目: hbase   文件: ColumnValueFilter.java
/**
 * Parse protobuf bytes to a ColumnValueFilter
 * @param pbBytes pbBytes
 * @return a ColumnValueFilter
 * @throws DeserializationException deserialization exception
 */
public static ColumnValueFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
  FilterProtos.ColumnValueFilter proto;
  try {
    proto = FilterProtos.ColumnValueFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }

  final CompareOperator compareOp = CompareOperator.valueOf(proto.getCompareOp().name());
  final ByteArrayComparable comparator;
  try {
    comparator = ProtobufUtil.toComparator(proto.getComparator());
  } catch (IOException ioe) {
    throw new DeserializationException(ioe);
  }

  return new ColumnValueFilter(proto.getFamily().toByteArray(),
    proto.getQualifier().toByteArray(), compareOp, comparator);
}
 
源代码5 项目: hbase   文件: VisibilityLabelsCache.java
public void refreshLabelsCache(byte[] data) throws IOException {
  List<VisibilityLabel> visibilityLabels = null;
  try {
    visibilityLabels = VisibilityUtils.readLabelsFromZKData(data);
  } catch (DeserializationException dse) {
    throw new IOException(dse);
  }
  this.lock.writeLock().lock();
  try {
    labels.clear();
    ordinalVsLabels.clear();
    for (VisibilityLabel visLabel : visibilityLabels) {
      String label = Bytes.toString(visLabel.getLabel().toByteArray());
      labels.put(label, visLabel.getOrdinal());
      ordinalVsLabels.put(visLabel.getOrdinal(), label);
    }
  } finally {
    this.lock.writeLock().unlock();
  }
}
 
源代码6 项目: hbase   文件: FuzzyRowFilter.java
/**
 * @param pbBytes A pb serialized {@link FuzzyRowFilter} instance
 * @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static FuzzyRowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
  FilterProtos.FuzzyRowFilter proto;
  try {
    proto = FilterProtos.FuzzyRowFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  int count = proto.getFuzzyKeysDataCount();
  ArrayList<Pair<byte[], byte[]>> fuzzyKeysData = new ArrayList<>(count);
  for (int i = 0; i < count; ++i) {
    BytesBytesPair current = proto.getFuzzyKeysData(i);
    byte[] keyBytes = current.getFirst().toByteArray();
    byte[] keyMeta = current.getSecond().toByteArray();
    fuzzyKeysData.add(new Pair<>(keyBytes, keyMeta));
  }
  return new FuzzyRowFilter(fuzzyKeysData);
}
 
源代码7 项目: hbase   文件: TestHTableDescriptor.java
@Test
public void testPb() throws DeserializationException, IOException {
  HTableDescriptor htd = new HTableDescriptor(TableName.META_TABLE_NAME);
  final int v = 123;
  htd.setMaxFileSize(v);
  htd.setDurability(Durability.ASYNC_WAL);
  htd.setReadOnly(true);
  htd.setRegionReplication(2);
  byte [] bytes = htd.toByteArray();
  HTableDescriptor deserializedHtd = HTableDescriptor.parseFrom(bytes);
  assertEquals(htd, deserializedHtd);
  assertEquals(v, deserializedHtd.getMaxFileSize());
  assertTrue(deserializedHtd.isReadOnly());
  assertEquals(Durability.ASYNC_WAL, deserializedHtd.getDurability());
  assertEquals(2, deserializedHtd.getRegionReplication());
}
 
源代码8 项目: hbase   文件: SingleColumnValueExcludeFilter.java
/**
 * @param pbBytes A pb serialized {@link SingleColumnValueExcludeFilter} instance
 * @return An instance of {@link SingleColumnValueExcludeFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static SingleColumnValueExcludeFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
  FilterProtos.SingleColumnValueExcludeFilter proto;
  try {
    proto = FilterProtos.SingleColumnValueExcludeFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }

  FilterProtos.SingleColumnValueFilter parentProto = proto.getSingleColumnValueFilter();
  final CompareOperator compareOp =
    CompareOperator.valueOf(parentProto.getCompareOp().name());
  final ByteArrayComparable comparator;
  try {
    comparator = ProtobufUtil.toComparator(parentProto.getComparator());
  } catch (IOException ioe) {
    throw new DeserializationException(ioe);
  }

  return new SingleColumnValueExcludeFilter(parentProto.hasColumnFamily() ? parentProto
      .getColumnFamily().toByteArray() : null, parentProto.hasColumnQualifier() ? parentProto
      .getColumnQualifier().toByteArray() : null, compareOp, comparator, parentProto
      .getFilterIfMissing(), parentProto.getLatestVersionOnly());
}
 
源代码9 项目: hbase   文件: SingleColumnValueFilter.java
/**
 * @param pbBytes A pb serialized {@link SingleColumnValueFilter} instance
 * @return An instance of {@link SingleColumnValueFilter} made from <code>bytes</code>
 * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
 * @see #toByteArray
 */
public static SingleColumnValueFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
  FilterProtos.SingleColumnValueFilter proto;
  try {
    proto = FilterProtos.SingleColumnValueFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }

  final CompareOperator compareOp =
    CompareOperator.valueOf(proto.getCompareOp().name());
  final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator;
  try {
    comparator = ProtobufUtil.toComparator(proto.getComparator());
  } catch (IOException ioe) {
    throw new DeserializationException(ioe);
  }

  return new SingleColumnValueFilter(proto.hasColumnFamily() ? proto.getColumnFamily()
      .toByteArray() : null, proto.hasColumnQualifier() ? proto.getColumnQualifier()
      .toByteArray() : null, compareOp, comparator, proto.getFilterIfMissing(), proto
      .getLatestVersionOnly());
}
 
源代码10 项目: hbase   文件: QualifierFilter.java
/**
 * @param pbBytes A pb serialized {@link QualifierFilter} instance
 * @return An instance of {@link QualifierFilter} made from <code>bytes</code>
 * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
 * @see #toByteArray
 */
public static QualifierFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
  FilterProtos.QualifierFilter proto;
  try {
    proto = FilterProtos.QualifierFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  final CompareOperator valueCompareOp =
    CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
  ByteArrayComparable valueComparator = null;
  try {
    if (proto.getCompareFilter().hasComparator()) {
      valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
    }
  } catch (IOException ioe) {
    throw new DeserializationException(ioe);
  }
  return new QualifierFilter(valueCompareOp,valueComparator);
}
 
/**
 * @param pbBytes A pb serialized {@link FirstKeyValueMatchingQualifiersFilter} instance
 * @return An instance of {@link FirstKeyValueMatchingQualifiersFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static FirstKeyValueMatchingQualifiersFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
  FilterProtos.FirstKeyValueMatchingQualifiersFilter proto;
  try {
    proto = FilterProtos.FirstKeyValueMatchingQualifiersFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }

  TreeSet<byte []> qualifiers = new TreeSet<>(Bytes.BYTES_COMPARATOR);
  for (ByteString qualifier : proto.getQualifiersList()) {
    qualifiers.add(qualifier.toByteArray());
  }
  return new FirstKeyValueMatchingQualifiersFilter(qualifiers);
}
 
源代码12 项目: pxf   文件: HBaseDoubleComparator.java
public static ByteArrayComparable parseFrom(final byte[] pbBytes) throws DeserializationException {
    ComparatorProtos.ByteArrayComparable proto;
    try {
        proto = ComparatorProtos.ByteArrayComparable.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }

    return new HBaseDoubleComparator(Bytes.toDouble(proto.getValue().toByteArray()));
}
 
源代码13 项目: pxf   文件: HBaseFloatComparator.java
public static ByteArrayComparable parseFrom(final byte[] pbBytes) throws DeserializationException {
    ComparatorProtos.ByteArrayComparable proto;
    try {
        proto = ComparatorProtos.ByteArrayComparable.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }

    return new HBaseFloatComparator(Bytes.toFloat(proto.getValue().toByteArray()));
}
 
源代码14 项目: pxf   文件: HBaseIntegerComparator.java
/**
 * Hides ("overrides") a static method in {@link ByteArrayComparable}.
 * This method will be called in deserialization.
 *
 * @param pbBytes
 *            A pb serialized instance
 * @return An instance of {@link HBaseIntegerComparator} made from
 *         <code>bytes</code>
 * @throws DeserializationException if deserialization of bytes to Protocol Buffers failed
 * @see #toByteArray
 */
public static ByteArrayComparable parseFrom(final byte[] pbBytes)
		throws DeserializationException {
	ComparatorProtos.ByteArrayComparable proto;
	try {
		proto = ComparatorProtos.ByteArrayComparable.parseFrom(pbBytes);
	} catch (InvalidProtocolBufferException e) {
		throw new DeserializationException(e);
	}
	return new HBaseIntegerComparator(Bytes.toLong(proto.getValue()
			.toByteArray()));
}
 
/**
 * Decode table state from META Result.
 * Should contain cell from HConstants.TABLE_FAMILY
 * (Copied from MetaTableAccessor)
 * @return null if not found
 */
public static TableState getTableState(Result r) throws IOException {
  Cell cell = r.getColumnLatestCell(TABLE_FAMILY, TABLE_STATE_QUALIFIER);
  if (cell == null) {
    return null;
  }
  try {
    return TableState.parseFrom(TableName.valueOf(r.getRow()),
      Arrays.copyOfRange(cell.getValueArray(), cell.getValueOffset(),
        cell.getValueOffset() + cell.getValueLength()));
  } catch (DeserializationException e) {
    throw new IOException(e);
  }
}
 
源代码16 项目: warp10-platform   文件: SlicedRowFilter.java
public static SlicedRowFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
      
  //System.out.println("parseFrom " + encodeHex(pbBytes));
  
  ByteBuffer bb = ByteBuffer.wrap(pbBytes).order(ByteOrder.BIG_ENDIAN);
  
  SlicedRowFilter filter = new SlicedRowFilter();
  
  filter.count = bb.getLong();
  filter.slicesLength = bb.getInt();
  int nbounds = bb.getInt();
  filter.bounds = new int[nbounds];
  for (int i = 0; i < nbounds; i++) {
    filter.bounds[i] = bb.getInt();
  }
  
  //
  // If the first slice starts at offset 0 then we will be able to provide a key hint
  //
  
  if (0 == filter.bounds[0]) {
    filter.hasHinting = true;
  } else {
    filter.hasHinting = false;
  }

  filter.rangekeys = new byte[bb.getInt()];
  bb.get(filter.rangekeys);
  
  filter.slice = new byte[filter.slicesLength];
  
  return filter;
}
 
源代码17 项目: hbase   文件: RandomRowFilter.java
/**
 * @param pbBytes A pb serialized {@link RandomRowFilter} instance
 * @return An instance of {@link RandomRowFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static RandomRowFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
  FilterProtos.RandomRowFilter proto;
  try {
    proto = FilterProtos.RandomRowFilter.parseFrom(pbBytes);
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return new RandomRowFilter(proto.getChance());
}
 
源代码18 项目: eagle   文件: TypedByteArrayComparator.java
/**
 * For hbase 0.98
 *
 * @param bytes raw byte array
 * @return Comparator instance
 * @throws DeserializationException
 */
public static TypedByteArrayComparator parseFrom(final byte[] bytes) throws DeserializationException {
    TypedByteArrayComparator comparator = new TypedByteArrayComparator();
    ByteArrayDataInput byteArrayDataInput = ByteStreams.newDataInput(bytes);
    try {
        comparator.readFields(byteArrayDataInput);
    } catch (IOException e) {
        LOG.error("Got error to deserialize TypedByteArrayComparator from PB bytes", e);
        throw new DeserializationException(e);
    }
    return comparator;
}
 
源代码19 项目: hbase   文件: ZKUtil.java
private static String getServerNameOrEmptyString(final byte [] data) {
  try {
    return ProtobufUtil.parseServerNameFrom(data).toString();
  } catch (DeserializationException e) {
    return "";
  }
}
 
源代码20 项目: phoenix   文件: ColumnProjectionFilter.java
public static ColumnProjectionFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
    try {
        return (ColumnProjectionFilter)Writables.getWritable(pbBytes, new ColumnProjectionFilter());
    } catch (IOException e) {
        throw new DeserializationException(e);
    }
}
 
源代码21 项目: phoenix   文件: MultiCQKeyValueComparisonFilter.java
public static MultiCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
    try {
        return (MultiCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCQKeyValueComparisonFilter());
    } catch (IOException e) {
        throw new DeserializationException(e);
    }
}
 
public static MultiCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
    try {
        return (MultiCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCFCQKeyValueComparisonFilter());
    } catch (IOException e) {
        throw new DeserializationException(e);
    }
}
 
源代码23 项目: phoenix   文件: RowKeyComparisonFilter.java
public static RowKeyComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
    try {
        return (RowKeyComparisonFilter)Writables.getWritable(pbBytes, new RowKeyComparisonFilter());
    } catch (IOException e) {
        throw new DeserializationException(e);
    }
}
 
public static SingleCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
    try {
        return (SingleCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new SingleCFCQKeyValueComparisonFilter());
    } catch (IOException e) {
        throw new DeserializationException(e);
    }
}
 
源代码25 项目: phoenix   文件: ColumnProjectionFilter.java
public static ColumnProjectionFilter parseFrom(final byte [] pbBytes) throws DeserializationException {
    try {
        return (ColumnProjectionFilter)Writables.getWritable(pbBytes, new ColumnProjectionFilter());
    } catch (IOException e) {
        throw new DeserializationException(e);
    }
}
 
源代码26 项目: hbase   文件: ThriftUtilities.java
public static TPut putFromHBase(Put in) {
  TPut out = new TPut();
  out.setRow(in.getRow());
  if (in.getTimestamp() != HConstants.LATEST_TIMESTAMP) {
    out.setTimestamp(in.getTimestamp());
  }
  if (in.getDurability() != Durability.USE_DEFAULT) {
    out.setDurability(durabilityFromHBase(in.getDurability()));
  }
  for (Map.Entry<byte [], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
    byte[] family = entry.getKey();
    for (Cell cell : entry.getValue()) {
      TColumnValue columnValue = new TColumnValue();
      columnValue.setFamily(family)
          .setQualifier(CellUtil.cloneQualifier(cell))
          .setType(cell.getType().getCode())
          .setTimestamp(cell.getTimestamp())
          .setValue(CellUtil.cloneValue(cell));
      if (cell.getTagsLength() != 0) {
        columnValue.setTags(PrivateCellUtil.cloneTags(cell));
      }
      out.addToColumnValues(columnValue);
    }
  }
  for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
    out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
        ByteBuffer.wrap(attribute.getValue()));
  }
  try {
    CellVisibility cellVisibility = in.getCellVisibility();
    if (cellVisibility != null) {
      TCellVisibility tCellVisibility = new TCellVisibility();
      tCellVisibility.setExpression(cellVisibility.getExpression());
      out.setCellVisibility(tCellVisibility);
    }
  } catch (DeserializationException e) {
    throw new RuntimeException(e);
  }
  return out;
}
 
源代码27 项目: hbase   文件: ThriftUtilities.java
public static TAppend appendFromHBase(Append in) throws IOException {
  TAppend out = new TAppend();
  out.setRow(in.getRow());

  if (in.getDurability() != Durability.USE_DEFAULT) {
    out.setDurability(durabilityFromHBase(in.getDurability()));
  }
  for (Map.Entry<byte [], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
    byte[] family = entry.getKey();
    for (Cell cell : entry.getValue()) {
      TColumnValue columnValue = new TColumnValue();
      columnValue.setFamily(family)
          .setQualifier(CellUtil.cloneQualifier(cell))
          .setType(cell.getType().getCode())
          .setTimestamp(cell.getTimestamp())
          .setValue(CellUtil.cloneValue(cell));
      if (cell.getTagsLength() != 0) {
        columnValue.setTags(PrivateCellUtil.cloneTags(cell));
      }
      out.addToColumns(columnValue);
    }
  }
  for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
    out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
        ByteBuffer.wrap(attribute.getValue()));
  }
  try {
    CellVisibility cellVisibility = in.getCellVisibility();
    if (cellVisibility != null) {
      TCellVisibility tCellVisibility = new TCellVisibility();
      tCellVisibility.setExpression(cellVisibility.getExpression());
      out.setCellVisibility(tCellVisibility);
    }
  } catch (DeserializationException e) {
    throw new RuntimeException(e);
  }
  out.setReturnResults(in.isReturnResults());
  return out;
}
 
源代码28 项目: hbase   文件: ThriftUtilities.java
public static TIncrement incrementFromHBase(Increment in) throws IOException {
  TIncrement out = new TIncrement();
  out.setRow(in.getRow());

  if (in.getDurability() != Durability.USE_DEFAULT) {
    out.setDurability(durabilityFromHBase(in.getDurability()));
  }
  for (Map.Entry<byte [], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
    byte[] family = entry.getKey();
    for (Cell cell : entry.getValue()) {
      TColumnIncrement columnValue = new TColumnIncrement();
      columnValue.setFamily(family).setQualifier(CellUtil.cloneQualifier(cell));
      columnValue.setAmount(
          Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
      out.addToColumns(columnValue);
    }
  }
  for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
    out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())),
        ByteBuffer.wrap(attribute.getValue()));
  }
  try {
    CellVisibility cellVisibility = in.getCellVisibility();
    if (cellVisibility != null) {
      TCellVisibility tCellVisibility = new TCellVisibility();
      tCellVisibility.setExpression(cellVisibility.getExpression());
      out.setCellVisibility(tCellVisibility);
    }
  } catch (DeserializationException e) {
    throw new RuntimeException(e);
  }
  out.setReturnResults(in.isReturnResults());
  return out;
}
 
源代码29 项目: geowave   文件: SingleEntryFilter.java
public static Filter parseFrom(final byte[] pbBytes) throws DeserializationException {
  FilterProtosServer.SingleEntryFilter proto;
  try {
    proto = FilterProtosServer.SingleEntryFilter.parseFrom(pbBytes);
  } catch (final InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return new SingleEntryFilter(
      proto.getDataId().toByteArray(),
      proto.getAdapterId().toByteArray());
}
 
源代码30 项目: hbase   文件: VisibilityController.java
@Override
public void preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan)
    throws IOException {
  if (!initialized) {
    throw new VisibilityControllerNotReadyException("VisibilityController not yet initialized!");
  }
  // Nothing to do if authorization is not enabled
  if (!authorizationEnabled) {
    return;
  }
  Region region = e.getEnvironment().getRegion();
  Authorizations authorizations = null;
  try {
    authorizations = scan.getAuthorizations();
  } catch (DeserializationException de) {
    throw new IOException(de);
  }
  if (authorizations == null) {
    // No Authorizations present for this scan/Get!
    // In case of system tables other than "labels" just scan with out visibility check and
    // filtering. Checking visibility labels for META and NAMESPACE table is not needed.
    TableName table = region.getRegionInfo().getTable();
    if (table.isSystemTable() && !table.equals(LABELS_TABLE_NAME)) {
      return;
    }
  }

  Filter visibilityLabelFilter = VisibilityUtils.createVisibilityLabelFilter(region,
      authorizations);
  if (visibilityLabelFilter != null) {
    Filter filter = scan.getFilter();
    if (filter != null) {
      scan.setFilter(new FilterList(filter, visibilityLabelFilter));
    } else {
      scan.setFilter(visibilityLabelFilter);
    }
  }
}
 
 类所在包
 类方法
 同包方法