@Connector(name="cassandradb", schemaVersion="3.2", friendlyName="CassandraDB", minMuleVersion="3.6") @RequiresEnterpriseLicense(allowEval=true) public class CassandraDBConnector extends Object
Constructor and Description |
---|
CassandraDBConnector() |
Modifier and Type | Method and Description |
---|---|
boolean |
addNewColumn(String table,
String keyspaceName,
AlterColumnInput input)
Adds a new column
|
boolean |
changeColumnType(String table,
String keyspaceName,
AlterColumnInput input)
Changes the type of a column - check compatibility here: CQL type compatibility
|
boolean |
createKeyspace(CreateKeyspaceInput input)
Creates a new keyspace
|
boolean |
createTable(CreateTableInput input)
Creates a table(column family) in a specific keyspace; If no keyspace is specified the keyspace used for login will be used
|
void |
deleteColumnsValue(String table,
String keyspaceName,
Map<String,Object> payload)
Deletes values from an object specified by the where clause
|
void |
deleteRows(String table,
String keyspaceName,
Map<String,Object> payload)
Deletes an entire record
|
boolean |
dropColumn(String table,
String keyspaceName,
String columnName)
Removes a column
|
boolean |
dropKeyspace(String keyspaceName)
Drops the entire keyspace
|
boolean |
dropTable(String tableName,
String keyspaceName)
Drops an entire table form the specified keyspace or from the keyspace used for login if none is specified as an operation parameter
|
List<Map<String,Object>> |
executeCQLQuery(CQLQueryInput input)
Executes the raw input query provided
|
BasicAuthConnectionStrategy |
getBasicAuthConnectionStrategy() |
List<String> |
getTableNamesFromKeyspace(String keyspaceName)
Returns all the table names from the specified keyspace
|
void |
insert(String table,
String keyspaceName,
Map<String,Object> entity)
Executes the insert entity operation
|
boolean |
renameColumn(String table,
String keyspaceName,
String oldColumnName,
String newColumnName)
Renames a column
|
List<Map<String,Object>> |
select(String query,
List<Object> parameters)
Executes a select query
|
void |
setBasicAuthConnectionStrategy(BasicAuthConnectionStrategy basicAuthConnectionStrategy) |
String |
toNativeQuery(org.mule.common.query.DsqlQuery query) |
void |
update(String table,
String keyspaceName,
Map<String,Object> entity)
Executes the update entity operation
|
@Processor public boolean createKeyspace(@RefOnly @Default(value="#[payload]") CreateKeyspaceInput input) throws CassandraDBException
input
- operation input containing the keyspace name and the replication detailsCassandraDBException
- if any error occurs when executing the create keyspace operation@Processor public boolean dropKeyspace(String keyspaceName) throws CassandraDBException
keyspaceName
- the name of the keyspace to be droppedCassandraDBException
- if any error occurs when executing the drop keyspace operation@Processor public boolean createTable(@RefOnly @Default(value="#[payload]") CreateTableInput input) throws CassandraDBException
input
- operation input describing the table name, the keyspace name and the list of columnsCassandraDBException
- if any error occurs when executing the create table operation@Processor public boolean dropTable(String tableName, @Optional String keyspaceName) throws CassandraDBException
tableName
- the name of the table to be droppedkeyspaceName
- (optional) the keyspace which contains the table to be droppedCassandraDBException
- if any error occurs when executing the drop table operation@Processor(friendlyName="Execute CQL Query") public List<Map<String,Object>> executeCQLQuery(@Placement(group="Query") @RefOnly @Default(value="#[payload]") CQLQueryInput input) throws CassandraDBException
input
- CQLQueryInput describing the parametrized query to be executed along with the parametersCassandraDBException
- if any error occurs when executing the custom query@Processor @MetaDataScope(value=CassandraMetadataCategory.class) public void insert(@MetaDataKeyParam(affects=INPUT) String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") Map<String,Object> entity) throws CassandraDBException
table
- the table name in which the entity will be insertedkeyspaceName
- (optional) the keyspace which contains the table to be usedentity
- the entity to be insertedCassandraDBException
- if any error occurs when executing the insert query@Processor @MetaDataScope(value=CassandraWithFiltersMetadataCategory.class) public void update(@MetaDataKeyParam(affects=INPUT) String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") Map<String,Object> entity) throws CassandraDBException
table
- the table name in which the entity will be updatedkeyspaceName
- (optional) the keyspace which contains the table to be droppedentity
- the entity to be updatedCassandraDBException
- if any error occurs when executing the update query@Processor @MetaDataScope(value=CassandraWithFiltersMetadataCategory.class) public void deleteColumnsValue(@MetaDataKeyParam(affects=INPUT) String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") Map<String,Object> payload) throws CassandraDBException
table
- the name of the tablekeyspaceName
- (optional) the keyspace which contains the table to be usedpayload
- operation input: columns to be deleted and where clause for the delete operationCassandraDBException
- if any error occurs when executing the delete query@Processor @MetaDataScope(value=CassandraOnlyWithFiltersMetadataCategory.class) public void deleteRows(@MetaDataKeyParam(affects=INPUT) String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") Map<String,Object> payload) throws CassandraDBException
table
- the name of the tablekeyspaceName
- (optional) the keyspace which contains the table to be usedpayload
- operation input: where clause for the delete operationCassandraDBException
- if any error occurs when executing the delete query@Processor @MetaDataScope(value=CassandraMetadataCategory.class) public List<Map<String,Object>> select(@Default(value="#[payload]") @Query String query, @Optional @RefOnly List<Object> parameters) throws CassandraDBException
query
- the query to be executedparameters
- the query parametersCassandraDBException
- if any error occurs when executing the select query@Processor public List<String> getTableNamesFromKeyspace(@Optional String keyspaceName) throws CassandraDBException
keyspaceName
- the name of the keyspace to be used on the operationCassandraDBException
- if any error occurs when executing the operation@Processor(friendlyName="Change the type of a column") public boolean changeColumnType(String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") AlterColumnInput input)
table
- the name of the table to be used for the operationkeyspaceName
- (optional) the keyspace which contains the table to be usedinput
- POJO defining the name of the column to be changed and the new DataType@Processor(friendlyName="Add new column") public boolean addNewColumn(String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") AlterColumnInput input) throws CassandraDBException
table
- the name of the table to be used for the operationkeyspaceName
- (optional) the keyspace which contains the table to be usedinput
- POJO defining the name of the new column and its DataTypeCassandraDBException
- if any error occurs when executing the operation@Processor(friendlyName="Remove column") public boolean dropColumn(String table, @Optional String keyspaceName, @RefOnly @Default(value="#[payload]") String columnName)
table
- the name of the table to be used for the operationkeyspaceName
- (optional) the keyspace which contains the table to be usedcolumnName
- the name of the column to be removed@Processor(friendlyName="Rename column") public boolean renameColumn(String table, @Optional String keyspaceName, @Default(value="#[payload]") String oldColumnName, String newColumnName)
table
- the name of the table to be used for the operationkeyspaceName
- (optional) the keyspace which contains the table to be usedoldColumnName
- the name of the column to be changednewColumnName
- the new value for the name of the column@QueryTranslator public String toNativeQuery(org.mule.common.query.DsqlQuery query)
public BasicAuthConnectionStrategy getBasicAuthConnectionStrategy()
public void setBasicAuthConnectionStrategy(BasicAuthConnectionStrategy basicAuthConnectionStrategy)
Copyright © 2010–2019. All rights reserved.