public DynamicComposite getIndexComposite() { return new DynamicComposite( code, value, getQueueId(), getQueuePath(), timestampUuid ); } }
public void addToMutation( Mutator<ByteBuffer> batch, UUID queueId, long shard_ts, long timestamp ) { if ( propertyEntryList != null ) { for ( Entry<String, List<Entry<String, Object>>> property : propertyEntryList.entrySet() ) { for ( Map.Entry<String, Object> indexEntry : property.getValue() ) { if ( validIndexableValue( indexEntry.getValue() ) ) { batch.addInsertion( bytebuffer( key( queueId, shard_ts, indexEntry.getKey() ) ), PROPERTY_INDEX.getColumnFamily(), createColumn( new DynamicComposite( indexValueCode( indexEntry.getValue() ), indexEntry.getValue(), message.getUuid() ), ByteBuffer.allocate( 0 ), timestamp, dce, be ) ); batch.addInsertion( bytebuffer( key( queueId, DICTIONARY_MESSAGE_INDEXES ) ), QUEUE_DICTIONARIES.getColumnFamily(), createColumn( indexEntry.getKey(), ByteBuffer.allocate( 0 ), timestamp, se, be ) ); } } batch.addInsertion( bytebuffer( key( queueId, DICTIONARY_MESSAGE_INDEXES ) ), QUEUE_DICTIONARIES.getColumnFamily(), createColumn( property.getKey(), ByteBuffer.allocate( 0 ), timestamp, se, be ) ); } } }
.setColumnFamily( PROPERTY_INDEX_ENTRIES.getColumnFamily() ).setKey( queueId ) .setRange( DynamicComposite.toByteBuffer( entryName ), setGreaterThanEqualityFlag( new DynamicComposite( entryName ) ).serialize(), false, INDEX_ENTRY_LIST_COUNT ).execute().get().getColumns();
DynamicComposite s = new DynamicComposite( slice.getStart().getCode(), slice.getStart().getValue() ); if ( !slice.getStart().isInclusive() ) if ( slice.getFinish() != null ) DynamicComposite f = new DynamicComposite( slice.getFinish().getCode(), slice.getFinish().getValue() ); if ( slice.getFinish().isInclusive() )
public static DynamicComposite fromByteBuffer(ByteBuffer byteBuffer) { DynamicComposite composite = new DynamicComposite(); composite.deserialize(byteBuffer); return composite; }
public static ByteBuffer toByteBuffer(Object... o) { DynamicComposite composite = new DynamicComposite(o); return composite.serialize(); }
public static ByteBuffer toByteBuffer(List<?> l) { DynamicComposite composite = new DynamicComposite(l); return composite.serialize(); }
DynamicComposite s = new DynamicComposite( slice.getStart().getCode(), slice.getStart().getValue() ); if ( !slice.getStart().isInclusive() ) { setEqualityFlag( s, ComponentEquality.GREATER_THAN_EQUAL ); DynamicComposite f = new DynamicComposite( slice.getFinish().getCode(), slice.getFinish().getValue() ); if ( slice.getFinish().isInclusive() ) { setEqualityFlag( f, ComponentEquality.GREATER_THAN_EQUAL );
UUID uuid = UUID.randomUUID(); DynamicComposite composite = (DynamicComposite) new DynamicComposite().addComponent(entry.getKey(), uss).addComponent(uuid, uss); mutator.addInsertion(rowKey, columnFamily, HFactory.createColumn(composite, composite.toString(), ds, ss));
@Test public void testNullValueSerialization() throws Exception { // test correct serialization with null values and user specified // serialization DynamicComposite c = new DynamicComposite(); try { c.addComponent(null, StringSerializer.get()); fail("Null values not allowed"); } catch (NullPointerException e) { } }
@Test public void testUUIDGetSlice() { // Gets all columns based on the first component in the column name Map<UUID, Set<UUID>> ids = init(); for(Entry<UUID, Set<UUID>> entry : ids.entrySet()) { UUID component0 = entry.getKey(); // start at first column who's single component == component0 DynamicComposite start = new DynamicComposite(); start.addComponent(component0, us); // up to and including any column whose first component == component0 regardless of remaining component values DynamicComposite end = new DynamicComposite(); end.addComponent(component0, us, us.getComparatorType().getTypeName(), ComponentEquality.GREATER_THAN_EQUAL); ColumnSliceIterator<String, DynamicComposite, String> iterator = getIterator(rowKey, start, end); while(iterator.hasNext()) { HColumn<DynamicComposite, String> column = iterator.next(); DynamicComposite composite = column.getName(); assertEquals(component0, composite.get(0, us)); assertTrue(ids.get(component0).contains(composite.get(1, us))); } } }
public static DynamicComposite fromByteBuffer(ByteBuffer byteBuffer) { DynamicComposite composite = new DynamicComposite(); composite.deserialize(byteBuffer); return composite; }
public static DynamicComposite fromByteBuffer(ByteBuffer byteBuffer) { DynamicComposite composite = new DynamicComposite(); composite.deserialize(byteBuffer); return composite; }
public static ByteBuffer toByteBuffer(List<?> l) { DynamicComposite composite = new DynamicComposite(l); return composite.serialize(); } }
/** * Allocate a dynamic composite and intialiaze all the serializer methods * * @param length * @return */ public static DynamicComposite newComposite() { DynamicComposite composite = new DynamicComposite(); composite.setSerializerToComparatorMapping(mapping); return composite; }
DynamicComposite composite = (DynamicComposite) new DynamicComposite(). addComponent("a", ss). addComponent("ba", ss). composite = (DynamicComposite) new DynamicComposite(). addComponent("a", ss). addComponent("bb", ss). composite = (DynamicComposite) new DynamicComposite(). addComponent("b", ss). addComponent("ba", ss). composite = (DynamicComposite) new DynamicComposite(). addComponent("b", ss). addComponent("bb", ss). DynamicComposite end = (DynamicComposite) new DynamicComposite(). addComponent("b", ss, compType). addComponent("ba", ss). end = (DynamicComposite) new DynamicComposite(). addComponent("b", ss, compType). addComponent("ba", ss). end = (DynamicComposite) new DynamicComposite(). addComponent("b", ss, compType). addComponent("bb", ss, compType, ComponentEquality.GREATER_THAN_EQUAL); // s@a:s@ba:s@ca:s@da thru s@b:s@bb:s@cb:s@db
DynamicComposite c = new DynamicComposite(); c.add("String1"); ByteBuffer b = c.serialize(); c = new DynamicComposite(); c.deserialize(b); assertEquals(2, c.size()); c = new DynamicComposite(); c.add(new Long(10)); b = c.serialize(); c = new DynamicComposite(); c.deserialize(b); o = c.get(0); c = new DynamicComposite(); c.add(new Float(10)); b = c.serialize(); c = new DynamicComposite(); c.deserialize(b); o = c.get(0); c = new DynamicComposite(); c.add(UUID.randomUUID()); b = c.serialize(); c = new DynamicComposite(); c.add(TimeUUIDUtils.getUniqueTimeUUIDinMillis()); b = c.serialize();
@Test public void testEquality() throws Exception { DynamicCompositeType instance = getDefaultDynamicComparator(); DynamicComposite c1 = new DynamicComposite(10, "foo"); DynamicComposite c2 = new DynamicComposite(10, "foo"); assertEquals(0, instance.compare(c1.serialize(), c2.serialize())); c2.setEquality(ComponentEquality.GREATER_THAN_EQUAL); assertEquals(-1, instance.compare(c1.serialize(), c2.serialize())); c2.setEquality(ComponentEquality.LESS_THAN_EQUAL); assertEquals(1, instance.compare(c1.serialize(), c2.serialize())); c2.setEquality(ComponentEquality.EQUAL); assertEquals(0, instance.compare(c1.serialize(), c2.serialize())); c1.setEquality(ComponentEquality.LESS_THAN_EQUAL); assertEquals(-1, instance.compare(c1.serialize(), c2.serialize())); c1.setEquality(ComponentEquality.GREATER_THAN_EQUAL); assertEquals(1, instance.compare(c1.serialize(), c2.serialize())); }
@Test public void allTypesSerialize() { DynamicComposite composite = new DynamicComposite();
private DynamicComposite genComposite(int start, ComponentEquality equality) { DynamicComposite composite = new DynamicComposite(); composite.addComponent(start, IntegerSerializer.get(), IntegerSerializer .get().getComparatorType().getTypeName(), equality); return composite; }