org.usergrid.persistence.cassandra
Class CassandraPersistenceUtils

java.lang.Object
  extended by org.usergrid.persistence.cassandra.CassandraPersistenceUtils

public class CassandraPersistenceUtils
extends Object

Author:
edanuff

Field Summary
static me.prettyprint.cassandra.serializers.ByteBufferSerializer be
           
static char KEY_DELIM
           
static UUID NULL_ID
           
static ByteBuffer PROPERTY_ID_AS_BYTES
           
static ByteBuffer PROPERTY_TYPE_AS_BYTES
           
static me.prettyprint.cassandra.serializers.StringSerializer se
           
static me.prettyprint.cassandra.serializers.UUIDSerializer ue
           
 
Constructor Summary
CassandraPersistenceUtils()
           
 
Method Summary
static void addDeleteToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object columnFamily, Object key, long timestamp)
          Delete the row
static void addDeleteToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object columnFamily, Object key, long timestamp, Object... columnNames)
           
static void addDeleteToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object columnFamily, Object key, Object columnName, long timestamp)
           
static void addInsertToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object columnFamily, Object key, Map<?,?> columns, long timestamp)
           
static void addInsertToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object columnFamily, Object key, Object columnName, Object columnValue, long timestamp)
           
static void addPropertyToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object key, String entityType, Map<String,?> columns, long timestamp)
           
static void addPropertyToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m, Object key, String entityType, String propertyName, Object propertyValue, long timestamp)
           
static UUID aliasID(UUID ownerId, String aliasType, String alias)
           
static
<K,V> Map<K,V>
asMap(List<me.prettyprint.hector.api.beans.HColumn<K,V>> columns)
           
static me.prettyprint.hector.api.mutation.MutationResult batchExecute(me.prettyprint.hector.api.mutation.Mutator<?> m, int retries)
           
static me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> buildSetIdListMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch, UUID targetId, String columnFamily, String keyPrefix, String keySuffix, List<UUID> keyIds, long timestamp)
           
static long createTimestamp()
           
static List<ByteBuffer> getAsByteKeys(List<UUID> ids)
           
static List<me.prettyprint.hector.api.ddl.ColumnFamilyDefinition> getCfDefs(Class<? extends CFEnum> cfEnum, List<me.prettyprint.hector.api.ddl.ColumnFamilyDefinition> cf_defs, String keyspace)
           
static List<me.prettyprint.hector.api.ddl.ColumnFamilyDefinition> getCfDefs(Class<? extends CFEnum> cfEnum, String keyspace)
           
static Map<String,ByteBuffer> getColumnMap(List<me.prettyprint.hector.api.beans.HColumn<String,ByteBuffer>> columns)
           
static List<me.prettyprint.hector.api.ddl.ColumnDefinition> getIndexMetadata(String indexes)
           
static Object key(Object... objects)
           
static UUID keyID(Object... objects)
           
static void logBatchOperation(String operation, Object columnFamily, Object key, Object columnName, Object columnValue, long timestamp)
           
static String normalizeGroupPath(String path)
           
static ByteBuffer toStorableBinaryValue(Object obj)
           
static ByteBuffer toStorableBinaryValue(Object obj, boolean forceJson)
           
static Object toStorableValue(Object obj)
           
static void validateKeyspace(CFEnum[] cf_enums, me.prettyprint.hector.api.ddl.KeyspaceDefinition ksDef)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_TYPE_AS_BYTES

public static final ByteBuffer PROPERTY_TYPE_AS_BYTES

PROPERTY_ID_AS_BYTES

public static final ByteBuffer PROPERTY_ID_AS_BYTES

KEY_DELIM

public static final char KEY_DELIM
See Also:
Constant Field Values

NULL_ID

public static final UUID NULL_ID

se

public static final me.prettyprint.cassandra.serializers.StringSerializer se

ue

public static final me.prettyprint.cassandra.serializers.UUIDSerializer ue

be

public static final me.prettyprint.cassandra.serializers.ByteBufferSerializer be
Constructor Detail

CassandraPersistenceUtils

public CassandraPersistenceUtils()
Method Detail

logBatchOperation

public static void logBatchOperation(String operation,
                                     Object columnFamily,
                                     Object key,
                                     Object columnName,
                                     Object columnValue,
                                     long timestamp)
