public final class CassandraClient extends Object
Constructor and Description |
---|
CassandraClient() |
Modifier and Type | Method and Description |
---|---|
boolean |
addNewColumn(String tableName,
String customKeyspaceName,
String columnName,
com.datastax.driver.core.DataType columnType) |
static CassandraClient |
buildCassandraClient(ConnectionParameters connectionParameters)
Connect to Cassandra Cluster specified by provided host IP
address and port number.
|
boolean |
changeColumnType(String tableName,
String customKeyspaceName,
AlterColumnInput input) |
void |
close() |
static void |
connectWithAdvancedParams(ConnectionParameters connectionParameters,
com.datastax.driver.core.Cluster.Builder clusterBuilder) |
static void |
connectWithBasicParams(ConnectionParameters connectionParameters,
com.datastax.driver.core.Cluster.Builder clusterBuilder) |
boolean |
createKeyspace(CreateKeyspaceInput input) |
boolean |
createTable(CreateTableInput input) |
void |
delete(String keySpace,
String table,
List<String> entity,
Map<String,Object> whereClause)
DELETE command can be used to:
- remove one or more columns from one or more rows in a table;
- remove the entire row (one or more);
- if column_name refers to a collection (a list or map), the parameter in parentheses indicates the term in the collection
to be deleted
|
boolean |
dropColumn(String tableName,
String customKeyspaceName,
String columnName) |
boolean |
dropKeyspace(String keyspaceName) |
boolean |
dropTable(String tableName,
String customKeyspaceName) |
List<Map<String,Object>> |
executeCQLQuery(String cqlQuery,
List<Object> params) |
com.datastax.driver.core.TableMetadata |
fetchTableMetadata(String keyspaceUsed,
String tableName)
Fetches table metadata using DataStax java driver, based on the keyspace provided
|
List<com.datastax.driver.core.KeyspaceMetadata> |
getKeyspaces() |
String |
getLoggedKeyspace() |
List<String> |
getTableNamesFromKeyspace(String customKeyspaceName) |
void |
insert(String keySpace,
String table,
Map<String,Object> entity) |
boolean |
renameColumn(String tableName,
String customKeyspaceName,
String oldColumnName,
String newColumnName) |
List<Map<String,Object>> |
select(String query,
List<Object> params) |
void |
update(String keySpace,
String table,
Map<String,Object> entity,
Map<String,Object> whereClause)
Update the table @param table using the keySpace @param keySpace
|
public static CassandraClient buildCassandraClient(ConnectionParameters connectionParameters) throws org.mule.api.ConnectionException
connectionParameters
- the connection parametersorg.mule.api.ConnectionException
- if any error occurs when trying to connectpublic static void connectWithBasicParams(ConnectionParameters connectionParameters, com.datastax.driver.core.Cluster.Builder clusterBuilder) throws org.mule.api.ConnectionException
org.mule.api.ConnectionException
public static void connectWithAdvancedParams(ConnectionParameters connectionParameters, com.datastax.driver.core.Cluster.Builder clusterBuilder) throws org.mule.api.ConnectionException
org.mule.api.ConnectionException
public boolean createKeyspace(CreateKeyspaceInput input)
public boolean dropKeyspace(String keyspaceName)
public boolean createTable(CreateTableInput input) throws CassandraDBException
CassandraDBException
public boolean changeColumnType(String tableName, String customKeyspaceName, AlterColumnInput input)
public boolean addNewColumn(String tableName, String customKeyspaceName, String columnName, com.datastax.driver.core.DataType columnType)
public boolean dropColumn(String tableName, String customKeyspaceName, String columnName)
public boolean renameColumn(String tableName, String customKeyspaceName, String oldColumnName, String newColumnName)
public List<Map<String,Object>> executeCQLQuery(String cqlQuery, List<Object> params) throws CassandraDBException
CassandraDBException
public com.datastax.driver.core.TableMetadata fetchTableMetadata(String keyspaceUsed, String tableName)
keyspaceUsed
- the Keyspace to fetch fromtableName
- the Table from keyspacepublic void insert(String keySpace, String table, Map<String,Object> entity) throws CassandraDBException
CassandraDBException
public void update(String keySpace, String table, Map<String,Object> entity, Map<String,Object> whereClause) throws CassandraDBException
CassandraDBException
public void delete(String keySpace, String table, List<String> entity, Map<String,Object> whereClause) throws CassandraDBException
keySpace
- Keyspace to delete fromtable
- Table to delete fromentity
- Entity to be removedwhereClause
- WHERE clause conditionCassandraDBException
- if something goes wrongpublic List<Map<String,Object>> select(String query, List<Object> params) throws CassandraDBException
CassandraDBException
public List<com.datastax.driver.core.KeyspaceMetadata> getKeyspaces()
public String getLoggedKeyspace()
public void close()
Copyright © 2010–2019. All rights reserved.