@Override public ByteArray convert(final String value) { return new ByteArray(value); } }
@Override public ByteBuffer apply(final ByteArray input) { return ByteBuffer.wrap(input.getBytes()); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AdapterMapping other = (AdapterMapping) obj; if (adapterId == null) { if (other.adapterId != null) return false; } else if (!adapterId.equals(other.adapterId)) return false; if (internalAdapterId != other.internalAdapterId) return false; return true; }
private static byte[] getNextPrefix(final byte[] bytes) { if (bytes == null) { // this is simply for memory data store test purposes and is just an // attempt to go to the end of the memory datastore table return new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,}; } return new ByteArray(bytes).getNextPrefix(); }
public static InsertionIds keysToInsertionIds(final GeoWaveKey... geoWaveKeys) { final Map<ByteArray, List<byte[]>> sortKeysPerPartition = new HashMap<>(); for (final GeoWaveKey key : geoWaveKeys) { final ByteArray partitionKey = new ByteArray(key.getPartitionKey()); List<byte[]> sortKeys = sortKeysPerPartition.get(partitionKey); if (sortKeys == null) { sortKeys = new ArrayList<>(); sortKeysPerPartition.put(partitionKey, sortKeys); } sortKeys.add(key.getSortKey()); } final Set<SinglePartitionInsertionIds> insertionIds = new HashSet<>(); for (final Entry<ByteArray, List<byte[]>> e : sortKeysPerPartition.entrySet()) { insertionIds.add(new SinglePartitionInsertionIds(e.getKey().getBytes(), e.getValue())); } return new InsertionIds(insertionIds); }
public boolean isAuthorizationsLimiting(final String... authorizations) { final Set<String> set = Sets.newHashSet(authorizations); for (final Entry<ByteArray, Long> vis : countsPerVisibility.entrySet()) { if ((vis.getValue() > 0) && (vis.getKey() != null) && (vis.getKey().getBytes().length > 0) && !VisibilityExpression.evaluate(vis.getKey().getString(), set)) { return true; } } return false; }
/** Convert Row Range Numeric statistics to a JSON object */ @Override protected Object resultsValue() { final Collection<Map<String, String>> partitionsArray = new ArrayList<>(); for (final ByteArray p : partitions) { final Map<String, String> partition = new HashMap<>(); if ((p == null) || (p.getBytes() == null)) { partition.put("partition", "null"); } else { partition.put("partition", p.getHexString()); } partitionsArray.add(partition); } return partitionsArray; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = (prime * result) + ((id == null) ? 0 : id.hashCode()); return result; }
@Override public String toString() { return "ByteArrayId [getString()=" + getString() + "]"; }
@Override public void entryScanned(final T entry, final GeoWaveRow kv) { final ByteArray visibility = new ByteArray(visibilityHandler.getVisibility(entry, kv)); InternalDataStatistics<T, R, B> statistics = statisticsMap.get(visibility); if (statistics == null) { statistics = statisticsProvider.createDataStatistics(statisticsId); if (statistics == null) { return; } statistics.setVisibility(visibility.getBytes()); statisticsMap.put(visibility, statistics); } statistics.entryIngested(entry, kv); } }
private List<QueryRequest> getAdapterOnlyQueryRequests( final String tableName, final ArrayList<Short> internalAdapterIds) { final List<QueryRequest> allQueries = new ArrayList<>(); for (final short internalAdapterId : internalAdapterIds) { final QueryRequest singleAdapterQuery = new QueryRequest(tableName); final byte[] start = ByteArrayUtils.shortToByteArray(internalAdapterId); final byte[] end = new ByteArray(start).getNextPrefix(); singleAdapterQuery.addKeyConditionsEntry( DynamoDBRow.GW_RANGE_KEY, new Condition().withComparisonOperator(ComparisonOperator.BETWEEN).withAttributeValueList( new AttributeValue().withB(ByteBuffer.wrap(start)), new AttributeValue().withB(ByteBuffer.wrap(end)))); allQueries.add(singleAdapterQuery); } return allQueries; }
LOGGER.warn( "Object '" + getCombinedId(primaryId, secondaryId).getString() + "' not found. '" + METADATA_TABLE reader.query( new MetadataQuery( primaryId.getBytes(), secondaryId == null ? null : secondaryId.getBytes(), authorizations))) { if (!it.hasNext()) { if (warnIfNotExists) { LOGGER.warn( "Object '" + getCombinedId(primaryId, secondaryId).getString() + "' not found");
@Override public String toString() { final StringBuffer buffer = new StringBuffer(statisticsType.getString()).append(" (").append(extendedId).append( ")").append("="); if (!partitions.isEmpty()) { for (final ByteArray p : partitions) { if ((p == null) || (p.getBytes() == null)) { buffer.append("null,"); } else { buffer.append(p.getHexString()).append(","); } } buffer.deleteCharAt(buffer.length() - 1); } else { buffer.append("none"); } return buffer.toString(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((adapterId == null) ? 0 : adapterId.hashCode()); return result; }
@Override protected Object resultsValue() { final Map<String, Object> retVal = new HashMap<>(); for (final Entry<ByteArray, Long> entry : countsPerVisibility.entrySet()) { retVal.put(entry.getKey().getString(), entry.getValue()); } return retVal; } }
@Override public ByteArray convert(final String value) { return new ByteArray(value); } }