org.scale7.cassandra.pelops
Class Pelops

java.lang.Object
  extended by org.scale7.cassandra.pelops.Pelops

public class Pelops
extends Object


Constructor Summary
Pelops()
           
 
Method Summary
static void addPool(String poolName, Cluster cluster, String keyspace)
          Add a new Thrift connection pool for a specific cluster and keyspace.
static void addPool(String poolName, Cluster cluster, String keyspace, CommonsBackedPool.Policy policy, OperandPolicy operandPolicy)
          Add a new Thrift connection pool for a specific cluster and keyspace.
static void addPool(String poolName, Cluster cluster, String keyspace, OperandPolicy operandPolicy, CachePerNodePool.Policy poolPolicy)
          Deprecated. Use the CommonsBackedPool
static void addPool(String poolName, IThriftPool thriftPool)
          Add an already instantiated instance of IThriftPool to pelops.
static ClusterManager createClusterManager(Cluster cluster)
          Create a ClusterManager object for use managing the cluster.
static ColumnFamilyManager createColumnFamilyManager(Cluster cluster, String keyspace)
          Create a ColumnFamilyManager object for use managing column families inside a keyspace.
static KeyspaceManager createKeyspaceManager(Cluster cluster)
          Create a KeyspaceManager object for use managing keyspaces in the cluster.
static Mutator createMutator(String poolName)
          Create a Mutator object using the current time as the operation time stamp.
static Mutator createMutator(String poolName, long timestamp)
          Create a Mutator object with an arbitrary time stamp.
static Mutator createMutator(String poolName, long timestamp, boolean deleteIfNull)
          Create a Mutator object with an arbitrary time stamp.
static RowDeletor createRowDeletor(String poolName)
          Create a row deletor object using the current time as the operation time stamp.
static RowDeletor createRowDeletor(String poolName, long timestamp)
          Create a row deletor object with an arbitrary time stamp.
static Selector createSelector(String poolName)
          Create a Selector object.
static IThriftPool getDbConnPool(String poolName)
          Get a direct reference to a DbConnPool.
static void shutdown()
          Shutdown Pelops.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pelops

public Pelops()
Method Detail

addPool

public static void addPool(String poolName,
                           Cluster cluster,
                           String keyspace)
Add a new Thrift connection pool for a specific cluster and keyspace. The name given to the pool is later used when creating operands such as Mutator and Selector.

Parameters:
poolName - A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
cluster - The Cassandra cluster that network connections will be made to
keyspace - The keyspace in the Cassandra cluster against which pool operations will apply

addPool

public static void addPool(String poolName,
                           Cluster cluster,
                           String keyspace,
                           CommonsBackedPool.Policy policy,
                           OperandPolicy operandPolicy)
Add a new Thrift connection pool for a specific cluster and keyspace. The name given to the pool is later used when creating operands such as Mutator and Selector.

Parameters:
poolName - A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
cluster - The Cassandra cluster that network connections will be made to
keyspace - The keyspace in the Cassandra cluster against which pool operations will apply
policy - The configuration used by the pool
operandPolicy - The configuration used by the Operand

addPool

@Deprecated
public static void addPool(String poolName,
                                      Cluster cluster,
                                      String keyspace,
                                      OperandPolicy operandPolicy,
                                      CachePerNodePool.Policy poolPolicy)
Deprecated. Use the CommonsBackedPool

Add a new Thrift connection pool for a specific cluster and keyspace. The name given to the pool is later used when creating operands such as Mutator and Selector.

Parameters:
poolName - A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
cluster - The Cassandra cluster that network connections will be made to
keyspace - The keyspace in the Cassandra cluster against which pool operations will apply
operandPolicy - Policy for behaviour of operations made by operands e.g. max operation retries
poolPolicy - Policy for behaviour of pool e.g. target cached connection count

addPool

public static void addPool(String poolName,
                           IThriftPool thriftPool)
Add an already instantiated instance of IThriftPool to pelops.

Parameters:
poolName - A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
thriftPool - an instance of the IThriftPool interface

shutdown

public static void shutdown()
Shutdown Pelops. This proceeds by shutting down all connection pools.


createSelector

public static Selector createSelector(String poolName)
Create a Selector object.

Parameters:
poolName - The name of the connection pool to use (this determines the Cassandra database cluster)
Returns:
A new Selector object

createMutator

public static Mutator createMutator(String poolName)
Create a Mutator object using the current time as the operation time stamp. The Mutator object must only be used to execute 1 mutation operation.

Parameters:
poolName - The name of the connection pool to use (this determines the Cassandra database cluster)
Returns:
A new Mutator object

createMutator

public static Mutator createMutator(String poolName,
                                    long timestamp)
Create a Mutator object with an arbitrary time stamp. The Mutator object must only be used to execute 1 mutation operation.

Parameters:
poolName - The name of the connection pool to use (this determines the Cassandra database cluster)
timestamp - The default time stamp to use for operations
Returns:
A new Mutator object

createMutator

public static Mutator createMutator(String poolName,
                                    long timestamp,
                                    boolean deleteIfNull)
Create a Mutator object with an arbitrary time stamp. The Mutator object must only be used to execute 1 mutation operation.

Parameters:
poolName - The name of the connection pool to use (this determines the Cassandra database cluster)
timestamp - The default time stamp to use for operations
deleteIfNull - If true the mutator will default to issuing deletes when it detects null values on a column passed to the various write methods.
Returns:
A new Mutator object

createRowDeletor

public static RowDeletor createRowDeletor(String poolName)
Create a row deletor object using the current time as the operation time stamp.

Parameters:
poolName - The name of the connection pool to use (this determines the Cassandra database cluster)
Returns:
A new row deletor object

createRowDeletor

public static RowDeletor createRowDeletor(String poolName,
                                          long timestamp)
Create a row deletor object with an arbitrary time stamp.

Parameters:
poolName - The name of the connection pool to use (this determines the Cassandra database cluster)
timestamp - The default time stamp to use for operations
Returns:
A new row deletor object

createClusterManager

public static ClusterManager createClusterManager(Cluster cluster)
Create a ClusterManager object for use managing the cluster. For example, querying the version of the Cassandra software, or the cluster name.

Parameters:
cluster -
Returns:

createKeyspaceManager

public static KeyspaceManager createKeyspaceManager(Cluster cluster)
Create a KeyspaceManager object for use managing keyspaces in the cluster. For example, querying the list of keyspaces, or adding a new keyspace.

Parameters:
cluster -
Returns:

createColumnFamilyManager

public static ColumnFamilyManager createColumnFamilyManager(Cluster cluster,
                                                            String keyspace)
Create a ColumnFamilyManager object for use managing column families inside a keyspace. For example, adding or removing a column family.

Parameters:
cluster -
keyspace -
Returns:

getDbConnPool

public static IThriftPool getDbConnPool(String poolName)
Get a direct reference to a DbConnPool. This should never be needed while using Pelops's Mutator and Selector in normal usage. The reason this function is provided, is so that the Pelops connection pooling system can be used in conjunction with other systems such as Lucandra.

Parameters:
poolName - The name of the pool
Returns:
A direct reference to the specified pool


Copyright © 2011. All Rights Reserved.