From 46f990483a5513335f4e61e13aee0c8993d9bf15 Mon Sep 17 00:00:00 2001 From: Spring Buildmaster Date: Tue, 20 May 2014 10:04:29 -0700 Subject: [PATCH 1/5] DATACASS-131 - Prepare next development iteration. --- pom.xml | 2 +- spring-cql/pom.xml | 2 +- spring-data-cassandra-distribution/pom.xml | 2 +- spring-data-cassandra/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4b7f0a513..99d03678c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-cassandra-parent - 1.0.0.RELEASE + 1.1.0.BUILD-SNAPSHOT pom Spring Data Cassandra diff --git a/spring-cql/pom.xml b/spring-cql/pom.xml index fff849183..b879afe2e 100644 --- a/spring-cql/pom.xml +++ b/spring-cql/pom.xml @@ -11,7 +11,7 @@ org.springframework.data spring-data-cassandra-parent - 1.0.0.RELEASE + 1.1.0.BUILD-SNAPSHOT ../pom.xml diff --git a/spring-data-cassandra-distribution/pom.xml b/spring-data-cassandra-distribution/pom.xml index af87adf35..a07e7f97a 100644 --- a/spring-data-cassandra-distribution/pom.xml +++ b/spring-data-cassandra-distribution/pom.xml @@ -13,7 +13,7 @@ org.springframework.data spring-data-cassandra-parent - 1.0.0.RELEASE + 1.1.0.BUILD-SNAPSHOT ../pom.xml diff --git a/spring-data-cassandra/pom.xml b/spring-data-cassandra/pom.xml index 5e0258688..21297f088 100644 --- a/spring-data-cassandra/pom.xml +++ b/spring-data-cassandra/pom.xml @@ -11,7 +11,7 @@ org.springframework.data spring-data-cassandra-parent - 1.0.0.RELEASE + 1.1.0.BUILD-SNAPSHOT ../pom.xml From 6d2086febb3cd95eb3f63460baf64d2db910ada3 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 20 May 2014 19:43:57 +0200 Subject: [PATCH 2/5] DATACASS-131 - After release cleanups. --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 99d03678c..0dae664af 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 @@ -15,7 +15,7 @@ org.springframework.data.build spring-data-parent - 1.4.0.RELEASE + 1.5.0.BUILD-SNAPSHOT ../spring-data-build/parent/pom.xml @@ -28,7 +28,7 @@ multi spring-data-cassandra - 1.8.0.RELEASE + 1.9.0.BUILD-SNAPSHOT 2.0.2.1 2.0.2 1.0 @@ -195,8 +195,8 @@ - spring-libs-release - http://repo.spring.io/libs-release + spring-libs-snapshot + http://repo.spring.io/libs-snapshot From 3c4a31be0eea5f8fffa6423cb3bd632e5af265ca Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 20 May 2014 19:40:45 +0200 Subject: [PATCH 3/5] DATACASS-134 - Added missing plugin repository declaration. --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 0dae664af..ddd236494 100644 --- a/pom.xml +++ b/pom.xml @@ -200,6 +200,13 @@ + + + spring-plugins-release + http://repo.spring.io/plugins-release + + + com.datastax.cassandra From a5cad94c69fc9d98b63cc883588419414e072592 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 20 May 2014 21:31:52 +0200 Subject: [PATCH 4/5] DATACASS-135 - Fixed reference documentation build. Removed empty lang attributes from programlisting elements. Switched to Docbook 4.4 DTD as 4.5 is currently not supported by the Maven Docbook plugin. Fixed section identifiers. --- src/docbkx/introduction/getting-started.xml | 54 +++++---- src/docbkx/reference/cassandra.xml | 123 +++++++++++++------- 2 files changed, 108 insertions(+), 69 deletions(-) diff --git a/src/docbkx/introduction/getting-started.xml b/src/docbkx/introduction/getting-started.xml index 302c5d5a9..51826be2e 100644 --- a/src/docbkx/introduction/getting-started.xml +++ b/src/docbkx/introduction/getting-started.xml @@ -4,49 +4,53 @@ Additional Help Resources - Learning a new framework is not always straight forward. In this section, we try to provide - what we think is an easy to follow guide for starting with Spring Data Cassandra module. - However, if you encounter issues or you are just looking for an advice, feel free to use one of - the links below: + Learning a new framework is not always straight forward. In this + section, we try to provide what we think is an easy to follow guide for + starting with Spring Data Cassandra module. However, if you encounter issues + or you are just looking for an advice, feel free to use one of the links + below: -
+
Support There are a few support options available: -
+
Community Forum - The Spring Data forum - is a message board for all Spring Data (not just Cassandra) users to share - information and help each other. Note that registration is needed only - for posting. + The Spring Data forum + is a message board for all Spring Data (not just Cassandra) users to + share information and help each other. Note that registration is needed + only for posting.
-
+
Professional Support - Professional, from-the-source support, with guaranteed response time, is available from - Prowave Consulting. + Professional, from-the-source support, with guaranteed response + time, is available from Prowave + Consulting.
-
+
Following Development - For information on the Spring Data Cassandra source code repository, nightly builds and - snapshot artifacts please see the Spring Data Cassandra - homepage. + For information on the Spring Data Cassandra source code repository, + nightly builds and snapshot artifacts please see the Spring Data + Cassandra homepage. - You can help make Spring Data best serve the needs of the Spring community by interacting - with developers through the Spring Community forums. To follow developer activity look for the mailing list information on the - Spring Data Cassandra homepage. + You can help make Spring Data best serve the needs of the Spring + community by interacting with developers through the Spring Community + forums. To follow developer + activity look for the mailing list information on the Spring Data + Cassandra homepage. - If you encounter a bug or want to suggest an improvement, please create a ticket on the - Spring Data issue tracker. + If you encounter a bug or want to suggest an improvement, please + create a ticket on the Spring Data issue tracker. To stay up to date with the latest news and announcements in the Spring eco system, subscribe to the Spring Community - + Cassandra support @@ -79,7 +79,7 @@ Then add the following to pom.xml dependencies section. - <dependencies> + <dependencies> <!-- other dependency elements omitted --> @@ -93,7 +93,7 @@ Also change the version of Spring in the pom.xml to be - <spring.framework.version>3.2.8.RELEASE</spring.framework.version> + <spring.framework.version>3.2.8.RELEASE</spring.framework.version> You will also need to add the location of the Spring Milestone repository for maven to your pom.xml which is at the same level of your @@ -726,20 +726,27 @@ cassandraOperations.execute(cql);
Updating rows in a CQL table - Much like inserting, there are several flavors of update from which you can - choose. + + Much like inserting, there are several flavors of update from + which you can choose. + Update a record with an annotated POJO. + cassandraOperations.update(new Person("123123123", "Alison", 35)); - Update a row using the QueryBuilder.Update object that is part of the DataStax Java - Driver. + + Update a row using the QueryBuilder.Update object that is part of + the DataStax Java Driver. + Update update = QueryBuilder.update("person"); update.setConsistencyLevel(ConsistencyLevel.ONE); update.with(QueryBuilder.set("age", 35)); update.where(QueryBuilder.eq("id", "123123123")); cassandraOperations.execute(update); - Then there is always the old fashioned way. You can write your own CQL - statements. + + Then there is always the old fashioned way. You can write your own + CQL statements. + String cql = "update person set age = 35 where id = '123123123'"; cassandraOperations.execute(cql); @@ -747,35 +754,50 @@ cassandraOperations.execute(cql);
Methods for removing rows - Much like inserting, there are several flavors of delete from which you can - choose. + + Much like inserting, there are several flavors of delete from + which you can choose. + Delete a record with an annotated POJO. + cassandraOperations.delete(new Person("123123123", null, 0)); - Delete a row using the QueryBuilder.Delete object that is part of the DataStax Java - Driver. + + Delete a row using the QueryBuilder.Delete object that is part of + the DataStax Java Driver. + Delete delete = QueryBuilder.delete().from("person"); delete.where(QueryBuilder.eq("id", "123123123")); cassandraOperations.execute(delete); - Then there is always the old fashioned way. You can write your own CQL - statements. + + Then there is always the old fashioned way. You can write your own + CQL statements. + String cql = "delete from person where id = '123123123'"; cassandraOperations.execute(cql);
+
Methods for truncating tables - Much like inserting, there are several flavors of truncate from which you can - choose. + + Much like inserting, there are several flavors of truncate from + which you can choose. + Truncate a table using the truncate() method. + cassandraOperations.truncate("person"); - Truncate a table using the QueryBuilder.Truncate object that is part of the DataStax - Java Driver. + + Truncate a table using the QueryBuilder.Truncate object that is + part of the DataStax Java Driver. + Truncate truncate = QueryBuilder.truncate("person"); cassandraOperations.execute(truncate); - Then there is always the old fashioned way. You can write your own CQL - statements. + + Then there is always the old fashioned way. You can write your own + CQL statements. + String cql = "truncate person"; cassandraOperations.execute(cql); @@ -784,32 +806,43 @@ cassandraOperations.execute(cql);
Querying CQL Tables - Tthere are several flavors of select and query from which you can choose. Please see the - CassandraTemplate API documentation for all overloads available. - Query a table for multiple rows and map the results to a POJO. + + Tthere are several flavors of select and query from which you can + choose. Please see the CassandraTemplate API documentation for all + overloads available. + + Query a table for multiple rows and map the results to a + POJO. + String cqlAll = "select * from person"; -List<Person> results = cassandraOperations.select(cqlAll, Person.class); +List<Person> results = cassandraOperations.select(cqlAll, Person.class); for (Person p : results) { LOG.info(String.format("Found People with Name [%s] for id [%s]", p.getName(), p.getId())); } + Query a table for a single row and map the result to a POJO. + String cqlOne = "select * from person where id = '123123123'"; Person p = cassandraOperations.selectOne(cqlOne, Person.class); LOG.info(String.format("Found Person with Name [%s] for id [%s]", p.getName(), p.getId())); - Query a table using the QueryBuilder.Select object that is part of the DataStax Java - Driver. + + Query a table using the QueryBuilder.Select object that is part of + the DataStax Java Driver. + Select select = QueryBuilder.select().from("person"); select.where(QueryBuilder.eq("id", "123123123")); Person p = cassandraOperations.selectOne(select, Person.class); LOG.info(String.format("Found Person with Name [%s] for id [%s]", p.getName(), p.getId())); - Then there is always the old fashioned way. You can write your own CQL statements, and - there are several callback handlers for mapping the results. The example uses the RowMapper - interface. + + Then there is always the old fashioned way. You can write your own + CQL statements, and there are several callback handlers for mapping the + results. The example uses the RowMapper interface. + String cqlAll = "select * from person"; -List<Person> results = cassandraOperations.query(cqlAll, new RowMapper<Person>() { +List<Person> results = cassandraOperations.query(cqlAll, new RowMapper<Person>() { public Person mapRow(Row row, int rowNum) throws DriverException { Person p = new Person(row.getString("id"), row.getString("name"), row.getInt("age")); @@ -877,23 +910,25 @@ for (Person p : results) {
Methods for executing commands - The CassandraTemplate has many overloads for execute() and executeAsync(). Pass in the - CQL command you wish to be executed, and handle the appropriate response. - This example uses the basic AsynchronousQueryListener that comes with Spring Data - Cassandra. Please see the API documentation for all the options. There should be nothing - you cannot perform in Cassandra with the execute() and executeAsync() methods. - - cassandraOperations.executeAsynchronously("delete from person where id = '123123123'", + The CassandraTemplate has many overloads for execute() and + executeAsync(). Pass in the CQL command you wish to be executed, and + handle the appropriate response. + + This example uses the basic AsynchronousQueryListener that comes + with Spring Data Cassandra. Please see the API documentation for all the + options. There should be nothing you cannot perform in Cassandra with + the execute() and executeAsync() methods. + + cassandraOperations.executeAsynchronously("delete from person where id = '123123123'", new AsynchronousQueryListener() { public void onQueryComplete(ResultSetFuture rsf) { LOG.info("Async Query Completed"); } - }); - - This example shows how to create and drop a table, using different API objects, all - passed to the execute() - methods.cassandraOperations.execute("create table test_table (id uuid primary key, event text)"); + }); + + This example shows how to create and drop a table, using different + API objects, all passed to the execute() methods.cassandraOperations.execute("create table test_table (id uuid primary key, event text)"); DropTableSpecification dropper = DropTableSpecification.dropTable("test_table"); cassandraOperations.execute(dropper); From 07439c2ddec5b3c4316872a8b683d981da5891b4 Mon Sep 17 00:00:00 2001 From: David Webb Date: Thu, 12 Jun 2014 00:12:52 -0400 Subject: [PATCH 5/5] DATACASS-137 - Completed Added mapping for 3 new ConsistencyLevels. --- .../springframework/cassandra/core/ConsistencyLevel.java | 2 +- .../cassandra/core/ConsistencyLevelResolver.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevel.java b/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevel.java index 2373413c4..116ba04c2 100644 --- a/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevel.java +++ b/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevel.java @@ -23,6 +23,6 @@ package org.springframework.cassandra.core; */ public enum ConsistencyLevel { - ANY, ONE, TWO, THREE, QUOROM, LOCAL_QUOROM, EACH_QUOROM, ALL + ANY, ONE, TWO, THREE, QUOROM, LOCAL_QUOROM, EACH_QUOROM, ALL, LOCAL_ONE, SERIAL, LOCAL_SERIAL } diff --git a/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevelResolver.java b/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevelResolver.java index 96482e472..fc2fe577d 100644 --- a/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevelResolver.java +++ b/spring-cql/src/main/java/org/springframework/cassandra/core/ConsistencyLevelResolver.java @@ -46,6 +46,9 @@ public final class ConsistencyLevelResolver { case ONE: resolvedLevel = com.datastax.driver.core.ConsistencyLevel.ONE; break; + case LOCAL_ONE: + resolvedLevel = com.datastax.driver.core.ConsistencyLevel.LOCAL_ONE; + break; case ALL: resolvedLevel = com.datastax.driver.core.ConsistencyLevel.ALL; break; @@ -67,6 +70,12 @@ public final class ConsistencyLevelResolver { case TWO: resolvedLevel = com.datastax.driver.core.ConsistencyLevel.TWO; break; + case SERIAL: + resolvedLevel = com.datastax.driver.core.ConsistencyLevel.SERIAL; + break; + case LOCAL_SERIAL: + resolvedLevel = com.datastax.driver.core.ConsistencyLevel.LOCAL_SERIAL; + break; default: break; }