151 Commits

Author SHA1 Message Date
Spring Operator
16500da531 DATACASS-640 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 3 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 582 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #157
2019-03-22 11:13:33 +01:00
Spring Operator
1d6e8b8850 DATACASS-640 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://www.prowaveconsulting.com (200) with 1 occurrences could not be migrated:
   ([https](https://www.prowaveconsulting.com) result SSLHandshakeException).
* http://www.scispike.com (200) with 1 occurrences could not be migrated:
   ([https](https://www.scispike.com) result SSLHandshakeException).

These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://maven.apache.org/xsd/maven-4.0.0.xsd with 5 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).
* http://projects.spring.io/spring-data-cassandra/ with 1 occurrences migrated to:
  https://projects.spring.io/spring-data-cassandra/ ([https](https://projects.spring.io/spring-data-cassandra/) result 200).
* http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar with 1 occurrences migrated to:
  https://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar ([https](https://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar) result 200).
* http://www.pivotal.io with 2 occurrences migrated to:
  https://www.pivotal.io ([https](https://www.pivotal.io) result 301).

These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0 with 10 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 5 occurrences

Resolves gh-147.
2019-03-18 16:44:45 -07:00
John Blum
d0982dc119 DATACASS-330 - Review and apply additional polish. 2017-02-06 19:04:32 -08:00
Mark Paluch
4df8fd1fce DATACASS-330 - Polishing.
Move Reactive Session support to session package. Reorder fields according their visibility.
2017-02-06 19:04:25 -08:00
Mark Paluch
22e6e9ae9f DATACASS-330 - Add Session routing.
We now support Session routing with AbstractRoutingSessionFactory. Session routing is based on a map, keyed by a lookup key that is supplied by an implementing class upon Session lookup.

Extend JavaConfig to configure a SessionFactory bean and configure CqlTemplate and CassandraAdminTemplate accordingly.
2017-02-06 19:04:18 -08:00
Mark Paluch
68d61461cd DATACASS-330 - Add SessionFactory to CqlTemplate and AsyncCqlTemplate.
We now support SessionFactory to obtain Cassandra Session's on a per-request basis. CassandraAccessor is configured primarily with a SessionFactory now, the existing initialization configures a DefaultSessionFactory that returns the initially given Session instance.

Sessions should not be acquired directly by getSession but inside a callback-block so it's guaranteed to operate on the same session within a particular operation. That's especially relevant when preparing and executing prepared statements.

PreparedStatementCallback was changed in a breaking way as it now accepts additionally a Session to retain the session context.

Related ticket: DATACASS-32
2017-02-06 19:04:09 -08:00
Mark Paluch
7e33bf3bcf DATACASS-393 - Polishing.
Add override comments. Fix JavaDoc. Reformat code.
2017-02-01 11:54:12 +01:00
Mark Paluch
bc5262d633 DATACASS-393 - Remove references to Assert single-arg methods.
Replace references to Assert single-arg methods with references to methods accepting the test object and message.

Related ticket: SPR-15196.
2017-02-01 11:44:02 +01:00
Mark Paluch
fff664393e DATACASS-290 - Polishing.
Align declared type of CassandraCqlTemplateFactoryBean to CqlTemplate and the type of CassandraTemplateFactoryBean to CassandraTemplate to report consistent bean types. Add JavaDoc.

Original pull request: #76.
2017-01-25 10:28:17 +01:00
Mark Paluch
48c6240c9f DATACASS-388 - Improve JavaDoc for configuration classes. 2017-01-20 11:02:29 +01:00
Mark Paluch
7563e9b27e DATACASS-381 - Improve integration test stability.
Reuse Thread pools during integration test runs to not recreate and dispose Threads multiple times. Increase build and Cassandra memory. Use an external Cassandra instance for TravisCI build jobs.
2017-01-20 09:43:40 +01:00
Mark Paluch
b247181a34 DATACASS-385 - Migrate ticket references in test code to Spring Framework style. 2017-01-11 12:06:50 +01:00
Mark Paluch
cc00fe735b DATACASS-379 - Add package documentation. 2017-01-03 09:18:55 +01:00
John Blum
8ec905c442 DATACASS-360 - Polish. 2016-11-29 20:15:20 -08:00
Mark Paluch
3b717be06a DATACASS-351 - Revert Spring Data Cassandra 1.5 changes in 1.0 schema files.
Revert added features in version 1.0 schema files in favor of version 1.5 schema files. Remove license header. Remove TODOs and fix documentation source names.
2016-11-28 15:30:00 +01:00
Oliver Gierke
76e179467b DATACASS-354 - Prepare next development iteration. 2016-11-23 10:59:08 +01:00
Oliver Gierke
c13c6fa4d6 DATACASS-354 - Release version 2.0 M1 (Kay). 2016-11-23 10:35:47 +01:00
John Blum
542ce24173 DATACASS-292 - Polish. 2016-11-22 21:59:58 -08:00
Mark Paluch
8af23880e9 DATACASS-292 - Provide revised synchronous and asynchronous CQL and Cassandra templates.
We now provide revised CQL and Cassandra templates as central classes to interact with CQL and Cassandra with object mapping. Previously, synchronous and asynchronous methods were exposed inside the same interfaces that made it hard to chose the right method.

The revised Template API consists of:

* CqlTemplate
* AsyncCqlTemplate
* CassandraTemplate
* AsyncCassandraTemplate

CassandraTemplate and AsyncCassandraTemplate reuse CqlTemplate and AsyncCqlTemplate instead of extending from these. This is, to not mix methods using conversion/object mapping with lower level CQL execution methods.

AsyncCqlTemplate and AsyncCassandraTemplate are all new and benefit from ListenableFuture as synchronization aid. They no longer rely on various callback-interfaces.

CassandraTemplate and AsyncCassandraTemplate no longer provide insert/update/delete methods accepting a collection of items. Use CassandraBatchOperations for atomic batches to group operations.
2016-11-22 21:59:47 -08:00
John Blum
1c7413bf1f DATACASS-335 - Polish. 2016-11-11 04:45:23 -08:00
Mark Paluch
e0741a8691 DATACASS-335 - Adopt changes in Spring Data Commons.
- Remove version placeholders for reactor and rxjava
- Adopt type migration of ReactiveWrappers
- Adopt RxJava to RxJava1 repository interface renaming
- Use ReactiveQueryMethod in ReactiveMongoQuery.
- Remove trailing whitespaces.
- Use ReflectionUtils for method iteration in ReactiveType.
2016-11-11 04:45:23 -08:00
Mark Paluch
52f4f570a9 DATACASS-335 - Add support for reactive data access.
We now support reactive data access with Spring Data Cassandra by adopting Datastax' asynchronous driver.

ReactiveCqlTemplate and ReactiveCassandraTemplate use Project Reactor wrapper types Mono and Flux to implement Template API and repository support. Reactive template supports common operations such as:

* Query/Execution methods for static CQL and prepared statements
* Insert/Save/Update/Delete methods
* Exists and Count projections
* Reactive Callback methods

Person person = new Person("Dave", 25);

template.insert(person) //
    .flatMap(p -> template.update(new Person("Sven", 25))) //
    .flatMap(p -> template.selectOneById(person.getId(), Person.class)) //
    .subscribeWith(TestSubscriber.create()) //
    .await() //
    .assertValuesWith(result -> {
        assertThat(result.getFirstName(), is(equalTo("Sven")));
    });

Reactive Repository support is built on top of ReactiveCassandraTemplate using ReactiveCassandraRepository as the store-specific base repository. Reactive repositories are enabled by using @EnableReactiveCassandraRepositories on a @Configuration class to opt-in for reactive support. Reactive repositories can be composed of a reactive base interface such as

* ReactiveCrudRepository
* ReactiveSortingRepository
* RxJava1CrudRepository
* RxJava1SortingRepository

and are identified as reactive repository if one method uses a reactive wrapper type (such as Flux or Observable). If a reactive repository is discovered, it's not implemented by the blocking repository support but with the reactive repository factory. Blocking methods are not (yet) synchronized when using a reactive repository so each repository method must use a reactive wrapper result type. Reactive repository support with Spring Data allows using RxJava1 and Project Reactor types to declare repository methods. Reactive wrapper types are internally converted so the composition library choice on repository level is left up to the user.

There's feature parity between Reactive Cassandra repository support and blocking repository support.

Feature overview:

* Query Methods using String queries and Query Derivation
* Projections

@Configuration
@EnableReactiveCassandraRepositories
class ApplicationConfig extends AbstractReactiveCassandraConfiguration {

  @Override
  protected String getKeyspaceName() {
    return "mykeyspace";
  }

  @Override
  protected String getEntityBasePackages() {
    return new String[] {"com.springdata.cassandra"};
  }
}

public interface PersonRepository extends ReactiveSortingRepository<Person, String> {

  Flux<Person> findByFirstname(String firstname);

  Flux<Person> findByFirstname(Publisher<String> firstname);

  Mono<Person> findByFirstnameAndLastname(String firstname, String lastname);
}

public interface PersonRepository extends RxJava1SortingRepository<Person, String> {

  Observable<Person> findByFirstname(String firstname);

  Observable<Person> findByFirstname(Single<String> firstname);

  Single<Person> findByFirstnameAndLastname(String firstname, String lastname);
}
2016-11-11 04:45:22 -08:00
John Blum
dcc34a284a DATACASS-172 - Polish. 2016-11-11 03:17:09 -08:00
Mark Paluch
cfa8a6177f DATACASS-172 - Support for UDTs.
We now support Cassandra User-defined types. UDTs can be created using CQL generators and used inside of mapped domain classes. User-defined types can be used either raw as UDTValue that is passed through or as mapped object. Mapped UDTs must be annotated with @UserDefinedType. Types are included into schema generation so known and defined UDTs are created before any tables are created. UDTs can be used with set and list collection types and in primary keys. UDTs can also be used in repository query methods as query predicates.
Updating UDTs will update the whole UDT.

@UserDefinedType
public class Address {
  String city;
  String country;
}

@Table
public class Person {

  @Id String id;
  Address address;
  UDTValue genericUdt;
}

The XML namespace support was extended with new schema versions to support provide a User Type resolver so UDTs can be resolved:

<cassandra:mapping>
  <cassandra:user-type-resolver keyspace-name="${cassandra.keyspace}" />
</cassandra:mapping>
2016-11-11 03:16:43 -08:00
Mark Paluch
84f680ee3e DATACASS-172 - Polishing.
Add tests. Add validations to Cql generators. Enhance JavaDoc. Create FieldSpecification for UDT fields.
2016-11-11 03:13:41 -08:00
Fabio Mendes
ac868d2f0a DATACASS-172 - Add CQL specifications/generators and UserDefinedType annotation. 2016-11-11 03:13:32 -08:00
Mark Paluch
3c80b2cb80 DATACASS-329 - Set up 2.0 development. 2016-10-25 09:37:49 +02:00
Mark Paluch
8ff1f0e3fc DATACASS-333 - Switch tests to AssertJ. 2016-10-25 09:37:13 +02:00
Mark Paluch
6b683f4346 DATACASS-350 - Add since version to existing deprecations. 2016-10-24 12:17:20 +02:00
Mark Paluch
24ffba5d2f DATACASS-276 - Use Row.getObject(…) instead of deserialization with CodecRegistry and ProtocolVersion.
We now rely on Row.getObject(…) to retrieve data from a Cassandra Column. CodecRegistry and ProtocolVersion are configured on Cluster so there's no need to use a static configured CodecRegistry and ProtocolVersion that might not fit the configured values.
2016-10-12 14:42:06 +02:00
Mark Paluch
54c7ab6928 DATACASS-335 - Reuse Cluster connection resources during tests where possible.
High client churn seems to affect Cassandra in a negative way (connection timeouts, driver considers hosts as down). Almost all integration tests bootstrap their own Cluster instance and dispose it once the tests has finished. Identify tests where reuse of a global Cluster instance provided by CassandraRule is possible and switch from context bootstrapping to reuse. This helps to prevent integration test failures.
2016-10-12 14:11:51 +02:00
Mark Paluch
add4cab01b DATACASS-347 - Support NettyOptions configuration in XML-based configuration.
We now support `NettyOptions` bean references in XML-based configuration.

<bean id="nettyOptions" class="…" />

<cass:cluster contact-points="…" netty-options-ref="nettyOptions" />
2016-10-12 14:11:50 +02:00
Mark Paluch
45d77ff73e DATACASS-344 - Polishing.
Switch heartbeatIntervalSeconds, idleTimeoutSeconds and poolTimeoutMilliseconds to primitive integers and compare values against defaults to decide whether to set these properties on PoolingOptions.
2016-10-12 14:11:50 +02:00
Mark Paluch
071c101c28 DATACASS-344 - Upgrade Cassandra Driver to 3.1.1.
We are now compatible with Datastax’ Cassandra Driver 3.1.1 and support the newly introduced configuration options MaxQueueSize for PoolingOptions.

This change also removes test assertions for PoolTimeoutMillis as this option was deprecated and made unusable with 3.1.1.
2016-10-12 14:11:47 +02:00
Mark Paluch
b07c708c7c DATACASS-346 - Upgrade embedded Cassandra to 3.9. 2016-10-12 12:25:45 +02:00
John Blum
f293516ecd DATACASS-217 - Polish.
Original pull request: #82.
2016-08-29 16:10:19 -07:00
Mark Paluch
23cb654b18 DATACASS-217 - Add support for LZ4 compression.
Original pull request: #82.
2016-08-29 16:10:11 -07:00
John Blum
c407aad8cf DATACASS-328 - Polish.
Original pull request: #81.
2016-08-09 14:59:39 -07:00
Mark Paluch
fd8e430592 DATACASS-328 - Revise QueryOptions and WriteOptions.
Deprecate our org.springframework.cassandra.core.ConsistencyLevel enum. Having an own consistency level type leads to confusion and it's always behind the driver. We don't want to maintain that type, so we decided to deprecate the own type and use the driver consistency levels.

We allow now the use of the driver retry policies aside of our consistency level enumeration. For most cases, our enumeration is the simpler approach. Some retry policies (IdempotenceAwareRetryPolicy, LoggingRetryPolicies) require further configuration and cannot be applied with just using a static enum value. We now support ReadTimeout, FetchSize, and Tracing via QueryOptions and WriteOptions and provide builders for QueryOptions and WriteOptions.

Original pull request: #81.
2016-08-09 14:59:28 -07:00
Mark Paluch
43ab34ac54 DATACASS-202 - Polishing.
Add author tags. Extend date range in headers. Simplify resolution by removing intermediate variables. Add test to verify ConsistencyLevel resolution. Guard consistency level against null.

Originall pull request: #54.
2016-07-28 15:27:17 +02:00
Antoine Toulme
da263df25c DATACASS-202 - Fix misspelled ConsistencyLevel enum constants.
Deprecate all misspelled consistency level enum values and add new consistency level enum values with correct spellings.

Original pull request: #54.
2016-07-28 15:26:25 +02:00
Oliver Gierke
229dbce133 DATACASS-269 - Prepare next development iteration. 2016-07-27 14:32:34 +02:00
Oliver Gierke
96d21eda0d DATACASS-269 - Release version 1.5 M1 (Ingalls). 2016-07-27 13:52:12 +02:00
Mark Paluch
7d5b79b9e4 DATACASS-238 - Polishing.
Reformat field declarations. Add/enhance JavaDoc. Add since tags to the new methods.

Original pull requests: #79, #80.
2016-07-26 12:14:01 +02:00
John Blum
58ed9789de DATACASS-325 - Add ClusterBuilderConfigurer configuration API.
We allow users to provide a ClusterBuilderConfigurer that can be applied to the Cluster Builder. ClusterBuilderConfigurer is a callback interface to handle extended configuration when the DataStax API changes. It allows configuration of options after all provided properties were set.

Original pull request: #79.
Related pull request: #80.
2016-07-26 12:04:35 +02:00
John Blum
dfc7e3a716 DATACASS-238 - Add Cluster configuration options.
We now support configuration of the cluster name, AddressTranslator, MaxSchemaAgreementWaitSeconds, SpeculativeExecutionPolicy and TimestampGenerator in the Cassandra Cluster factory. The cluster name is derived from the bean name, if not configured otherwise.

Related tickets: DATACASS-120, DATACASS-316, DATACASS-317, DATACASS-319, DATACASS-320.
Original pull request: #79.
Related pull request: #80.
2016-07-26 12:04:29 +02:00
Mark Paluch
1cc85fa68e DATACASS-305 - Polishing.
Add generics to list of specifications. Extract CQL generation in own method. Add author tag.

Original pull request: #70.
2016-07-05 09:34:33 +02:00
Stefan Birkner
5154d2b531 DATACASS-305 - Improve readability of CassandraCqlClusterFactoryBean.executeSpecsAndScripts.
We now check first whether any CQL statements need to be executed. This makes the code simpler because we don't have to check whether the session has already been created. Rename the Session variable system to session to omit confusion. Remove CQL logging here as CQL statements are logged inside the CqlTemplate.

Original pull request: #70.
2016-07-05 09:34:19 +02:00
John Blum
570d71a905 DATACASS-304 - CqlTemplate.doExecute does not translate Cassandra Exceptions. 2016-07-01 17:50:32 -07:00
John Blum
ab73021187 DATACASS-310 - Fix CqlTemplate and CassandraTemplate returning null for data access operations returning a Collection. 2016-07-01 17:26:04 -07:00