Skip to content

Commit

Permalink
Prepare release 4.7.0
Browse files Browse the repository at this point in the history
- Update version
- Update changelog
- Add some missing Javadoc
- Update readme file
  • Loading branch information
maximevw committed Sep 23, 2022
1 parent 4fcbf62 commit 7ddf3e9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 4.7.0 - 2022-09-23
### Added
- Add a system of compliance mode with the query parameter `compliancemode`: for some usages (for example with
Liquibase), some default behaviours of the JDBC implementation have to be adapted. See the readme file for details
about the overridable behaviours and the available compliance modes. See pull request
[#8](https://github.com/ing-bank/cassandra-jdbc-wrapper/pull/8).
- Add an additional `CassandraConnection` constructor using a pre-existing session (see pull request
[#8](https://github.com/ing-bank/cassandra-jdbc-wrapper/pull/8)).
### Changed
- Update DataStax Java Driver for Apache Cassandra(R) to version 4.14.1.

## 4.6.0 - 2022-03-20
### Added
- Add support for connecting to Cassandra DBaaS cluster with secure connect bundle.
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ public class HelloCassandra {
}
```

If you want to use a pre-existing session, you can directly build a new `CassandraConnection` with the constructor
`CassandraConnection(Session, String, ConsistencyLevel, debugMode, OptionSet)`. For example:

```java
public class HelloCassandraWithSession {
public static void main(final String[] args) {
final CqlSession session = CqlSession.builder()
.addContactPoint(new InetSocketAddress("localhost", 9042))
.withLocalDatacenter("DC1")
.build();
final Connection connection = new CassandraConnection(session, "keyspace", ConsistencyLevel.ALL, false, new Default());
}
}
```

### Using a configuration file

If you want to use a
Expand Down Expand Up @@ -227,6 +242,23 @@ jdbc:cassandra:dbaas:///keyspace?consistency=LOCAL_QUORUM&user=user1&password=pa

For further information about connecting to DBaaS, see [cloud documentation](https://docs.datastax.com/en/developer/java-driver/latest/manual/cloud/).

### Compliance modes

For some specific usages, the default behaviour of some JDBC implementations has to be modified. That's why you can
use the argument `compliancemode` in the JDBC URL to cutomize the behaviour of some methods.

The values currently allowed for this argument are:
* `Default`: mode activated by default if not specified in the JDBC URL. It implements the methods detailed below as
defined in the JDBC specification (according to the Cassandra driver capabilities).
* `Liquibase`: compliance mode for a usage of the JDBC driver with Liquibase.

Here are the behaviours defined by the compliance modes listed above:

| Method | Default mode | Liquibase mode |
|---|---|---|
| `CassandraConnection.getCatalog()` | returns the result of the query`SELECT cluster_name FROM system.local` or `null` if not available | returns `null` |
| `CassandraStatement.executeUpdate(String)` | returns 0 | returns -1 |

### Using simple statements

To issue a simple select and get data from it:
Expand Down
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.ing.data</groupId>
<artifactId>cassandra-jdbc-wrapper</artifactId>
<version>4.6.0</version>
<version>4.7.0</version>
<packaging>jar</packaging>

<name>Cassandra JDBC Wrapper</name>
Expand Down Expand Up @@ -85,23 +85,23 @@
<!-- Versions for dependencies -->
<checkstyle.version>9.3</checkstyle.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<datastax.java.driver.version>4.14.0</datastax.java.driver.version>
<datastax.java.driver.version>4.14.1</datastax.java.driver.version>
<guava.version>18.0</guava.version>
<!-- Versions for test dependencies -->
<achilles-embedded.version>6.1.0</achilles-embedded.version>
<hamcrest.version>2.2</hamcrest.version>
<junit5.version>5.8.2</junit5.version>
<junit-platform.version>1.8.2</junit-platform.version>
<junit5.version>5.9.0</junit5.version>
<junit-platform.version>1.9.0</junit-platform.version>
<mockito.version>3.12.4</mockito.version>
<!-- Versions for plugins -->
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
<maven-checkstyle-plugin.version>3.2.0</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-enforcer-plugin.version>3.1.0</maven-enforcer-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
<maven-shade-plugin.version>3.4.0</maven-shade-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
</properties>
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/com/ing/data/cassandra/jdbc/CassandraConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,12 @@ public CassandraConnection(final SessionHolder sessionHolder) throws SQLExceptio

/**
* Instantiates a new JDBC connection to a Cassandra cluster using preexisting session.
* @param cSession Session to use
* @param currentKeyspace Keyspace to use
* @param defaultConsistencyLevel Consistency level
* @param debugMode Debug mode flag
* @param optionSet Compliance mode option set
*
* @param cSession The session to use.
* @param currentKeyspace The keyspace to use.
* @param defaultConsistencyLevel The default consistency level.
* @param debugMode Debug mode flag.
* @param optionSet The compliance mode option set to use.
*/
public CassandraConnection(final Session cSession, final String currentKeyspace,
final ConsistencyLevel defaultConsistencyLevel,
Expand Down Expand Up @@ -549,14 +550,17 @@ public <T> T unwrap(final Class<T> iface) throws SQLException {
throw new SQLFeatureNotSupportedException(String.format(NO_INTERFACE, iface.getSimpleName()));
}


/**
* Gets the compliance mode option set used for the connection.
*
* @return The compliance mode option set used for the connection.
*/
public OptionSet getOptionSet() {
return optionSet;
}

private OptionSet lookupOptionSet(final String property) {
final ServiceLoader<OptionSet> loader = ServiceLoader
.load(OptionSet.class);
final ServiceLoader<OptionSet> loader = ServiceLoader.load(OptionSet.class);
final Iterator<OptionSet> iterator = loader.iterator();
while (iterator.hasNext()) {
final OptionSet optionSet = iterator.next();
Expand Down

0 comments on commit 7ddf3e9

Please sign in to comment.