This project has retired. For details please refer to its Attic page.
CassandraClient (Apache Gora 0.2 API)

org.apache.gora.cassandra.store
Class CassandraClient<K,T extends Persistent>

java.lang.Object
  extended by org.apache.gora.cassandra.store.CassandraClient<K,T>

public class CassandraClient<K,T extends Persistent>
extends Object


Field Summary
static org.slf4j.Logger LOG
           
 
Constructor Summary
CassandraClient()
           
 
Method Summary
 void addColumn(String key, String fieldName, Object value)
          Insert a field in a column.
 void addSubColumn(String key, String fieldName, String memberName, Object value)
          Insert a member in a super column.
 void checkKeyspace()
          Check if keyspace already exists.
 void dropKeyspace()
          Drop keyspace.
 List<me.prettyprint.hector.api.beans.Row<String,String,String>> execute(CassandraQuery<K,T> cassandraQuery, String family)
          Select a family column in the keyspace.
 List<me.prettyprint.hector.api.beans.SuperRow<String,String,String,String>> executeSuper(CassandraQuery<K,T> cassandraQuery, String family)
           
 Map<String,List<String>> getFamilyMap(Query<K,T> query)
          Select the families that contain at least one column mapped to a query field.
 Map<String,String> getReverseMap(Query<K,T> query)
          Select the field names according to the column names, which format if fully qualified: "family:column"
 void initialize()
           
 boolean isSuper(String family)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.slf4j.Logger LOG
Constructor Detail

CassandraClient

public CassandraClient()
Method Detail

initialize

public void initialize()
                throws Exception
Throws:
Exception

checkKeyspace

public void checkKeyspace()
Check if keyspace already exists. If not, create it. In this method, we also utilise Hector's logic. It is set by passing a ConfigurableConsistencyLevel object right when the Keyspace is created. Currently consistency level is .ONE which permits consistency to wait until one replica has responded.


dropKeyspace

public void dropKeyspace()
Drop keyspace.


addColumn

public void addColumn(String key,
                      String fieldName,
                      Object value)
Insert a field in a column.

Parameters:
key - the row key
fieldName - the field name
value - the field value.

addSubColumn

public void addSubColumn(String key,
                         String fieldName,
                         String memberName,
                         Object value)
Insert a member in a super column. This is used for map and record Avro types.

Parameters:
key - the row key
fieldName - the field name
memberName - the member name
value - the member value

execute

public List<me.prettyprint.hector.api.beans.Row<String,String,String>> execute(CassandraQuery<K,T> cassandraQuery,
                                                                               String family)
Select a family column in the keyspace.

Parameters:
cassandraQuery - a wrapper of the query
family - the family name to be queried
Returns:
a list of family rows

getFamilyMap

public Map<String,List<String>> getFamilyMap(Query<K,T> query)
Select the families that contain at least one column mapped to a query field.

Parameters:
query - indicates the columns to select
Returns:
a map which keys are the family names and values the corresponding column names required to get all the query fields.

getReverseMap

public Map<String,String> getReverseMap(Query<K,T> query)
Select the field names according to the column names, which format if fully qualified: "family:column"

Parameters:
query -
Returns:
a map which keys are the fully qualified column names and values the query fields

isSuper

public boolean isSuper(String family)

executeSuper

public List<me.prettyprint.hector.api.beans.SuperRow<String,String,String,String>> executeSuper(CassandraQuery<K,T> cassandraQuery,
                                                                                                String family)


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.