doInPreparedStatement(PreparedStatement ps) throws DriverException {
- ResultSet rs = null;
- BoundStatement bs = null;
- if (psb != null) {
- bs = psb.bindValues(ps);
- } else {
- bs = ps.bind();
- }
- rs = doExecute(bs);
-
- return process(rs, rowMapper);
- }
- });
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/cassandra/core/CqlParameter.java b/src/main/java/org/springframework/cassandra/core/CqlParameter.java
deleted file mode 100644
index bfd5db193..000000000
--- a/src/main/java/org/springframework/cassandra/core/CqlParameter.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.springframework.util.Assert;
-
-import com.datastax.driver.core.DataType;
-
-/**
- * @author David Webb
- *
- */
-public class CqlParameter {
-
- /** The name of the parameter, if any */
- private String name;
-
- /** SQL type constant from {@link DataType} */
- private final DataType type;
-
- /** The scale to apply in case of a NUMERIC or DECIMAL type, if any */
- private Integer scale;
-
- /**
- * Create a new anonymous CqlParameter, supplying the SQL type.
- *
- * @param type Cassandra Data Type of the parameter according to {@link DataType}
- */
- public CqlParameter(DataType type) {
- this.type = type;
- }
-
- /**
- * Create a new anonymous CqlParameter, supplying the SQL type.
- *
- * @param type Cassandra Data Type of the parameter according to {@link DataType}
- * @param scale the number of digits after the decimal point
- */
- public CqlParameter(DataType type, int scale) {
- this.type = type;
- this.scale = scale;
- }
-
- /**
- * Create a new CqlParameter, supplying name and SQL type.
- *
- * @param name name of the parameter, as used in input and output maps
- * @param type Cassandra Data Type of the parameter according to {@link DataType}
- */
- public CqlParameter(String name, DataType type) {
- this.name = name;
- this.type = type;
- }
-
- /**
- * Create a new CqlParameter, supplying name and SQL type.
- *
- * @param name name of the parameter, as used in input and output maps
- * @param type Cassandra Data Type of the parameter according to {@link DataType}
- * @param scale the number of digits after the decimal point (for DECIMAL and NUMERIC types)
- */
- public CqlParameter(String name, DataType type, int scale) {
- this.name = name;
- this.type = type;
- this.scale = scale;
- }
-
- /**
- * Copy constructor.
- *
- * @param otherParam the CqlParameter object to copy from
- */
- public CqlParameter(CqlParameter otherParam) {
- Assert.notNull(otherParam, "CqlParameter object must not be null");
- this.name = otherParam.name;
- this.type = otherParam.type;
- this.scale = otherParam.scale;
- }
-
- /**
- * Return the name of the parameter.
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * Return the SQL type of the parameter.
- */
- public DataType getType() {
- return this.type;
- }
-
- /**
- * Return the scale of the parameter, if any.
- */
- public Integer getScale() {
- return this.scale;
- }
-
- /**
- * Return whether this parameter holds input values that should be set before execution even if they are {@code null}.
- *
- * This implementation always returns {@code true}.
- */
- public boolean isInputValueProvided() {
- return true;
- }
-
- /**
- * Convert a list of JDBC types, as defined in {@code java.sql.Types}, to a List of CqlParameter objects as used in
- * this package.
- */
- public static List sqlTypesToAnonymousParameterList(DataType[] types) {
- List result = new LinkedList();
- if (types != null) {
- for (DataType type : types) {
- result.add(new CqlParameter(type));
- }
- }
- return result;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/CqlParameterValue.java b/src/main/java/org/springframework/cassandra/core/CqlParameterValue.java
deleted file mode 100644
index c2932815f..000000000
--- a/src/main/java/org/springframework/cassandra/core/CqlParameterValue.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import com.datastax.driver.core.DataType;
-
-/**
- * @author David Webb
- *
- */
-public class CqlParameterValue extends CqlParameter {
-
- private final Object value;
-
- /**
- * Create a new CqlParameterValue, supplying the Cassandra DataType.
- *
- * @param type Cassandra Data Type of the parameter according to {@link DataType}
- * @param value the value object
- */
- public CqlParameterValue(DataType type, Object value) {
- super(type);
- this.value = value;
- }
-
- /**
- * Create a new CqlParameterValue, supplying the Cassandra DataType.
- *
- * @param type Cassandra Data Type of the parameter according to {@link DataType}
- * @param scale the number of digits after the decimal point (for DECIMAL and NUMERIC types)
- * @param value the value object
- */
- public CqlParameterValue(DataType type, int scale, Object value) {
- super(type, scale);
- this.value = value;
- }
-
- /**
- * Create a new CqlParameterValue based on the given CqlParameter declaration.
- *
- * @param declaredParam the declared CqlParameter to define a value for
- * @param value the value object
- */
- public CqlParameterValue(CqlParameter declaredParam, Object value) {
- super(declaredParam);
- this.value = value;
- }
-
- /**
- * Return the value object that this parameter value holds.
- */
- public Object getValue() {
- return this.value;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/CqlProvider.java b/src/main/java/org/springframework/cassandra/core/CqlProvider.java
deleted file mode 100644
index 7b0ddd59d..000000000
--- a/src/main/java/org/springframework/cassandra/core/CqlProvider.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-/**
- * @author David Webb
- *
- */
-public interface CqlProvider {
-
- String getCql();
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/HostMapper.java b/src/main/java/org/springframework/cassandra/core/HostMapper.java
deleted file mode 100644
index 66b81f3da..000000000
--- a/src/main/java/org/springframework/cassandra/core/HostMapper.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.springframework.cassandra.core;
-
-import java.util.Collection;
-import java.util.Set;
-
-import com.datastax.driver.core.Host;
-import com.datastax.driver.core.exceptions.DriverException;
-
-public interface HostMapper {
-
- Collection mapHosts(Set host) throws DriverException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/PreparedStatementBinder.java b/src/main/java/org/springframework/cassandra/core/PreparedStatementBinder.java
deleted file mode 100644
index f4bd1cca2..000000000
--- a/src/main/java/org/springframework/cassandra/core/PreparedStatementBinder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import com.datastax.driver.core.BoundStatement;
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * @author David Webb
- *
- */
-public interface PreparedStatementBinder {
-
- BoundStatement bindValues(PreparedStatement ps) throws DriverException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/PreparedStatementCallback.java b/src/main/java/org/springframework/cassandra/core/PreparedStatementCallback.java
deleted file mode 100644
index 1b2ba5fda..000000000
--- a/src/main/java/org/springframework/cassandra/core/PreparedStatementCallback.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import org.springframework.dao.DataAccessException;
-
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * @author David Webb
- *
- */
-public interface PreparedStatementCallback {
-
- T doInPreparedStatement(PreparedStatement ps) throws DriverException, DataAccessException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/PreparedStatementCreator.java b/src/main/java/org/springframework/cassandra/core/PreparedStatementCreator.java
deleted file mode 100644
index d95e92862..000000000
--- a/src/main/java/org/springframework/cassandra/core/PreparedStatementCreator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * Creates a PreparedStatement for the usage with the DataStax Java Driver
- *
- * @author David Webb
- *
- */
-public interface PreparedStatementCreator {
-
- /**
- * Create a statement in this session. Allows implementations to use PreparedStatements. The CassandraTemlate will
- * attempt to cache the PreparedStatement for future use without the overhead of re-preparing on the entire cluster.
- *
- * @param session Session to use to create statement
- * @return a prepared statement
- * @throws DriverException there is no need to catch DriverException that may be thrown in the implementation of this
- * method. The CassandraTemlate class will handle them.
- */
- PreparedStatement createPreparedStatement(Session session) throws DriverException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/PreparedStatementCreatorFactory.java b/src/main/java/org/springframework/cassandra/core/PreparedStatementCreatorFactory.java
deleted file mode 100644
index 974b0436e..000000000
--- a/src/main/java/org/springframework/cassandra/core/PreparedStatementCreatorFactory.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.springframework.dao.InvalidDataAccessApiUsageException;
-import org.springframework.util.Assert;
-
-import com.datastax.driver.core.BoundStatement;
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * @author David Webb
- *
- */
-public class PreparedStatementCreatorFactory {
-
- /**
- * The CQL, which won't change when the parameters change
- */
- private final String cql;
-
- /** List of CqlParameter objects. May not be {@code null}. */
- private final List declaredParameters;
-
- /**
- * Create a new factory.
- */
- public PreparedStatementCreatorFactory(String cql) {
- this.cql = cql;
- this.declaredParameters = new LinkedList();
- }
-
- /**
- * Create a new factory with the given CQL and parameters.
- *
- * @param cql CQL
- * @param declaredParameters list of {@link CqlParameter} objects
- * @see CqlParameter
- */
- public PreparedStatementCreatorFactory(String cql, List declaredParameters) {
- this.cql = cql;
- this.declaredParameters = declaredParameters;
- }
-
- /**
- * Return a new PreparedStatementBinder for the given parameters.
- *
- * @param params list of parameters (may be {@code null})
- */
- public PreparedStatementBinder newPreparedStatementBinder(List params) {
- return new PreparedStatementCreatorImpl(params != null ? params : Collections.emptyList());
- }
-
- /**
- * Return a new PreparedStatementBinder for the given parameters.
- *
- * @param params the parameter array (may be {@code null})
- */
- public PreparedStatementBinder newPreparedStatementBinder(Object[] params) {
- return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.emptyList());
- }
-
- /**
- * Return a new PreparedStatementCreator for the given parameters.
- *
- * @param params list of parameters (may be {@code null})
- */
- public PreparedStatementCreator newPreparedStatementCreator(List params) {
- return new PreparedStatementCreatorImpl(params != null ? params : Collections.emptyList());
- }
-
- /**
- * Return a new PreparedStatementCreator for the given parameters.
- *
- * @param params the parameter array (may be {@code null})
- */
- public PreparedStatementCreator newPreparedStatementCreator(Object[] params) {
- return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.emptyList());
- }
-
- /**
- * Return a new PreparedStatementCreator for the given parameters.
- *
- * @param sqlToUse the actual SQL statement to use (if different from the factory's, for example because of named
- * parameter expanding)
- * @param params the parameter array (may be {@code null})
- */
- public PreparedStatementCreator newPreparedStatementCreator(String sqlToUse, Object[] params) {
- return new PreparedStatementCreatorImpl(sqlToUse, params != null ? Arrays.asList(params) : Collections.emptyList());
- }
-
- /**
- * PreparedStatementCreator implementation returned by this class.
- */
- private class PreparedStatementCreatorImpl implements PreparedStatementCreator, PreparedStatementBinder, CqlProvider {
-
- private final String actualCql;
-
- private final List> parameters;
-
- public PreparedStatementCreatorImpl(List> parameters) {
- this(cql, parameters);
- }
-
- /**
- * @param actualCql
- * @param parameters
- */
- public PreparedStatementCreatorImpl(String actualCql, List> parameters) {
- this.actualCql = actualCql;
- Assert.notNull(parameters, "Parameters List must not be null");
- this.parameters = parameters;
- if (this.parameters.size() != declaredParameters.size()) {
- Set names = new HashSet();
- for (int i = 0; i < parameters.size(); i++) {
- Object param = parameters.get(i);
- if (param instanceof CqlParameterValue) {
- names.add(((CqlParameterValue) param).getName());
- } else {
- names.add("Parameter #" + i);
- }
- }
- if (names.size() != declaredParameters.size()) {
- throw new InvalidDataAccessApiUsageException("CQL [" + cql + "]: given " + names.size()
- + " parameters but expected " + declaredParameters.size());
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.PreparedStatementCreator#createPreparedStatement(com.datastax.driver.core.Session)
- */
- @Override
- public PreparedStatement createPreparedStatement(Session session) throws DriverException {
- return session.prepare(this.actualCql);
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.PreparedStatementBinder#bindValues(com.datastax.driver.core.PreparedStatement)
- */
- @Override
- public BoundStatement bindValues(PreparedStatement ps) throws DriverException {
- if (this.parameters == null || this.parameters.size() == 0) {
- return ps.bind();
- }
-
- // Test the type of the first value
- Object v = this.parameters.get(0);
- Object[] values;
- if (v instanceof CqlParameterValue) {
- LinkedList valuesList = new LinkedList();
- for (Object value : this.parameters) {
- valuesList.add(((CqlParameterValue) value).getValue());
- }
- values = valuesList.toArray();
- } else {
- values = this.parameters.toArray();
- }
-
- return ps.bind(values);
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.CqlProvider#getCql()
- */
- @Override
- public String getCql() {
- return cql;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("PreparedStatementCreatorFactory.PreparedStatementCreatorImpl: cql=[");
- sb.append(cql).append("]; parameters=").append(this.parameters);
- return sb.toString();
- }
-
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/PreparedStatementCreatorImpl.java b/src/main/java/org/springframework/cassandra/core/PreparedStatementCreatorImpl.java
deleted file mode 100644
index 2bedb7f67..000000000
--- a/src/main/java/org/springframework/cassandra/core/PreparedStatementCreatorImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import java.util.List;
-
-import com.datastax.driver.core.BoundStatement;
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * @author David Webb
- *
- */
-public class PreparedStatementCreatorImpl implements PreparedStatementCreator, CqlProvider, PreparedStatementBinder {
-
- private final String cql;
- private List values;
-
- public PreparedStatementCreatorImpl(String cql) {
- this.cql = cql;
- }
-
- public PreparedStatementCreatorImpl(String cql, List values) {
- this.cql = cql;
- this.values = values;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.PreparedStatementSetter#setValues(com.datastax.driver.core.PreparedStatement)
- */
- @Override
- public BoundStatement bindValues(PreparedStatement ps) throws DriverException {
- // Nothing to set if there are no values
- if (values == null) {
- return null;
- }
-
- return ps.bind(values.toArray());
-
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.CqlProvider#getCql()
- */
- @Override
- public String getCql() {
- return this.cql;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.PreparedStatementCreator#createPreparedStatement(com.datastax.driver.core.Session)
- */
- @Override
- public PreparedStatement createPreparedStatement(Session session) throws DriverException {
- return session.prepare(this.cql);
- }
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/ResultSetExtractor.java b/src/main/java/org/springframework/cassandra/core/ResultSetExtractor.java
deleted file mode 100644
index 94b03aae9..000000000
--- a/src/main/java/org/springframework/cassandra/core/ResultSetExtractor.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.springframework.cassandra.core;
-
-import org.springframework.dao.DataAccessException;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.exceptions.DriverException;
-
-public interface ResultSetExtractor {
-
- T extractData(ResultSet rs) throws DriverException, DataAccessException;
-}
diff --git a/src/main/java/org/springframework/cassandra/core/ResultSetFutureExtractor.java b/src/main/java/org/springframework/cassandra/core/ResultSetFutureExtractor.java
deleted file mode 100644
index 7c52af2eb..000000000
--- a/src/main/java/org/springframework/cassandra/core/ResultSetFutureExtractor.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.springframework.cassandra.core;
-
-import org.springframework.dao.DataAccessException;
-
-import com.datastax.driver.core.ResultSetFuture;
-import com.datastax.driver.core.exceptions.DriverException;
-
-public interface ResultSetFutureExtractor {
-
- T extractData(ResultSetFuture rs) throws DriverException, DataAccessException;
-}
diff --git a/src/main/java/org/springframework/cassandra/core/RingMember.java b/src/main/java/org/springframework/cassandra/core/RingMember.java
deleted file mode 100644
index 705d1b6b7..000000000
--- a/src/main/java/org/springframework/cassandra/core/RingMember.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2010-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import java.io.Serializable;
-
-import com.datastax.driver.core.Host;
-
-/**
- * @author David Webb
- *
- */
-public final class RingMember implements Serializable {
-
- /*
- * Ring attributes
- */
- public String hostName;
- public String address;
- public String DC;
- public String rack;
-
- public RingMember(Host h) {
- this.hostName = h.getAddress().getHostName();
- this.address = h.getAddress().getHostAddress();
- this.DC = h.getDatacenter();
- this.rack = h.getRack();
- }
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/RingMemberHostMapper.java b/src/main/java/org/springframework/cassandra/core/RingMemberHostMapper.java
deleted file mode 100644
index d4a0e44ed..000000000
--- a/src/main/java/org/springframework/cassandra/core/RingMemberHostMapper.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.springframework.util.Assert;
-
-import com.datastax.driver.core.Host;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * @author David Webb
- * @param
- *
- */
-public class RingMemberHostMapper implements HostMapper {
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.HostMapper#mapHosts(java.util.Set)
- */
- @Override
- public List mapHosts(Set hosts) throws DriverException {
-
- List members = new ArrayList();
-
- Assert.notNull(hosts);
- Assert.notEmpty(hosts);
-
- RingMember r = null;
- for (Host host : hosts) {
- r = new RingMember(host);
- members.add(r);
- }
-
- return members;
-
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/RowCallback.java b/src/main/java/org/springframework/cassandra/core/RowCallback.java
deleted file mode 100644
index 57b12493f..000000000
--- a/src/main/java/org/springframework/cassandra/core/RowCallback.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import com.datastax.driver.core.Row;
-
-/**
- * Simple internal callback to allow operations on a {@link Row}.
- *
- * @author Alex Shvid
- */
-
-public interface RowCallback {
-
- T doWith(Row object);
-}
diff --git a/src/main/java/org/springframework/cassandra/core/RowCallbackHandler.java b/src/main/java/org/springframework/cassandra/core/RowCallbackHandler.java
deleted file mode 100644
index 8eaf6da8e..000000000
--- a/src/main/java/org/springframework/cassandra/core/RowCallbackHandler.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.springframework.cassandra.core;
-
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.exceptions.DriverException;
-
-public interface RowCallbackHandler {
-
- void processRow(Row row) throws DriverException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/RowMapper.java b/src/main/java/org/springframework/cassandra/core/RowMapper.java
deleted file mode 100644
index 4de62c128..000000000
--- a/src/main/java/org/springframework/cassandra/core/RowMapper.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.springframework.cassandra.core;
-
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.exceptions.DriverException;
-
-public interface RowMapper {
-
- T mapRow(Row row, int rowNum) throws DriverException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/SessionCallback.java b/src/main/java/org/springframework/cassandra/core/SessionCallback.java
deleted file mode 100644
index 96a8d8167..000000000
--- a/src/main/java/org/springframework/cassandra/core/SessionCallback.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2010-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import org.springframework.dao.DataAccessException;
-
-import com.datastax.driver.core.Session;
-
-/**
- * Interface for operations on a Cassandra Session.
- *
- * @author David Webb
- *
- * @param
- */
-public interface SessionCallback {
-
- /**
- * Perform the operation in the given Session
- *
- * @param s
- * @return
- * @throws DataAccessException
- */
- T doInSession(Session s) throws DataAccessException;
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/SessionFactoryBean.java b/src/main/java/org/springframework/cassandra/core/SessionFactoryBean.java
deleted file mode 100644
index 179f6a64b..000000000
--- a/src/main/java/org/springframework/cassandra/core/SessionFactoryBean.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.data.cassandra.core.Keyspace;
-
-import com.datastax.driver.core.Session;
-
-/**
- * @author David Webb
- *
- */
-public class SessionFactoryBean implements FactoryBean, InitializingBean {
-
- private Keyspace keyspace;
-
- public SessionFactoryBean() {
- }
-
- public SessionFactoryBean(Keyspace keyspace) {
- setKeyspace(keyspace);
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
- */
- @Override
- public void afterPropertiesSet() throws Exception {
- if (keyspace == null) {
- throw new IllegalStateException("Keyspace required.");
- }
- }
-
- /**
- * @return Returns the keyspace.
- */
- public Keyspace getKeyspace() {
- return keyspace;
- }
-
- /**
- * @param keyspace The keyspace to set.
- */
- public void setKeyspace(Keyspace keyspace) {
- this.keyspace = keyspace;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#getObject()
- */
- @Override
- public Session getObject() {
- return keyspace.getSession();
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#getObjectType()
- */
- @Override
- public Class> getObjectType() {
- return Session.class;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.beans.factory.FactoryBean#isSingleton()
- */
- @Override
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/SimplePreparedStatementCreator.java b/src/main/java/org/springframework/cassandra/core/SimplePreparedStatementCreator.java
deleted file mode 100644
index f2ae91a5c..000000000
--- a/src/main/java/org/springframework/cassandra/core/SimplePreparedStatementCreator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2011-2013 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.cassandra.core;
-
-import org.springframework.util.Assert;
-
-import com.datastax.driver.core.PreparedStatement;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.exceptions.DriverException;
-
-/**
- * @author David Webb
- *
- */
-public class SimplePreparedStatementCreator implements PreparedStatementCreator, CqlProvider {
-
- private final String cql;
-
- /**
- * Create a PreparedStatementCreator from the provided CQL.
- *
- * @param cql
- */
- public SimplePreparedStatementCreator(String cql) {
- Assert.notNull(cql, "CQL is required to create a PreparedStatement");
- this.cql = cql;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.CqlProvider#getCql()
- */
- @Override
- public String getCql() {
- return this.cql;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.cassandra.core.PreparedStatementCreator#createPreparedStatement(com.datastax.driver.core.Session)
- */
- @Override
- public PreparedStatement createPreparedStatement(Session session) throws DriverException {
- return session.prepare(this.cql);
- }
-
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/CqlStringUtils.java b/src/main/java/org/springframework/cassandra/core/cql/CqlStringUtils.java
deleted file mode 100644
index 614dd14ab..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/CqlStringUtils.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.springframework.cassandra.core.cql;
-
-import java.util.regex.Pattern;
-
-public class CqlStringUtils {
-
- protected static final String SINGLE_QUOTE = "\'";
- protected static final String DOUBLE_SINGLE_QUOTE = "\'\'";
- protected static final String DOUBLE_QUOTE = "\"";
- protected static final String DOUBLE_DOUBLE_QUOTE = "\"\"";
-
- public static StringBuilder noNull(StringBuilder sb) {
- return sb == null ? new StringBuilder() : sb;
- }
-
- public static final String UNESCAPED_DOUBLE_QUOTE_REGEX = "TODO";
- public static final Pattern UNESCAPED_DOUBLE_QUOTE_PATTERN = Pattern.compile(UNESCAPED_DOUBLE_QUOTE_REGEX);
-
- public static final String UNQUOTED_IDENTIFIER_REGEX = "[a-zA-Z_][a-zA-Z0-9_]*";
- public static final Pattern UNQUOTED_IDENTIFIER_PATTERN = Pattern.compile(UNQUOTED_IDENTIFIER_REGEX);
-
- public static boolean isUnquotedIdentifier(CharSequence chars) {
- return UNQUOTED_IDENTIFIER_PATTERN.matcher(chars).matches();
- }
-
- public static void checkUnquotedIdentifier(CharSequence chars) {
- if (!CqlStringUtils.isUnquotedIdentifier(chars)) {
- throw new IllegalArgumentException("[" + chars + "] is not a valid CQL identifier");
- }
- }
-
- public static final String QUOTED_IDENTIFIER_REGEX = "[a-zA-Z_]([a-zA-Z0-9_]|\"{2}+)*";
- public static final Pattern QUOTED_IDENTIFIER_PATTERN = Pattern.compile(QUOTED_IDENTIFIER_REGEX);
-
- public static boolean isQuotedIdentifier(CharSequence chars) {
- return QUOTED_IDENTIFIER_PATTERN.matcher(chars).matches();
- }
-
- public static void checkQuotedIdentifier(CharSequence chars) {
- if (!CqlStringUtils.isQuotedIdentifier(chars)) {
- throw new IllegalArgumentException("[" + chars + "] is not a valid CQL quoted identifier");
- }
- }
-
- public static boolean isIdentifier(CharSequence chars) {
- return isUnquotedIdentifier(chars) || isQuotedIdentifier(chars);
- }
-
- public static void checkIdentifier(CharSequence chars) {
- if (!CqlStringUtils.isIdentifier(chars)) {
- throw new IllegalArgumentException("[" + chars + "] is not a valid CQL quoted or unquoted identifier");
- }
- }
-
- /**
- * Renders the given string as a legal Cassandra identifier.
- *
- * If the given identifier is a legal unquoted identifier, it is returned unchanged.
- * If the given identifier is a legal quoted identifier, it is returned encased in double quotes.
- * If the given identifier is illegal, an {@link IllegalArgumentException} is thrown.
- *
- */
- public static String identifize(String candidate) {
-
- checkIdentifier(candidate);
-
- if (isUnquotedIdentifier(candidate)) {
- return candidate;
- }
- // else it must be quoted
- return doubleQuote(candidate);
- }
-
- /**
- * Renders the given string as a legal Cassandra string column or table option value, by escaping single quotes and
- * encasing the result in single quotes. Given null, returns null.
- */
- public static String valuize(String candidate) {
-
- if (candidate == null) {
- return null;
- }
- return singleQuote(escapeSingle(candidate));
- }
-
- /**
- * Doubles single quote characters (' -> ''). Given null, returns null.
- */
- public static String escapeSingle(Object things) {
- return things == null ? (String) null : things.toString().replace(SINGLE_QUOTE, DOUBLE_SINGLE_QUOTE);
- }
-
- /**
- * Doubles double quote characters (" -> ""). Given null, returns null.
- */
- public static String escapeDouble(Object things) {
- return things == null ? (String) null : things.toString().replace(DOUBLE_QUOTE, DOUBLE_DOUBLE_QUOTE);
- }
-
- /**
- * Surrounds given object's {@link Object#toString()} with single quotes. Given null, returns
- * null.
- */
- public static String singleQuote(Object thing) {
- return thing == null ? (String) null : new StringBuilder().append(SINGLE_QUOTE).append(thing).append(SINGLE_QUOTE)
- .toString();
- }
-
- /**
- * Surrounds given object's {@link Object#toString()} with double quotes. Given null, returns
- * null.
- */
- public static String doubleQuote(Object thing) {
- return thing == null ? (String) null : new StringBuilder().append(DOUBLE_QUOTE).append(thing).append(DOUBLE_QUOTE)
- .toString();
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/AddColumnCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/AddColumnCqlGenerator.java
deleted file mode 100644
index e64d1acf7..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/AddColumnCqlGenerator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-
-import org.springframework.cassandra.core.keyspace.AddColumnSpecification;
-
-/**
- * CQL generator for generating an ADD clause of an ALTER TABLE statement.
- *
- * @author Matthew T. Adams
- */
-public class AddColumnCqlGenerator extends ColumnChangeCqlGenerator {
-
- public AddColumnCqlGenerator(AddColumnSpecification specification) {
- super(specification);
- }
-
- public StringBuilder toCql(StringBuilder cql) {
- return noNull(cql).append("ADD ").append(spec().getNameAsIdentifier()).append(" TYPE ")
- .append(spec().getType().getName());
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/AlterColumnCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/AlterColumnCqlGenerator.java
deleted file mode 100644
index 51759379e..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/AlterColumnCqlGenerator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-
-import org.springframework.cassandra.core.keyspace.AlterColumnSpecification;
-
-/**
- * CQL generator for generating an ALTER column clause of an ALTER TABLE statement.
- *
- * @author Matthew T. Adams
- */
-public class AlterColumnCqlGenerator extends ColumnChangeCqlGenerator {
-
- public AlterColumnCqlGenerator(AlterColumnSpecification specification) {
- super(specification);
- }
-
- public StringBuilder toCql(StringBuilder cql) {
- return noNull(cql).append("ALTER ").append(spec().getNameAsIdentifier()).append(" TYPE ")
- .append(spec().getType().getName());
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/AlterTableCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/AlterTableCqlGenerator.java
deleted file mode 100644
index 64ed9e5b7..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/AlterTableCqlGenerator.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-
-import java.util.Map;
-
-import org.springframework.cassandra.core.keyspace.AddColumnSpecification;
-import org.springframework.cassandra.core.keyspace.AlterColumnSpecification;
-import org.springframework.cassandra.core.keyspace.AlterTableSpecification;
-import org.springframework.cassandra.core.keyspace.ColumnChangeSpecification;
-import org.springframework.cassandra.core.keyspace.DropColumnSpecification;
-import org.springframework.cassandra.core.keyspace.Option;
-
-/**
- * CQL generator for generating ALTER TABLE statements.
- *
- * @author Matthew T. Adams
- */
-public class AlterTableCqlGenerator extends TableOptionsCqlGenerator {
-
- public AlterTableCqlGenerator(AlterTableSpecification specification) {
- super(specification);
- }
-
- public StringBuilder toCql(StringBuilder cql) {
- cql = noNull(cql);
-
- preambleCql(cql);
- changesCql(cql);
- optionsCql(cql);
-
- cql.append(";");
-
- return cql;
- }
-
- protected StringBuilder preambleCql(StringBuilder cql) {
- return noNull(cql).append("ALTER TABLE ").append(spec().getNameAsIdentifier()).append(" ");
- }
-
- protected StringBuilder changesCql(StringBuilder cql) {
- cql = noNull(cql);
-
- boolean first = true;
- for (ColumnChangeSpecification change : spec().getChanges()) {
- if (first) {
- first = false;
- } else {
- cql.append(" ");
- }
- getCqlGeneratorFor(change).toCql(cql);
- }
-
- return cql;
- }
-
- protected ColumnChangeCqlGenerator> getCqlGeneratorFor(ColumnChangeSpecification change) {
- if (change instanceof AddColumnSpecification) {
- return new AddColumnCqlGenerator((AddColumnSpecification) change);
- }
- if (change instanceof DropColumnSpecification) {
- return new DropColumnCqlGenerator((DropColumnSpecification) change);
- }
- if (change instanceof AlterColumnSpecification) {
- return new AlterColumnCqlGenerator((AlterColumnSpecification) change);
- }
- throw new Error("unknown ColumnChangeSpecification type: " + change.getClass().getName());
- }
-
- @SuppressWarnings("unchecked")
- protected StringBuilder optionsCql(StringBuilder cql) {
- cql = noNull(cql);
-
- Map options = spec().getOptions();
- if (options == null || options.isEmpty()) {
- return cql;
- }
-
- cql.append(" WITH ");
- boolean first = true;
- for (String key : options.keySet()) {
- if (first) {
- first = false;
- } else {
- cql.append(" AND ");
- }
-
- cql.append(key);
-
- Object value = options.get(key);
- if (value == null) {
- continue;
- }
- cql.append(" = ");
-
- if (value instanceof Map) {
- optionValueMap((Map) value, cql);
- continue;
- }
-
- // else just use value as string
- cql.append(value.toString());
- }
- return cql;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java
deleted file mode 100644
index ee1402f13..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/ColumnChangeCqlGenerator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import org.springframework.cassandra.core.keyspace.ColumnChangeSpecification;
-import org.springframework.util.Assert;
-
-/**
- * Base class for column change CQL generators.
- *
- * @author Matthew T. Adams
- * @param The corresponding {@link ColumnChangeSpecification} type for this CQL generator.
- */
-public abstract class ColumnChangeCqlGenerator {
-
- public abstract StringBuilder toCql(StringBuilder cql);
-
- private ColumnChangeSpecification specification;
-
- public ColumnChangeCqlGenerator(ColumnChangeSpecification specification) {
- setSpecification(specification);
- }
-
- protected void setSpecification(ColumnChangeSpecification specification) {
- Assert.notNull(specification);
- this.specification = specification;
- }
-
- @SuppressWarnings("unchecked")
- public T getSpecification() {
- return (T) specification;
- }
-
- protected T spec() {
- return getSpecification();
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/CreateTableCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/CreateTableCqlGenerator.java
deleted file mode 100644
index df0369e62..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/CreateTableCqlGenerator.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-import static org.springframework.data.cassandra.mapping.KeyType.PARTITION;
-import static org.springframework.data.cassandra.mapping.KeyType.PRIMARY;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.cassandra.core.keyspace.ColumnSpecification;
-import org.springframework.cassandra.core.keyspace.CreateTableSpecification;
-import org.springframework.cassandra.core.keyspace.Option;
-
-/**
- * CQL generator for generating a CREATE TABLE statement.
- *
- * @author Matthew T. Adams
- */
-public class CreateTableCqlGenerator extends TableCqlGenerator {
-
- public CreateTableCqlGenerator(CreateTableSpecification specification) {
- super(specification);
- }
-
- public StringBuilder toCql(StringBuilder cql) {
-
- cql = noNull(cql);
-
- preambleCql(cql);
- columnsAndOptionsCql(cql);
-
- cql.append(";");
-
- return cql;
- }
-
- protected StringBuilder preambleCql(StringBuilder cql) {
- return noNull(cql).append("CREATE TABLE ").append(spec().getIfNotExists() ? "IF NOT EXISTS " : "")
- .append(spec().getNameAsIdentifier());
- }
-
- @SuppressWarnings("unchecked")
- protected StringBuilder columnsAndOptionsCql(StringBuilder cql) {
-
- cql = noNull(cql);
-
- // begin columns
- cql.append(" (");
-
- List partitionKeys = new ArrayList();
- List primaryKeys = new ArrayList();
- for (ColumnSpecification col : spec().getColumns()) {
- col.toCql(cql).append(", ");
-
- if (col.getKeyType() == PARTITION) {
- partitionKeys.add(col);
- } else if (col.getKeyType() == PRIMARY) {
- primaryKeys.add(col);
- }
- }
-
- // begin primary key clause
- cql.append("PRIMARY KEY ");
- StringBuilder partitions = new StringBuilder();
- StringBuilder primaries = new StringBuilder();
-
- if (partitionKeys.size() > 1) {
- partitions.append("(");
- }
-
- boolean first = true;
- for (ColumnSpecification col : partitionKeys) {
- if (first) {
- first = false;
- } else {
- partitions.append(", ");
- }
- partitions.append(col.getName());
-
- }
- if (partitionKeys.size() > 1) {
- partitions.append(")");
- }
-
- StringBuilder clustering = null;
- boolean clusteringFirst = true;
- first = true;
- for (ColumnSpecification col : primaryKeys) {
- if (first) {
- first = false;
- } else {
- primaries.append(", ");
- }
- primaries.append(col.getName());
-
- if (col.getOrdering() != null) { // then ordering specified
- if (clustering == null) { // then initialize clustering clause
- clustering = new StringBuilder().append("CLUSTERING ORDER BY (");
- }
- if (clusteringFirst) {
- clusteringFirst = false;
- } else {
- clustering.append(", ");
- }
- clustering.append(col.getName()).append(" ").append(col.getOrdering().cql());
- }
- }
- if (clustering != null) { // then end clustering option
- clustering.append(")");
- }
-
- boolean parenthesize = true;// partitionKeys.size() + primaryKeys.size() > 1;
-
- cql.append(parenthesize ? "(" : "");
- cql.append(partitions);
- cql.append(primaryKeys.size() > 0 ? ", " : "");
- cql.append(primaries);
- cql.append(parenthesize ? ")" : "");
- // end primary key clause
-
- cql.append(")");
- // end columns
-
- // begin options
- // begin option clause
- Map options = spec().getOptions();
-
- if (clustering != null || !options.isEmpty()) {
-
- // option preamble
- first = true;
- cql.append(" WITH ");
- // end option preamble
-
- if (clustering != null) {
- cql.append(clustering);
- first = false;
- }
- if (!options.isEmpty()) {
- for (String name : options.keySet()) {
- // append AND if we're not on first option
- if (first) {
- first = false;
- } else {
- cql.append(" AND ");
- }
-
- // append =
- cql.append(name);
-
- Object value = options.get(name);
- if (value == null) { // then assume string-only, valueless option like "COMPACT STORAGE"
- continue;
- }
-
- cql.append(" = ");
-
- if (value instanceof Map) {
- optionValueMap((Map) value, cql);
- continue; // end non-empty value map
- }
-
- // else just use value as string
- cql.append(value.toString());
- }
- }
- }
- // end options
-
- return cql;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/DropColumnCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/DropColumnCqlGenerator.java
deleted file mode 100644
index 1f10f6a30..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/DropColumnCqlGenerator.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-
-import org.springframework.cassandra.core.keyspace.DropColumnSpecification;
-
-/**
- * CQL generator for generating a DROP column clause of an ALTER TABLE statement.
- *
- * @author Matthew T. Adams
- */
-public class DropColumnCqlGenerator extends ColumnChangeCqlGenerator {
-
- public DropColumnCqlGenerator(DropColumnSpecification specification) {
- super(specification);
- }
-
- public StringBuilder toCql(StringBuilder cql) {
- return noNull(cql).append("DROP ").append(spec().getNameAsIdentifier());
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/DropTableCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/DropTableCqlGenerator.java
deleted file mode 100644
index 21049e638..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/DropTableCqlGenerator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-
-import org.springframework.cassandra.core.keyspace.DropTableSpecification;
-
-/**
- * CQL generator for generating a DROP TABLE statement.
- *
- * @author Matthew T. Adams
- */
-public class DropTableCqlGenerator extends TableNameCqlGenerator {
-
- public DropTableCqlGenerator(DropTableSpecification specification) {
- super(specification);
- }
-
- public StringBuilder toCql(StringBuilder cql) {
- return noNull(cql).append("DROP TABLE ").append(spec().getIfExists() ? "IF EXISTS " : "")
- .append(spec().getNameAsIdentifier()).append(";");
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/TableCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/TableCqlGenerator.java
deleted file mode 100644
index 3887f01bc..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/TableCqlGenerator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.escapeSingle;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.singleQuote;
-
-import java.util.Map;
-
-import org.springframework.cassandra.core.keyspace.Option;
-import org.springframework.cassandra.core.keyspace.TableSpecification;
-
-/**
- * Base class that contains behavior common to CQL generation for table operations.
- *
- * @author Matthew T. Adams
- * @param T The subtype of this class for which this is a CQL generator.
- */
-public abstract class TableCqlGenerator> extends
- TableOptionsCqlGenerator> {
-
- public TableCqlGenerator(TableSpecification specification) {
- super(specification);
- }
-
- @SuppressWarnings("unchecked")
- protected T spec() {
- return (T) getSpecification();
- }
-
- protected StringBuilder optionValueMap(Map valueMap, StringBuilder cql) {
- cql = noNull(cql);
-
- if (valueMap == null || valueMap.isEmpty()) {
- return cql;
- }
- // else option value is a non-empty map
-
- // append { 'name' : 'value', ... }
- cql.append("{ ");
- boolean mapFirst = true;
- for (Map.Entry entry : valueMap.entrySet()) {
- if (mapFirst) {
- mapFirst = false;
- } else {
- cql.append(", ");
- }
-
- Option option = entry.getKey();
- cql.append(singleQuote(option.getName())); // entries in map keys are always quoted
- cql.append(" : ");
- Object entryValue = entry.getValue();
- entryValue = entryValue == null ? "" : entryValue.toString();
- if (option.escapesValue()) {
- entryValue = escapeSingle(entryValue);
- }
- if (option.quotesValue()) {
- entryValue = singleQuote(entryValue);
- }
- cql.append(entryValue);
- }
- cql.append(" }");
-
- return cql;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java
deleted file mode 100644
index b36c62b96..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/TableNameCqlGenerator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import org.springframework.cassandra.core.keyspace.TableNameSpecification;
-import org.springframework.util.Assert;
-
-public abstract class TableNameCqlGenerator> {
-
- public abstract StringBuilder toCql(StringBuilder cql);
-
- private TableNameSpecification specification;
-
- public TableNameCqlGenerator(TableNameSpecification specification) {
- setSpecification(specification);
- }
-
- protected void setSpecification(TableNameSpecification specification) {
- Assert.notNull(specification);
- this.specification = specification;
- }
-
- @SuppressWarnings("unchecked")
- public T getSpecification() {
- return (T) specification;
- }
-
- /**
- * Convenient synonymous method of {@link #getSpecification()}.
- */
- protected T spec() {
- return getSpecification();
- }
-
- public String toCql() {
- return toCql(null).toString();
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/cql/generator/TableOptionsCqlGenerator.java b/src/main/java/org/springframework/cassandra/core/cql/generator/TableOptionsCqlGenerator.java
deleted file mode 100644
index 3ddbaa40a..000000000
--- a/src/main/java/org/springframework/cassandra/core/cql/generator/TableOptionsCqlGenerator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.springframework.cassandra.core.cql.generator;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.escapeSingle;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.singleQuote;
-
-import java.util.Map;
-
-import org.springframework.cassandra.core.keyspace.Option;
-import org.springframework.cassandra.core.keyspace.TableOptionsSpecification;
-
-/**
- * Base class that contains behavior common to CQL generation for table operations.
- *
- * @author Matthew T. Adams
- * @param T The subtype of this class for which this is a CQL generator.
- */
-public abstract class TableOptionsCqlGenerator> extends
- TableNameCqlGenerator> {
-
- public TableOptionsCqlGenerator(TableOptionsSpecification specification) {
- super(specification);
- }
-
- @SuppressWarnings("unchecked")
- protected T spec() {
- return (T) getSpecification();
- }
-
- protected StringBuilder optionValueMap(Map valueMap, StringBuilder cql) {
- cql = noNull(cql);
-
- if (valueMap == null || valueMap.isEmpty()) {
- return cql;
- }
- // else option value is a non-empty map
-
- // append { 'name' : 'value', ... }
- cql.append("{ ");
- boolean mapFirst = true;
- for (Map.Entry entry : valueMap.entrySet()) {
- if (mapFirst) {
- mapFirst = false;
- } else {
- cql.append(", ");
- }
-
- Option option = entry.getKey();
- cql.append(singleQuote(option.getName())); // entries in map keys are always quoted
- cql.append(" : ");
- Object entryValue = entry.getValue();
- entryValue = entryValue == null ? "" : entryValue.toString();
- if (option.escapesValue()) {
- entryValue = escapeSingle(entryValue);
- }
- if (option.quotesValue()) {
- entryValue = singleQuote(entryValue);
- }
- cql.append(entryValue);
- }
- cql.append(" }");
-
- return cql;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/AddColumnSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/AddColumnSpecification.java
deleted file mode 100644
index e42adcefd..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/AddColumnSpecification.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import com.datastax.driver.core.DataType;
-
-public class AddColumnSpecification extends ColumnTypeChangeSpecification {
-
- public AddColumnSpecification(String name, DataType type) {
- super(name, type);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/AlterColumnSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/AlterColumnSpecification.java
deleted file mode 100644
index d64fc6406..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/AlterColumnSpecification.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import com.datastax.driver.core.DataType;
-
-public class AlterColumnSpecification extends ColumnTypeChangeSpecification {
-
- public AlterColumnSpecification(String name, DataType type) {
- super(name, type);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/AlterTableSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/AlterTableSpecification.java
deleted file mode 100644
index 7e192133e..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/AlterTableSpecification.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.datastax.driver.core.DataType;
-
-/**
- * Builder class to construct an ALTER TABLE specification.
- *
- * @author Matthew T. Adams
- */
-public class AlterTableSpecification extends TableOptionsSpecification {
-
- /**
- * The list of column changes.
- */
- private List changes = new ArrayList();
-
- /**
- * Adds a DROP to the list of column changes.
- */
- public AlterTableSpecification drop(String column) {
- changes.add(new DropColumnSpecification(column));
- return this;
- }
-
- /**
- * Adds an ADD to the list of column changes.
- */
- public AlterTableSpecification add(String column, DataType type) {
- changes.add(new AddColumnSpecification(column, type));
- return this;
- }
-
- /**
- * Adds an ALTER to the list of column changes.
- */
- public AlterTableSpecification alter(String column, DataType type) {
- changes.add(new AlterColumnSpecification(column, type));
- return this;
- }
-
- /**
- * Returns an unmodifiable list of column changes.
- */
- public List getChanges() {
- return Collections.unmodifiableList(changes);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/ColumnChangeSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/ColumnChangeSpecification.java
deleted file mode 100644
index 6344b888f..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/ColumnChangeSpecification.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.checkIdentifier;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.identifize;
-
-public abstract class ColumnChangeSpecification {
-
- private String name;
-
- public ColumnChangeSpecification(String name) {
- setName(name);
- }
-
- private void setName(String name) {
- checkIdentifier(name);
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public String getNameAsIdentifier() {
- return identifize(name);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java
deleted file mode 100644
index bdbcf0220..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/ColumnSpecification.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.checkIdentifier;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.identifize;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.noNull;
-import static org.springframework.data.cassandra.mapping.KeyType.PARTITION;
-import static org.springframework.data.cassandra.mapping.KeyType.PRIMARY;
-import static org.springframework.data.cassandra.mapping.Ordering.ASCENDING;
-
-import org.springframework.data.cassandra.mapping.KeyType;
-import org.springframework.data.cassandra.mapping.Ordering;
-
-import com.datastax.driver.core.DataType;
-
-/**
- * Builder class to help construct CQL statements that involve column manipulation. Not threadsafe.
- *
- * Use {@link #name(String)} and {@link #type(String)} to set the name and type of the column, respectively. To specify
- * a PRIMARY KEY column, use {@link #primary()} or {@link #primary(Ordering)}. To specify that the
- * PRIMARY KEY column is or is part of the partition key, use {@link #partition()} instead of
- * {@link #primary()} or {@link #primary(Ordering)}.
- *
- * @author Matthew T. Adams
- */
-public class ColumnSpecification {
-
- /**
- * Default ordering of primary key fields; value is {@link Ordering#ASCENDING}.
- */
- public static final Ordering DFAULT_ORDERING = ASCENDING;
-
- private String name;
- private DataType type; // TODO: determining if we should be coupling this to Datastax Java Driver type?
- private KeyType keyType;
- private Ordering ordering;
-
- /**
- * Sets the column's name.
- *
- * @return this
- */
- public ColumnSpecification name(String name) {
- checkIdentifier(name);
- this.name = name;
- return this;
- }
-
- /**
- * Sets the column's type.
- *
- * @return this
- */
- public ColumnSpecification type(DataType type) {
- this.type = type;
- return this;
- }
-
- /**
- * Identifies this column as a primary key column that is also part of a partition key. Sets the column's
- * {@link #keyType} to {@link KeyType#PARTITION} and its {@link #ordering} to null.
- *
- * @return this
- */
- public ColumnSpecification partition() {
- return partition(true);
- }
-
- /**
- * Toggles the identification of this column as a primary key column that also is or is part of a partition key. Sets
- * {@link #ordering} to null and, if the given boolean is true, then sets the column's
- * {@link #keyType} to {@link KeyType#PARTITION}, else sets it to null.
- *
- * @return this
- */
- public ColumnSpecification partition(boolean partition) {
- this.keyType = partition ? PARTITION : null;
- this.ordering = null;
- return this;
- }
-
- /**
- * Identifies this column as a primary key column with default ordering. Sets the column's {@link #keyType} to
- * {@link KeyType#PRIMARY} and its {@link #ordering} to {@link #DFAULT_ORDERING}.
- *
- * @return this
- */
- public ColumnSpecification primary() {
- return primary(DFAULT_ORDERING);
- }
-
- /**
- * Identifies this column as a primary key column with the given ordering. Sets the column's {@link #keyType} to
- * {@link KeyType#PRIMARY} and its {@link #ordering} to the given {@link Ordering}.
- *
- * @return this
- */
- public ColumnSpecification primary(Ordering order) {
- return primary(order, true);
- }
-
- /**
- * Toggles the identification of this column as a primary key column. If the given boolean is true, then
- * sets the column's {@link #keyType} to {@link KeyType#PARTITION} and {@link #ordering} to the given {@link Ordering}
- * , else sets both {@link #keyType} and {@link #ordering} to null.
- *
- * @return this
- */
- public ColumnSpecification primary(Ordering order, boolean primary) {
- this.keyType = primary ? PRIMARY : null;
- this.ordering = primary ? order : null;
- return this;
- }
-
- /**
- * Sets the column's {@link #keyType}.
- *
- * @return this
- */
- /* package */ColumnSpecification keyType(KeyType keyType) {
- this.keyType = keyType;
- return this;
- }
-
- /**
- * Sets the column's {@link #ordering}.
- *
- * @return this
- */
- /* package */ColumnSpecification ordering(Ordering ordering) {
- this.ordering = ordering;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public String getNameAsIdentifier() {
- return identifize(name);
- }
-
- public DataType getType() {
- return type;
- }
-
- public KeyType getKeyType() {
- return keyType;
- }
-
- public Ordering getOrdering() {
- return ordering;
- }
-
- public String toCql() {
- return toCql(null).toString();
- }
-
- public StringBuilder toCql(StringBuilder cql) {
- return (cql = noNull(cql)).append(name).append(" ").append(type);
- }
-
- @Override
- public String toString() {
- return toCql(null).append(" /* keyType=").append(keyType).append(", ordering=").append(ordering).append(" */ ")
- .toString();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/ColumnTypeChangeSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/ColumnTypeChangeSpecification.java
deleted file mode 100644
index 3f1a4d4f9..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/ColumnTypeChangeSpecification.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import org.springframework.util.Assert;
-
-import com.datastax.driver.core.DataType;
-
-public abstract class ColumnTypeChangeSpecification extends ColumnChangeSpecification {
-
- private DataType type;
-
- public ColumnTypeChangeSpecification(String name, DataType type) {
- super(name);
- setType(type);
- }
-
- private void setType(DataType type) {
- Assert.notNull(type);
- this.type = type;
- }
-
- public DataType getType() {
- return type;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/CreateTableSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/CreateTableSpecification.java
deleted file mode 100644
index 28981ede9..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/CreateTableSpecification.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-/**
- * Builder class to construct a CREATE TABLE specification.
- *
- * @author Matthew T. Adams
- */
-public class CreateTableSpecification extends TableSpecification {
-
- private boolean ifNotExists = false;
-
- /**
- * Causes the inclusion of an IF NOT EXISTS clause.
- *
- * @return this
- */
- public CreateTableSpecification ifNotExists() {
- return ifNotExists(true);
- }
-
- /**
- * Toggles the inclusion of an IF NOT EXISTS clause.
- *
- * @return this
- */
- public CreateTableSpecification ifNotExists(boolean ifNotExists) {
- this.ifNotExists = ifNotExists;
- return this;
- }
-
- public boolean getIfNotExists() {
- return ifNotExists;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/DefaultOption.java b/src/main/java/org/springframework/cassandra/core/keyspace/DefaultOption.java
deleted file mode 100644
index 093409870..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/DefaultOption.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.escapeSingle;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.singleQuote;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.Map;
-
-import org.springframework.util.Assert;
-
-/**
- * A default implementation of {@link Option}.
- *
- * @author Matthew T. Adams
- */
-public class DefaultOption implements Option {
-
- private String name;
- private Class> type;
- private boolean requiresValue;
- private boolean escapesValue;
- private boolean quotesValue;
-
- public DefaultOption(String name, Class> type, boolean requiresValue, boolean escapesValue, boolean quotesValue) {
- setName(name);
- setType(type);
- this.requiresValue = requiresValue;
- this.escapesValue = escapesValue;
- this.quotesValue = quotesValue;
-
- }
-
- protected void setName(String name) {
- Assert.hasLength(name);
- this.name = name;
- }
-
- protected void setType(Class> type) {
- if (type != null) {
- if (type.isInterface() && !(Map.class.isAssignableFrom(type) || Collection.class.isAssignableFrom(type))) {
- throw new IllegalArgumentException("given type [" + type.getName() + "] must be a class, Map or Collection");
- }
- }
- this.type = type;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public boolean isCoerceable(Object value) {
- if (value == null || type == null) {
- return true;
- }
-
- // check map
- if (Map.class.isAssignableFrom(type)) {
- return Map.class.isAssignableFrom(value.getClass());
- }
- // check collection
- if (Collection.class.isAssignableFrom(type)) {
- return Collection.class.isAssignableFrom(value.getClass());
- }
- // check enum
- if (type.isEnum()) {
- try {
- String name = value instanceof Enum ? name = ((Enum) value).name() : value.toString();
- Enum.valueOf((Class extends Enum>) type, name);
- return true;
- } catch (NullPointerException x) {
- return false;
- } catch (IllegalArgumentException x) {
- return false;
- }
- }
-
- // check class via String constructor
- try {
- Constructor> ctor = type.getConstructor(String.class);
- if (!ctor.isAccessible()) {
- ctor.setAccessible(true);
- }
- ctor.newInstance(value.toString());
- return true;
- } catch (InstantiationException e) {
- } catch (IllegalAccessException e) {
- } catch (IllegalArgumentException e) {
- } catch (InvocationTargetException e) {
- } catch (NoSuchMethodException e) {
- } catch (SecurityException e) {
- }
- return false;
- }
-
- public Class> getType() {
- return type;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean takesValue() {
- return type != null;
- }
-
- public boolean requiresValue() {
- return this.requiresValue;
- }
-
- public boolean escapesValue() {
- return this.escapesValue;
- }
-
- public boolean quotesValue() {
- return this.quotesValue;
- }
-
- public void checkValue(Object value) {
- if (takesValue()) {
- if (value == null) {
- if (requiresValue) {
- throw new IllegalArgumentException("Option [" + getName() + "] requires a value");
- }
- return; // doesn't require a value, so null is ok
- }
- // else value is not null
- if (isCoerceable(value)) {
- return;
- }
- // else value is not coerceable into the expected type
- throw new IllegalArgumentException("Option [" + getName() + "] takes value coerceable to type ["
- + getType().getName() + "]");
- }
- // else this option doesn't take a value
- if (value != null) {
- throw new IllegalArgumentException("Option [" + getName() + "] takes no value");
- }
- }
-
- public String toString(Object value) {
- if (value == null) {
- return null;
- }
- checkValue(value);
-
- String string = value.toString();
- string = escapesValue ? escapeSingle(string) : string;
- string = quotesValue ? singleQuote(string) : string;
- return string;
- }
-
- @Override
- public String toString() {
- return "[name=" + name + ", type=" + type.getName() + ", requiresValue=" + requiresValue + ", escapesValue="
- + escapesValue + ", quotesValue=" + quotesValue + "]";
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/DefaultTableDescriptor.java b/src/main/java/org/springframework/cassandra/core/keyspace/DefaultTableDescriptor.java
deleted file mode 100644
index 0e7c24638..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/DefaultTableDescriptor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-/**
- * Convenient default implementation of {@link TableDescriptor} as an extension of {@link TableSpecification} that
- * doesn't require the use of generics.
- *
- * @author Matthew T. Adams
- */
-public class DefaultTableDescriptor extends TableSpecification {
-
- /**
- * Factory method to produce a new {@link DefaultTableDescriptor}. Convenient if imported statically.
- */
- public static DefaultTableDescriptor table() {
- return new DefaultTableDescriptor();
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/DropColumnSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/DropColumnSpecification.java
deleted file mode 100644
index d485b852c..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/DropColumnSpecification.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-public class DropColumnSpecification extends ColumnChangeSpecification {
-
- public DropColumnSpecification(String name) {
- super(name);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/DropTableSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/DropTableSpecification.java
deleted file mode 100644
index a3e66b274..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/DropTableSpecification.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-/**
- * Builder class that supports the construction of DROP TABLE specifications.
- *
- * @author Matthew T. Adams
- */
-public class DropTableSpecification extends TableNameSpecification {
-
- private boolean ifExists;
-
- public DropTableSpecification ifExists() {
- return ifExists(true);
- }
-
- public DropTableSpecification ifExists(boolean ifExists) {
- this.ifExists = ifExists;
- return this;
- }
-
- public boolean getIfExists() {
- return ifExists;
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/Option.java b/src/main/java/org/springframework/cassandra/core/keyspace/Option.java
deleted file mode 100644
index 055512414..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/Option.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-/**
- * Interface to represent option types.
- *
- * @author Matthew T. Adams
- */
-public interface Option {
-
- /**
- * The type that values must be able to be coerced into for this option.
- */
- Class> getType();
-
- /**
- * The (usually lower-cased, underscore-separated) name of this table option.
- */
- String getName();
-
- /**
- * Whether this option takes a value.
- */
- boolean takesValue();
-
- /**
- * Whether this option should escape single quotes in its value.
- */
- boolean escapesValue();
-
- /**
- * Whether this option's value should be single-quoted.
- */
- boolean quotesValue();
-
- /**
- * Whether this option requires a value.
- */
- boolean requiresValue();
-
- /**
- * Checks that the given value can be coerced into the type given by {@link #getType()}.
- */
- void checkValue(Object value);
-
- /**
- * Tests whether the given value can be coerced into the type given by {@link #getType()}.
- */
- boolean isCoerceable(Object value);
-
- /**
- * First ensures that the given value is coerceable into the type expected by this option, then returns the result of
- * {@link Object#toString()} called on the given value. If this option is escaping quotes ({@link #escapesValue()} is
- * true), then single quotes will be escaped, and if this option is quoting values (
- * {@link #quotesValue()} is true), then the value will be surrounded by single quotes. Given
- * null, returns null.
- *
- * @see #escapesValue()
- * @see #quotesValue()
- */
- String toString(Object value);
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/TableDescriptor.java b/src/main/java/org/springframework/cassandra/core/keyspace/TableDescriptor.java
deleted file mode 100644
index 2a17486a0..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/TableDescriptor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Describes a table.
- *
- * @author Matthew T. Adams
- */
-public interface TableDescriptor {
-
- /**
- * Returns the name of the table.
- */
- String getName();
-
- /**
- * Returns the name of the table as an identifer or quoted identifier as appropriate.
- */
- String getNameAsIdentifier();
-
- /**
- * Returns an unmodifiable {@link List} of {@link ColumnSpecification}s.
- */
- List getColumns();
-
- /**
- * Returns an unmodifiable list of all partition key columns.
- */
- public List getPartitionKeyColumns();
-
- /**
- * Returns an unmodifiable list of all primary key columns that are not also partition key columns.
- */
- public List getPrimaryKeyColumns();
-
- /**
- * Returns an unmodifiable list of all partition and primary key columns.
- */
- public List getKeyColumns();
-
- /**
- * Returns an unmodifiable list of all non-key columns.
- */
- public List getNonKeyColumns();
-
- /**
- * Returns an unmodifiable {@link Map} of table options.
- */
- Map getOptions();
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/TableNameSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/TableNameSpecification.java
deleted file mode 100644
index 2cf3b993e..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/TableNameSpecification.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.checkIdentifier;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.identifize;
-
-/**
- * Abstract builder class to support the construction of table specifications.
- *
- * @author Matthew T. Adams
- * @param The subtype of the {@link TableNameSpecification}
- */
-public abstract class TableNameSpecification> {
-
- /**
- * The name of the table.
- */
- private String name;
-
- /**
- * Sets the table name.
- *
- * @return this
- */
- @SuppressWarnings("unchecked")
- public T name(String name) {
- checkIdentifier(name);
- this.name = name;
- return (T) this;
- }
-
- public String getName() {
- return name;
- }
-
- public String getNameAsIdentifier() {
- return identifize(name);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/TableOperations.java b/src/main/java/org/springframework/cassandra/core/keyspace/TableOperations.java
deleted file mode 100644
index 0f85aa421..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/TableOperations.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-/**
- * Class that offers static methods as entry points into the fluent API for building create, drop and alter table
- * specifications. These methods are most convenient when imported statically.
- *
- * @author Matthew T. Adams
- */
-public class TableOperations {
-
- /**
- * Entry point into the {@link CreateTableSpecification}'s fluent API to create a table. Convenient if imported
- * statically.
- */
- public static CreateTableSpecification createTable() {
- return new CreateTableSpecification();
- }
-
- /**
- * Entry point into the {@link DropTableSpecification}'s fluent API to drop a table. Convenient if imported
- * statically.
- */
- public static DropTableSpecification dropTable() {
- return new DropTableSpecification();
- }
-
- /**
- * Entry point into the {@link AlterTableSpecification}'s fluent API to alter a table. Convenient if imported
- * statically.
- */
- public static AlterTableSpecification alterTable() {
- return new AlterTableSpecification();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/TableOption.java b/src/main/java/org/springframework/cassandra/core/keyspace/TableOption.java
deleted file mode 100644
index 7f6d56fca..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/TableOption.java
+++ /dev/null
@@ -1,287 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import java.util.Map;
-
-/**
- * Enumeration that represents all known table options. If a table option is not listed here, but is supported by
- * Cassandra, use the method {@link CreateTableSpecification#with(String, Object, boolean, boolean)} to write the raw
- * value.
- *
- * Implements {@link Option} via delegation, since {@link Enum}s can't extend anything.
- *
- * @author Matthew T. Adams
- * @see CompactionOption
- * @see CompressionOption
- * @see CachingOption
- */
-public enum TableOption implements Option {
- /**
- * comment
- */
- COMMENT("comment", String.class, true, true, true),
- /**
- * COMPACT STORAGE
- */
- COMPACT_STORAGE("COMPACT STORAGE", null, false, false, false),
- /**
- * compaction. Value is a Map<CompactionOption,Object>.
- *
- * @see CompactionOption
- */
- COMPACTION("compaction", Map.class, true, false, false),
- /**
- * compression. Value is a Map<CompressionOption,Object>.
- *
- * @see {@link CompressionOption}
- */
- COMPRESSION("compression", Map.class, true, false, false),
- /**
- * replicate_on_write
- */
- REPLICATE_ON_WRITE("replicate_on_write", Boolean.class, true, false, false),
- /**
- * caching
- *
- * @see CachingOption
- */
- CACHING("caching", CachingOption.class, true, false, false),
- /**
- * bloom_filter_fp_chance
- */
- BLOOM_FILTER_FP_CHANCE("bloom_filter_fp_chance", Double.class, true, false, false),
- /**
- * read_repair_chance
- */
- READ_REPAIR_CHANCE("read_repair_chance", Double.class, true, false, false),
- /**
- * dclocal_read_repair_chance
- */
- DCLOCAL_READ_REPAIR_CHANCE("dclocal_read_repair_chance", Double.class, true, false, false),
- /**
- * gc_grace_seconds
- */
- GC_GRACE_SECONDS("gc_grace_seconds", Long.class, true, false, false);
-
- private Option delegate;
-
- private TableOption(String name, Class> type, boolean requiresValue, boolean escapesValue, boolean quotesValue) {
- this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
- }
-
- public Class> getType() {
- return delegate.getType();
- }
-
- public boolean takesValue() {
- return delegate.takesValue();
- }
-
- public String getName() {
- return delegate.getName();
- }
-
- public boolean escapesValue() {
- return delegate.escapesValue();
- }
-
- public boolean quotesValue() {
- return delegate.quotesValue();
- }
-
- public boolean requiresValue() {
- return delegate.requiresValue();
- }
-
- public void checkValue(Object value) {
- delegate.checkValue(value);
- }
-
- public boolean isCoerceable(Object value) {
- return delegate.isCoerceable(value);
- }
-
- public String toString() {
- return delegate.toString();
- }
-
- public String toString(Object value) {
- return delegate.toString(value);
- }
-
- /**
- * Known caching options.
- *
- * @author Matthew T. Adams
- */
- public enum CachingOption {
- ALL("all"), KEYS_ONLY("keys_only"), ROWS_ONLY("rows_only"), NONE("none");
-
- private String value;
-
- private CachingOption(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- public String toString() {
- return getValue();
- }
- }
-
- /**
- * Known compaction options.
- *
- * @author Matthew T. Adams
- */
- public enum CompactionOption implements Option {
- /**
- * tombstone_threshold
- */
- TOMBSTONE_THRESHOLD("tombstone_threshold", Double.class, true, false, false),
- /**
- * tombstone_compaction_interval
- */
- TOMBSTONE_COMPACTION_INTERVAL("tombstone_compaction_interval", Double.class, true, false, false),
- /**
- * min_sstable_size
- */
- MIN_SSTABLE_SIZE("min_sstable_size", Long.class, true, false, false),
- /**
- * min_threshold
- */
- MIN_THRESHOLD("min_threshold", Long.class, true, false, false),
- /**
- * max_threshold
- */
- MAX_THRESHOLD("max_threshold", Long.class, true, false, false),
- /**
- * bucket_low
- */
- BUCKET_LOW("bucket_low", Double.class, true, false, false),
- /**
- * bucket_high
- */
- BUCKET_HIGH("bucket_high", Double.class, true, false, false),
- /**
- * sstable_size_in_mb
- */
- SSTABLE_SIZE_IN_MB("sstable_size_in_mb", Long.class, true, false, false);
-
- private Option delegate;
-
- private CompactionOption(String name, Class> type, boolean requiresValue, boolean escapesValue,
- boolean quotesValue) {
- this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
- }
-
- public Class> getType() {
- return delegate.getType();
- }
-
- public boolean takesValue() {
- return delegate.takesValue();
- }
-
- public String getName() {
- return delegate.getName();
- }
-
- public boolean escapesValue() {
- return delegate.escapesValue();
- }
-
- public boolean quotesValue() {
- return delegate.quotesValue();
- }
-
- public boolean requiresValue() {
- return delegate.requiresValue();
- }
-
- public void checkValue(Object value) {
- delegate.checkValue(value);
- }
-
- public boolean isCoerceable(Object value) {
- return delegate.isCoerceable(value);
- }
-
- public String toString() {
- return delegate.toString();
- }
-
- public String toString(Object value) {
- return delegate.toString(value);
- }
- }
-
- /**
- * Known compression options.
- *
- * @author Matthew T. Adams
- */
- public enum CompressionOption implements Option {
- /**
- * sstable_compression
- */
- STABLE_COMPRESSION("sstable_compression", String.class, true, false, false),
- /**
- * chunk_length_kb
- */
- CHUNK_LENGTH_KB("chunk_length_kb", Long.class, true, false, false),
- /**
- * crc_check_chance
- */
- CRC_CHECK_CHANCE("crc_check_chance", Double.class, true, false, false);
-
- private Option delegate;
-
- private CompressionOption(String name, Class> type, boolean requiresValue, boolean escapesValue,
- boolean quotesValue) {
- this.delegate = new DefaultOption(name, type, requiresValue, escapesValue, quotesValue);
- }
-
- public Class> getType() {
- return delegate.getType();
- }
-
- public boolean takesValue() {
- return delegate.takesValue();
- }
-
- public String getName() {
- return delegate.getName();
- }
-
- public boolean escapesValue() {
- return delegate.escapesValue();
- }
-
- public boolean quotesValue() {
- return delegate.quotesValue();
- }
-
- public boolean requiresValue() {
- return delegate.requiresValue();
- }
-
- public void checkValue(Object value) {
- delegate.checkValue(value);
- }
-
- public boolean isCoerceable(Object value) {
- return delegate.isCoerceable(value);
- }
-
- public String toString() {
- return delegate.toString();
- }
-
- public String toString(Object value) {
- return delegate.toString(value);
- }
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/TableOptionsSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/TableOptionsSpecification.java
deleted file mode 100644
index de6c8d9d2..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/TableOptionsSpecification.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import static org.springframework.cassandra.core.cql.CqlStringUtils.escapeSingle;
-import static org.springframework.cassandra.core.cql.CqlStringUtils.singleQuote;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.springframework.cassandra.core.cql.CqlStringUtils;
-
-/**
- * Abstract builder class to support the construction of table specifications that have table options, that is, those
- * options normally specified by WITH ... AND ....
- *
- * It is important to note that although this class depends on {@link TableOption} for convenient and typesafe use, it
- * ultimately stores its options in a Map for flexibility. This means that
- * {@link #with(TableOption)} and {@link #with(TableOption, Object)} delegate to
- * {@link #with(String, Object, boolean, boolean)}. This design allows the API to support new Cassandra options as they
- * are introduced without having to update the code immediately.
- *
- * @author Matthew T. Adams
- * @param The subtype of the {@link TableOptionsSpecification}.
- */
-public abstract class TableOptionsSpecification> extends
- TableNameSpecification> {
-
- protected Map options = new LinkedHashMap();
-
- @SuppressWarnings("unchecked")
- public T name(String name) {
- return (T) super.name(name);
- }
-
- /**
- * Convenience method that calls with(option, null).
- *
- * @return this
- */
- public T with(TableOption option) {
- return with(option, null);
- }
-
- /**
- * Sets the given table option. This is a convenience method that calls
- * {@link #with(String, Object, boolean, boolean)} appropriately from the given {@link TableOption} and value for that
- * option.
- *
- * @param option The option to set.
- * @param value The value of the option. Must be type-compatible with the {@link TableOption}.
- * @return this
- * @see #with(String, Object, boolean, boolean)
- */
- public T with(TableOption option, Object value) {
- option.checkValue(value);
- return (T) with(option.getName(), value, option.escapesValue(), option.quotesValue());
- }
-
- /**
- * Adds the given option by name to this table's options.
- *
- * Options that have null values are considered single string options where the name of the option is the
- * string to be used. Otherwise, the result of {@link Object#toString()} is considered to be the value of the option
- * with the given name. The value, after conversion to string, may have embedded single quotes escaped according to
- * parameter escape and may be single-quoted according to parameter quote.
- *
- * @param name The name of the option
- * @param value The value of the option. If null, the value is ignored and the option is considered to be
- * composed of only the name, otherwise the value's {@link Object#toString()} value is used.
- * @param escape Whether to escape the value via {@link CqlStringUtils#escapeSingle(Object)}. Ignored if given value
- * is an instance of a {@link Map}.
- * @param quote Whether to quote the value via {@link CqlStringUtils#singleQuote(Object)}. Ignored if given value is
- * an instance of a {@link Map}.
- * @return this
- */
- @SuppressWarnings("unchecked")
- public T with(String name, Object value, boolean escape, boolean quote) {
- if (!(value instanceof Map)) {
- if (escape) {
- value = escapeSingle(value);
- }
- if (quote) {
- value = singleQuote(value);
- }
- }
- options.put(name, value);
- return (T) this;
- }
-
- public Map getOptions() {
- return Collections.unmodifiableMap(options);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/keyspace/TableSpecification.java b/src/main/java/org/springframework/cassandra/core/keyspace/TableSpecification.java
deleted file mode 100644
index ba8c70c63..000000000
--- a/src/main/java/org/springframework/cassandra/core/keyspace/TableSpecification.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package org.springframework.cassandra.core.keyspace;
-
-import static org.springframework.data.cassandra.mapping.KeyType.PARTITION;
-import static org.springframework.data.cassandra.mapping.KeyType.PRIMARY;
-import static org.springframework.data.cassandra.mapping.Ordering.ASCENDING;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.springframework.data.cassandra.mapping.KeyType;
-import org.springframework.data.cassandra.mapping.Ordering;
-
-import com.datastax.driver.core.DataType;
-
-/**
- * Builder class to support the construction of table specifications that have columns. This class can also be used as a
- * standalone {@link TableDescriptor}, independent of {@link CreateTableSpecification}.
- *
- * @author Matthew T. Adams
- */
-public class TableSpecification extends TableOptionsSpecification> implements TableDescriptor {
-
- /**
- * List of all columns.
- */
- private List columns = new ArrayList();
-
- /**
- * List of only those columns that comprise the partition key.
- */
- private List partitionKeyColumns = new ArrayList();
-
- /**
- * List of only those columns that comprise the primary key that are not also part of the partition key.
- */
- private List primaryKeyColumns = new ArrayList();
-
- /**
- * List of only those columns that are not partition or primary key columns.
- */
- private List nonKeyColumns = new ArrayList();
-
- /**
- * Adds the given non-key column to the table. Must be specified after all primary key columns.
- *
- * @param name The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes.
- * @param type The data type of the column.
- */
- public T column(String name, DataType type) {
- return column(name, type, null, null);
- }
-
- /**
- * Adds the given partition key column to the table. Must be specified before any other columns.
- *
- * @param name The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes.
- * @param type The data type of the column.
- * @return this
- */
- public T partitionKeyColumn(String name, DataType type) {
- return column(name, type, PARTITION, null);
- }
-
- /**
- * Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key
- * columns and before any non-key columns.
- *
- * @param name The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes.
- * @param type The data type of the column.
- * @return this
- */
- public T primaryKeyColumn(String name, DataType type) {
- return primaryKeyColumn(name, type, ASCENDING);
- }
-
- /**
- * Adds the given primary key column to the table with the given ordering (null meaning ascending). Must
- * be specified after all partition key columns and before any non-key columns.
- *
- * @param name The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes.
- * @param type The data type of the column.
- * @return this
- */
- public T primaryKeyColumn(String name, DataType type, Ordering ordering) {
- return column(name, type, PRIMARY, ordering);
- }
-
- /**
- * Adds the given info as a new column to the table. Partition key columns must precede primary key columns, which
- * must precede non-key columns.
- *
- * @param name The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes.
- * @param type The data type of the column.
- * @param keyType Indicates key type. Null means that the column is not a key column.
- * @param ordering If the given {@link KeyType} is {@link KeyType#PRIMARY}, then the given ordering is used, else
- * ignored.
- * @return this
- */
- @SuppressWarnings("unchecked")
- protected T column(String name, DataType type, KeyType keyType, Ordering ordering) {
-
- ColumnSpecification column = new ColumnSpecification().name(name).type(type).keyType(keyType)
- .ordering(keyType == PRIMARY ? ordering : null);
-
- columns.add(column);
-
- if (keyType == KeyType.PARTITION) {
- partitionKeyColumns.add(column);
- }
-
- if (keyType == KeyType.PRIMARY) {
- primaryKeyColumns.add(column);
- }
-
- if (keyType == null) {
- nonKeyColumns.add(column);
- }
-
- return (T) this;
- }
-
- /**
- * Returns an unmodifiable list of all columns.
- */
- public List getColumns() {
- return Collections.unmodifiableList(columns);
- }
-
- /**
- * Returns an unmodifiable list of all partition key columns.
- */
- public List getPartitionKeyColumns() {
- return Collections.unmodifiableList(partitionKeyColumns);
- }
-
- /**
- * Returns an unmodifiable list of all primary key columns that are not also partition key columns.
- */
- public List getPrimaryKeyColumns() {
- return Collections.unmodifiableList(primaryKeyColumns);
- }
-
- /**
- * Returns an unmodifiable list of all primary key columns that are not also partition key columns.
- */
- public List getKeyColumns() {
-
- ArrayList keyColumns = new ArrayList();
- keyColumns.addAll(partitionKeyColumns);
- keyColumns.addAll(primaryKeyColumns);
-
- return Collections.unmodifiableList(keyColumns);
- }
-
- /**
- * Returns an unmodifiable list of all non-key columns.
- */
- public List getNonKeyColumns() {
- return Collections.unmodifiableList(nonKeyColumns);
- }
-}
diff --git a/src/main/java/org/springframework/cassandra/core/util/MapBuilder.java b/src/main/java/org/springframework/cassandra/core/util/MapBuilder.java
deleted file mode 100644
index 7b50dd549..000000000
--- a/src/main/java/org/springframework/cassandra/core/util/MapBuilder.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.springframework.cassandra.core.util;
-
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Builder for maps, which also conveniently implements {@link Map} via delegation for convenience so you don't have to
- * actually {@link #build()} it (or forget to).
- *
- * @author Matthew T. Adams
- * @param