me.prettyprint.cassandra.service.template
Class AbstractColumnFamilyTemplate<K,N>

java.lang.Object
  extended by me.prettyprint.cassandra.service.template.AbstractColumnFamilyTemplate<K,N>
Direct Known Subclasses:
ColumnFamilyTemplate, SuperCfTemplate

public class AbstractColumnFamilyTemplate<K,N>
extends Object


Field Summary
protected  HSlicePredicate<N> activeSlicePredicate
           
static int ALL_COLUMNS_COUNT
           
static Object ALL_COLUMNS_END
           
static Object ALL_COLUMNS_START
           
protected  boolean batched
          By default, execute updates automatically at common-sense points such as after queuing the updates of all an object's properties.
protected  Long clock
          An optional clock value to pass to deletes.
protected  ColumnFactory columnFactory
           
protected  String columnFamily
           
protected  org.apache.cassandra.thrift.ColumnParent columnParent
           
protected  Map<N,Serializer<?>> columnValueSerializers
           
protected  ExceptionsTranslator exceptionsTranslator
           
protected  Serializer<K> keySerializer
           
protected  Keyspace keyspace
           
protected  Serializer<N> topSerializer
          The serializer for a standard column name or a super-column name
 
Constructor Summary
AbstractColumnFamilyTemplate(Keyspace keyspace, String columnFamily, Serializer<K> keySerializer, Serializer<N> topSerializer)
           
 
Method Summary
 AbstractColumnFamilyTemplate<K,N> addColumn(N columnName, Serializer<?> valueSerializer)
          Add a column to the static set of columns which will be used in constructing the single-argument form of slicing operations
 Mutator<K> createMutator()
           
 void deleteColumn(K key, N columnName)
          Immediately delete this column as a single mutation operation
 void deleteColumn(Mutator<K> mutator, K key, N columnName)
          Stage this column deletion into the pending mutator.
 void deleteRow(K key)
          Immediately delete this row in a single mutation operation
 void deleteRow(Mutator<K> mutator, K key)
          Stage this deletion into the provided mutator calling executeIfNotBatched(Mutator)
 MutationResult executeBatch(Mutator<K> mutator)
           
protected  MutationResult executeIfNotBatched(AbstractTemplateUpdater<K,N> updater)
           
protected  MutationResult executeIfNotBatched(Mutator<K> mutator)
           
 Long getClock()
           
 String getColumnFamily()
           
 long getEffectiveClock()
           
 Serializer<K> getKeySerializer()
           
 Serializer<N> getTopSerializer()
           
 Serializer<?> getValueSerializer(N columnName)
          Get the value serializer for a given column.
 boolean isBatched()
           
 AbstractColumnFamilyTemplate<K,N> setBatched(boolean batched)
           
 void setClock(Long clock)
           
 void setColumnFactory(ColumnFactory columnFactory)
           
 void setCount(int count)
          The number of columns to return when not doing a name-based template
 void setExceptionsTranslator(ExceptionsTranslator exceptionsTranslator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_COLUMNS_COUNT

public static final int ALL_COLUMNS_COUNT
See Also:
Constant Field Values

ALL_COLUMNS_START

public static final Object ALL_COLUMNS_START

ALL_COLUMNS_END

public static final Object ALL_COLUMNS_END

keyspace

protected Keyspace keyspace

columnFamily

protected String columnFamily

keySerializer

protected Serializer<K> keySerializer

columnValueSerializers

protected Map<N,Serializer<?>> columnValueSerializers

columnParent

protected org.apache.cassandra.thrift.ColumnParent columnParent

activeSlicePredicate

protected HSlicePredicate<N> activeSlicePredicate

columnFactory

protected ColumnFactory columnFactory

topSerializer

protected Serializer<N> topSerializer
The serializer for a standard column name or a super-column name


batched

protected boolean batched
By default, execute updates automatically at common-sense points such as after queuing the updates of all an object's properties. Or, in the case of multiple objects, at the end of the list. No Mutator executes() will be called if this is set to true. This allows an arbitrary number of updates to be performed and executed manually.


clock

protected Long clock
An optional clock value to pass to deletes. If null, the default value generated by Hector is used


exceptionsTranslator

protected ExceptionsTranslator exceptionsTranslator
Constructor Detail

AbstractColumnFamilyTemplate

public AbstractColumnFamilyTemplate(Keyspace keyspace,
                                    String columnFamily,
                                    Serializer<K> keySerializer,
                                    Serializer<N> topSerializer)
Method Detail

addColumn

public AbstractColumnFamilyTemplate<K,N> addColumn(N columnName,
                                                   Serializer<?> valueSerializer)
Add a column to the static set of columns which will be used in constructing the single-argument form of slicing operations

Parameters:
columnName -
valueSerializer -

getValueSerializer

public Serializer<?> getValueSerializer(N columnName)
Get the value serializer for a given column. Returns null if none found

Parameters:
columnName -
Returns:

isBatched

public boolean isBatched()

setBatched

public AbstractColumnFamilyTemplate<K,N> setBatched(boolean batched)

getColumnFamily

public String getColumnFamily()

getKeySerializer

public Serializer<K> getKeySerializer()

getTopSerializer

public Serializer<N> getTopSerializer()

executeBatch

public MutationResult executeBatch(Mutator<K> mutator)

createMutator

public Mutator<K> createMutator()

getClock

public Long getClock()

setClock

public void setClock(Long clock)

getEffectiveClock

public long getEffectiveClock()

setExceptionsTranslator

public void setExceptionsTranslator(ExceptionsTranslator exceptionsTranslator)

setColumnFactory

public void setColumnFactory(ColumnFactory columnFactory)

executeIfNotBatched

protected MutationResult executeIfNotBatched(Mutator<K> mutator)

executeIfNotBatched

protected MutationResult executeIfNotBatched(AbstractTemplateUpdater<K,N> updater)

deleteRow

public void deleteRow(K key)
Immediately delete this row in a single mutation operation

Parameters:
key -

deleteRow

public void deleteRow(Mutator<K> mutator,
                      K key)
Stage this deletion into the provided mutator calling executeIfNotBatched(Mutator)

Parameters:
mutator -
key -

deleteColumn

public void deleteColumn(K key,
                         N columnName)
Immediately delete this column as a single mutation operation

Parameters:
key -
columnName -

deleteColumn

public void deleteColumn(Mutator<K> mutator,
                         K key,
                         N columnName)
Stage this column deletion into the pending mutator. Calls executeIfNotBatched(Mutator)

Parameters:
mutator -
key -
columnName -

setCount

public void setCount(int count)
The number of columns to return when not doing a name-based template

Parameters:
count -


Copyright © 2011. All Rights Reserved.