public class CassandraDataSource extends Object implements ConnectionPoolDataSource, DataSource
DataSource and ConnectionPoolDataSource.| Modifier and Type | Field and Description |
|---|---|
protected String |
complianceMode
The compliance mode.
|
protected String |
consistency
The consistency level.
|
protected List<ContactPoint> |
contactPoints
The contact points of the data source.
|
protected static String |
DATA_SOURCE_DESCRIPTION
The Cassandra data source description.
|
protected String |
databaseName
The database name.
|
protected String |
localDataCenter
The local datacenter.
|
protected String |
password
The password used to connect to the data source.
|
protected String |
user
The username used to connect to the data source.
|
| Constructor and Description |
|---|
CassandraDataSource(List<ContactPoint> contactPoints,
String keyspace,
String user,
String password,
String consistency)
Constructor.
|
CassandraDataSource(List<ContactPoint> contactPoints,
String keyspace,
String user,
String password,
String consistency,
String localDataCenter)
Constructor specifying a local datacenter (required to use
DefaultLoadBalancingPolicy). |
| Modifier and Type | Method and Description |
|---|---|
CassandraConnection |
getConnection() |
CassandraConnection |
getConnection(String user,
String password) |
String |
getConsistency()
Gets the consistency level.
|
List<ContactPoint> |
getContactPoints()
Gets the contact points of the data source.
|
String |
getDatabaseName()
Gets the database name.
|
String |
getDescription()
Gets the data source description.
|
String |
getLocalDataCenter()
Gets the local datacenter.
|
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
String |
getPassword()
Gets the password used to connect to the data source.
|
PooledCassandraConnection |
getPooledConnection() |
PooledCassandraConnection |
getPooledConnection(String user,
String password) |
String |
getUser()
Gets the username used to connect to the data source.
|
boolean |
isWrapperFor(Class<?> iface) |
void |
setComplianceMode(String complianceMode)
Sets the compliance mode.
|
void |
setConsistency(String consistency)
Sets the consistency level.
|
void |
setContactPoints(List<ContactPoint> contactPoints)
Sets the contact points of the data source.
|
void |
setDatabaseName(String databaseName)
Sets the database name.
|
void |
setLocalDataCenter(String localDataCenter)
Sets the local datacenter.
|
void |
setLoginTimeout(int timeout) |
void |
setLogWriter(PrintWriter writer) |
void |
setPassword(String password)
Sets the password used to connect to the data source.
|
void |
setUser(String user)
Sets the username used to connect to the data source.
|
<T> T |
unwrap(Class<T> iface) |
protected static final String DATA_SOURCE_DESCRIPTION
protected List<ContactPoint> contactPoints
protected String databaseName
protected String user
protected String password
protected String consistency
See consistency level documentation for further details.
protected String complianceMode
protected String localDataCenter
public CassandraDataSource(List<ContactPoint> contactPoints, String keyspace, String user, String password, String consistency)
contactPoints - The contact points.keyspace - The keyspace.user - The username used to connect.password - The password used to connect.consistency - The consistency level.public CassandraDataSource(List<ContactPoint> contactPoints, String keyspace, String user, String password, String consistency, String localDataCenter)
DefaultLoadBalancingPolicy).contactPoints - The contact points.keyspace - The keyspace.user - The username used to connect.password - The password used to connect.consistency - The consistency level.localDataCenter - The local datacenter.public String getDescription()
public List<ContactPoint> getContactPoints()
public void setContactPoints(List<ContactPoint> contactPoints)
contactPoints - The contact points of the data source.public String getConsistency()
See consistency level documentation for further details.
public void setConsistency(String consistency)
See
consistency level documentation and ConsistencyLevel to get the acceptable values.
consistency - The consistency level.public void setComplianceMode(String complianceMode)
complianceMode - The compliance mode to use for the connection (for example, Liquibase).public String getDatabaseName()
public void setDatabaseName(String databaseName)
databaseName - The database name. In case of Cassandra, i.e. the keyspace used as data source.public String getUser()
public void setUser(String user)
user - The username used to connect to the data source.public String getPassword()
public void setPassword(String password)
password - The password used to connect to the data source.public String getLocalDataCenter()
DefaultLoadBalancingPolicy.public void setLocalDataCenter(String localDataCenter)
DefaultLoadBalancingPolicy.localDataCenter - The local datacenter.public CassandraConnection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic CassandraConnection getConnection(String user, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcepublic PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourcepublic void setLoginTimeout(int timeout)
setLoginTimeout in interface CommonDataSourcepublic void setLogWriter(PrintWriter writer)
setLogWriter in interface CommonDataSourcepublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic PooledCassandraConnection getPooledConnection() throws SQLException
getPooledConnection in interface ConnectionPoolDataSourceSQLExceptionpublic PooledCassandraConnection getPooledConnection(String user, String password) throws SQLException
getPooledConnection in interface ConnectionPoolDataSourceSQLExceptionCopyright © 2020–2024 ING Bank. All rights reserved.