public static Map<String, ByteBuffer> getColumnMap( List<HColumn<String, ByteBuffer>> columns ) { Map<String, ByteBuffer> column_map = new TreeMap<String, ByteBuffer>( String.CASE_INSENSITIVE_ORDER ); if ( columns != null ) { for ( HColumn<String, ByteBuffer> column : columns ) { String column_name = column.getName(); column_map.put( column_name, column.getValue() ); } } return column_map; }
public static <K, V> Map<K, V> asMap( List<HColumn<K, V>> columns ) { if ( columns == null ) { return null; } Map<K, V> column_map = new LinkedHashMap<K, V>(); for ( HColumn<K, V> column : columns ) { K column_name = column.getName(); column_map.put( column_name, column.getValue() ); } return column_map; }
public Set<String> getAllColumnNames( Keyspace ko, Object columnFamily, Object key ) throws Exception { List<HColumn<String, ByteBuffer>> columns = getAllColumns( ko, columnFamily, key ); Set<String> set = new LinkedHashSet<String>(); for ( HColumn<String, ByteBuffer> column : columns ) { set.add( column.getName() ); } return set; }
public static Message deserializeMessage( List<HColumn<String, ByteBuffer>> columns ) { Message message = null; Map<String, Object> properties = new HashMap<String, Object>(); for ( HColumn<String, ByteBuffer> column : columns ) { if ( MESSAGE_TYPE.equals( column.getName() ) || MESSAGE_ID.equals( column.getName() ) ) { properties.put( column.getName(), object( MESSAGE_PROPERTIES.get( column.getName() ), column.getValue() ) ); } else { properties.put( column.getName(), JsonUtils.fromByteBuffer( column.getValue() ) ); } } if ( !properties.isEmpty() ) { message = new Message( properties ); } return message; }
public static Queue deserializeQueue( List<HColumn<String, ByteBuffer>> columns ) { Queue queue = null; Map<String, Object> properties = new HashMap<String, Object>(); for ( HColumn<String, ByteBuffer> column : columns ) { if ( QUEUE_PROPERTIES.containsKey( column.getName() ) ) { properties .put( column.getName(), object( QUEUE_PROPERTIES.get( column.getName() ), column.getValue() ) ); } else { properties.put( column.getName(), JsonUtils.fromByteBuffer( column.getValue() ) ); } } if ( !properties.isEmpty() ) { queue = new Queue( properties ); } return queue; }
column.getName(), column.getValue(), queueId, consumerId ); logger.trace( "Max timeuuid : '{}', Current timeuuid : '{}', comparison '{}'", startTimeUUID, column.getName(), UUIDUtils.compare( startTimeUUID, column.getName() ) ); results.add( new TransactionPointer( column.getName(), column.getValue() ) );
@Override public Set<String> getDictionaryNames( EntityRef entity ) throws Exception { Set<String> dictionaryNames = new TreeSet<String>( CASE_INSENSITIVE_ORDER ); List<HColumn<String, ByteBuffer>> results = cass.getAllColumns( cass.getApplicationKeyspace( applicationId ), ENTITY_DICTIONARIES, CassandraPersistenceUtils.key( entity.getUuid(), DICTIONARY_SETS ) ); for ( HColumn<String, ByteBuffer> result : results ) { String str = string( result.getName() ); if ( str != null ) { dictionaryNames.add( str ); } } Set<String> schemaSets = Schema.getDefaultSchema().getDictionaryNames( entity.getType() ); if ( ( schemaSets != null ) && !schemaSets.isEmpty() ) { dictionaryNames.addAll( schemaSets ); } return dictionaryNames; }
@Override public Set<String> getQueueCounterNames( String queuePath ) throws Exception { Set<String> names = new HashSet<String>(); Keyspace ko = cass.getApplicationKeyspace( applicationId ); SliceQuery<String, String, ByteBuffer> q = createSliceQuery( ko, se, se, be ); q.setColumnFamily( QueuesCF.QUEUE_DICTIONARIES.toString() ); q.setKey( CassandraPersistenceUtils.key( getQueueId( queuePath ), DICTIONARY_COUNTERS ).toString() ); q.setRange( null, null, false, ALL_COUNT ); List<HColumn<String, ByteBuffer>> columns = q.execute().get().getColumns(); for ( HColumn<String, ByteBuffer> column : columns ) { names.add( column.getName() ); } return names; }
HColumn<UUID, ByteBuffer> column = cassResults.get( i ); final UUID columnName = column.getName();
@Override public QueueSet getSubscribers( String publisherQueuePath, String firstSubscriberQueuePath, int limit ) { UUID publisherQueueId = getQueueId( publisherQueuePath ); Keyspace ko = cass.getApplicationKeyspace( applicationId ); if ( firstSubscriberQueuePath != null ) { limit += 1; } List<HColumn<String, UUID>> columns = createSliceQuery( ko, ue, se, ue ).setKey( publisherQueueId ) .setColumnFamily( QUEUE_SUBSCRIBERS.getColumnFamily() ) .setRange( normalizeQueuePath( firstSubscriberQueuePath ), null, false, limit + 1 ).execute().get() .getColumns(); QueueSet queues = new QueueSet(); int count = Math.min( limit, columns.size() ); if ( columns != null ) { for ( int i = firstSubscriberQueuePath != null ? 1 : 0; i < count; i++ ) { HColumn<String, UUID> column = columns.get( i ); queues.addQueue( column.getName(), column.getValue() ); } } if ( columns.size() > limit ) { queues.setMore( true ); } return queues; }
@Override public QueueSet getSubscriptions( String subscriberQueuePath, String firstSubscriptionQueuePath, int limit ) { UUID subscriberQueueId = getQueueId( subscriberQueuePath ); Keyspace ko = cass.getApplicationKeyspace( applicationId ); if ( firstSubscriptionQueuePath != null ) { limit += 1; } List<HColumn<String, UUID>> columns = createSliceQuery( ko, ue, se, ue ).setKey( subscriberQueueId ) .setColumnFamily( QUEUE_SUBSCRIPTIONS.getColumnFamily() ) .setRange( normalizeQueuePath( firstSubscriptionQueuePath ), null, false, limit + 1 ).execute().get() .getColumns(); QueueSet queues = new QueueSet(); int count = Math.min( limit, columns.size() ); if ( columns != null ) { for ( int i = firstSubscriptionQueuePath != null ? 1 : 0; i < count; i++ ) { HColumn<String, UUID> column = columns.get( i ); queues.addQueue( column.getName(), column.getValue() ); } } if ( columns.size() > limit ) { queues.setMore( true ); } return queues; }
values = new HashMap<String, Object>(); for ( HColumn<ByteBuffer, ByteBuffer> result : results.getColumns() ) { String name = entityHasDictionary ? string( result.getName() ) : DynamicComposite.fromByteBuffer( result.getName() ).get( 0, se ); if ( entityHasDictionary && coTypeIsBasic ) { values.put( name, object( dictionaryCoType, result.getValue() ) );
UUID origTrans = col.getName(); UUID messageId = col.getValue();
@Override public HColumn<N, V> getColumnByName(N columnName) { if ( null == columnsMap) { columnsMap = new HashMap<N,HColumn<N,V>>(columnsList.size()); for (HColumn<N, V> column : columnsList) { columnsMap.put(column.getName(), column); } } return columnsMap.get(columnName); }
@Override public HColumn<String, byte[]> getColumnByName(String columnName) { for ( HColumn<String, byte[]> col : colList ) { if ( col.getName().equals(columnName)) { return col; } } return null; }
private Map<String, String> getResults(QueryResult<ColumnSlice<String, String>> queryResult) { Map<String, String> result = Maps.newHashMap(); for (HColumn<String, String> col : queryResult.get().getColumns()) { result.put(col.getName(), col.getValue()); } return result; }
DynamicComposite c = DynamicComposite.fromByteBuffer( column.getName() ); queues.addQueue( c.get( 3, se ), c.get( 2, ue ) );