Parameters:
operation -
columnFamily -
key -
columnName -
columnValue -
timestamp -

addInsertToMutator

public static void addInsertToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                      Object columnFamily,
                                      Object key,
                                      Object columnName,
                                      Object columnValue,
                                      long timestamp)

addInsertToMutator

public static void addInsertToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                      Object columnFamily,
                                      Object key,
                                      Map<?,?> columns,
                                      long timestamp)
                               throws Exception
Throws:
Exception

addPropertyToMutator

public static void addPropertyToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                        Object key,
                                        String entityType,
                                        String propertyName,
                                        Object propertyValue,
                                        long timestamp)

addPropertyToMutator

public static void addPropertyToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                        Object key,
                                        String entityType,
                                        Map<String,?> columns,
                                        long timestamp)
                                 throws Exception
Throws:
Exception

addDeleteToMutator

public static void addDeleteToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                      Object columnFamily,
                                      Object key,
                                      long timestamp)
                               throws Exception
Delete the row

Parameters:
m -
columnFamily -
key -
timestamp -
Throws:
Exception

addDeleteToMutator

public static void addDeleteToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                      Object columnFamily,
                                      Object key,
                                      Object columnName,
                                      long timestamp)
                               throws Exception
Throws:
Exception

addDeleteToMutator

public static void addDeleteToMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> m,
                                      Object columnFamily,
                                      Object key,
                                      long timestamp,
                                      Object... columnNames)
                               throws Exception
Throws:
Exception

getColumnMap

public static Map<String,ByteBuffer> getColumnMap(List<me.prettyprint.hector.api.beans.HColumn<String,ByteBuffer>> columns)

asMap

public static <K,V> Map<K,V> asMap(List<me.prettyprint.hector.api.beans.HColumn<K,V>> columns)

getAsByteKeys

public static List<ByteBuffer> getAsByteKeys(List<UUID> ids)

createTimestamp

public static long createTimestamp()
Returns:
timestamp value for current time

normalizeGroupPath

public static String normalizeGroupPath(String path)
Parameters:
path -
Returns:
normalized group path

key

public static Object key(Object... objects)
Parameters:
objects -
Returns:
a composite key

keyID

public static UUID keyID(Object... objects)
Parameters:
objects -
Returns:
UUID for composite key

aliasID

public static UUID aliasID(UUID ownerId,
                           String aliasType,
                           String alias)
Parameters:
entityId -
aliasType -
alias -
Returns:
UUID for entity alias

buildSetIdListMutator

public static me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> buildSetIdListMutator(me.prettyprint.hector.api.mutation.Mutator<ByteBuffer> batch,
                                                                                           UUID targetId,
                                                                                           String columnFamily,
                                                                                           String keyPrefix,
                                                                                           String keySuffix,
                                                                                           List<UUID> keyIds,
                                                                                           long timestamp)
                                                                                    throws Exception
Throws:
Exception

batchExecute

public static me.prettyprint.hector.api.mutation.MutationResult batchExecute(me.prettyprint.hector.api.mutation.Mutator<?> m,
                                                                             int retries)

toStorableValue

public static Object toStorableValue(Object obj)

toStorableBinaryValue

public static ByteBuffer toStorableBinaryValue(Object obj)

toStorableBinaryValue

public static ByteBuffer toStorableBinaryValue(Object obj,
                                               boolean forceJson)

getIndexMetadata

public static List<me.prettyprint.hector.api.ddl.ColumnDefinition> getIndexMetadata(String indexes)

getCfDefs

public static List<me.prettyprint.hector.api.ddl.ColumnFamilyDefinition> getCfDefs(Class<? extends CFEnum> cfEnum,
                                                                                   String keyspace)

getCfDefs

public static List<me.prettyprint.hector.api.ddl.ColumnFamilyDefinition> getCfDefs(Class<? extends CFEnum> cfEnum,
                                                                                   List<me.prettyprint.hector.api.ddl.ColumnFamilyDefinition> cf_defs,
                                                                                   String keyspace)

validateKeyspace

public static void validateKeyspace(CFEnum[] cf_enums,
                                    me.prettyprint.hector.api.ddl.KeyspaceDefinition ksDef)


Copyright © 2013. All Rights Reserved.