public final class DriverUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CASSANDRA_4
Cassandra version 4.0.
|
static String |
CASSANDRA_5
Cassandra version 5.0.
|
static String |
COMMA
Comma character.
|
static String |
DEFAULT_ASTRA_DB_USER
Default username for connection to AstraDB instance with token.
|
static Pattern |
DURATION_FORMAT_PATTERN
Duration format pattern, used by
DURATION CQL type. |
static Pattern |
DURATION_ISO8601_ALT_FORMAT_PATTERN
Alternative ISO-8601 duration format pattern, used by
DURATION CQL type. |
static Pattern |
DURATION_ISO8601_FORMAT_PATTERN
ISO-8601 duration format pattern, used by
DURATION CQL type. |
static String |
JDBC_DRIVER_PROPERTIES_FILE
Properties file name containing some properties relative to this JDBC wrapper (such as JDBC driver version,
name, etc.).
|
static String |
JSSE_KEYSTORE_PASSWORD_PROPERTY
The JSSE property used to retrieve the key store password when SSL is enabled on the database connection using
JSSE properties.
|
static String |
JSSE_KEYSTORE_PROPERTY
The JSSE property used to retrieve the key store when SSL is enabled on the database connection using
JSSE properties.
|
static String |
JSSE_TRUSTSTORE_PASSWORD_PROPERTY
The JSSE property used to retrieve the trust store password when SSL is enabled on the database connection using
JSSE properties.
|
static String |
JSSE_TRUSTSTORE_PROPERTY
The JSSE property used to retrieve the trust store when SSL is enabled on the database connection using
JSSE properties.
|
static String |
NULL_KEYWORD
NULL CQL keyword. |
static String |
SINGLE_QUOTE
Single quote character.
|
static Pattern |
UUID_V1_PATTERN
UUIDv1 pattern, used by
TIMEUUID CQL type. |
static Pattern |
UUID_V4_PATTERN
UUIDv4 pattern, used by
UUID CQL type. |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildMetadataList(List<VersionedMetadata> metadataList,
String dbVersion)
Builds an alphabetically sorted and comma-separated list of metadata (such as built-in functions or CQL
keywords) existing in the specified Cassandra version.
|
static String |
buildMetadataList(List<VersionedMetadata> metadataList,
String dbVersion,
CassandraConnection connection)
Builds an alphabetically sorted and comma-separated list of metadata (such as built-in functions or CQL
keywords) existing in the specified Cassandra version.
|
static DriverPropertyInfo |
buildPropertyInfo(String propertyName,
Object value)
Builds an instance of
DriverPropertyInfo for the given driver property and value. |
static boolean |
existsInDatabaseVersion(String dbVersion,
VersionedMetadata versionedMetadata)
Checks whether the database metadata (CQL type or built-in function) exists in the current database version.
|
static String |
formatContactPoints(List<ContactPoint> contactPoints)
Formats a list of
ContactPoint to a comma-separated list of strings representing the contact points. |
static String |
getDriverProperty(String name)
Gets a property value from the Cassandra JDBC driver properties file.
|
static List<com.datastax.oss.driver.api.core.type.codec.TypeCodec<?>> |
listPreconfiguredCodecs()
Lists the pre-configured codecs used by this driver.
|
static String |
redactSensitiveValuesInJdbcUrl(String jdbcUrl)
Returns a redacted version of the provided JDBC URL for sensitive query parameters such as passwords.
|
static void |
safelyRegisterCodecs(com.datastax.oss.driver.api.core.session.Session cqlSession,
List<com.datastax.oss.driver.api.core.type.codec.TypeCodec<?>> codecs)
Registers the given codecs to the specified CQL session, checking they are not already registered before
registering them.
|
static org.semver4j.Semver |
safeParseVersion(String version)
Gets the
Semver representation of a version string. |
static String |
toStringWithoutSensitiveValues(Properties properties)
Returns a string representation of the provided driver properties with redacted values for sensitive properties
such as passwords.
|
public static final String JDBC_DRIVER_PROPERTIES_FILE
public static final String JSSE_TRUSTSTORE_PROPERTY
public static final String JSSE_TRUSTSTORE_PASSWORD_PROPERTY
public static final String JSSE_KEYSTORE_PROPERTY
public static final String JSSE_KEYSTORE_PASSWORD_PROPERTY
public static final String NULL_KEYWORD
NULL CQL keyword.public static final String CASSANDRA_5
public static final String CASSANDRA_4
public static final String COMMA
public static final String SINGLE_QUOTE
public static final String DEFAULT_ASTRA_DB_USER
public static final Pattern UUID_V1_PATTERN
TIMEUUID CQL type.public static final Pattern UUID_V4_PATTERN
UUID CQL type.public static final Pattern DURATION_FORMAT_PATTERN
DURATION CQL type.
See: Duration CQL typepublic static final Pattern DURATION_ISO8601_FORMAT_PATTERN
DURATION CQL type.
See: Duration CQL typepublic static final Pattern DURATION_ISO8601_ALT_FORMAT_PATTERN
DURATION CQL type.
See: Duration CQL typepublic static List<com.datastax.oss.driver.api.core.type.codec.TypeCodec<?>> listPreconfiguredCodecs()
public static String getDriverProperty(String name)
name - The name of the property.public static org.semver4j.Semver safeParseVersion(String version)
Semver representation of a version string.
It uses the dot character as separator to parse the different parts of a version (major, minor, patch).
version - The version string (for example X.Y.Z).Semver.ZERO if the string cannot be parsed correctly.public static boolean existsInDatabaseVersion(String dbVersion, VersionedMetadata versionedMetadata)
dbVersion - The version of the Cassandra database the driver is currently connected to.versionedMetadata - The database metadata to check.true if the database metadata exists in the current database version, false otherwise.public static String buildMetadataList(List<VersionedMetadata> metadataList, String dbVersion, CassandraConnection connection)
metadataList - The list of possible metadata to format.dbVersion - The version of the Cassandra database the driver is currently connected to.connection - The database connection.public static String buildMetadataList(List<VersionedMetadata> metadataList, String dbVersion)
metadataList - The list of possible metadata to format.dbVersion - The version of the Cassandra database the driver is currently connected to.public static DriverPropertyInfo buildPropertyInfo(String propertyName, Object value)
DriverPropertyInfo for the given driver property and value.propertyName - The property name.value - The current value of the property.public static String toStringWithoutSensitiveValues(Properties properties)
properties - The driver properties.public static String redactSensitiveValuesInJdbcUrl(String jdbcUrl)
jdbcUrl - The JDBC URL.public static void safelyRegisterCodecs(com.datastax.oss.driver.api.core.session.Session cqlSession,
List<com.datastax.oss.driver.api.core.type.codec.TypeCodec<?>> codecs)
cqlSession - The CQL session.codecs - The codecs to register.public static String formatContactPoints(List<ContactPoint> contactPoints)
ContactPoint to a comma-separated list of strings representing the contact points.contactPoints - The contact points.Copyright © 2020–2026 ING Bank. All rights reserved.