@@ -35,11 +35,11 @@ import com.datastax.oss.driver.api.core.metadata.Node;
|
||||
* A session holds connections to a Cassandra cluster, allowing it to be queried. {@link ReactiveSession} executes
|
||||
* queries and prepares statements in a reactive style returning results wrapped in {@link Mono} and
|
||||
* {@link reactor.core.publisher.Flux}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Each session maintains multiple connections to the cluster nodes, provides policies to choose which node to use for
|
||||
* each query (round-robin on all nodes of the cluster by default), and handles retries for failed queries (when it
|
||||
* makes sense).
|
||||
* <p/>
|
||||
* <p>
|
||||
* Session instances are thread-safe and usually a single instance is enough per application. As a given session can
|
||||
* only be "logged" into one keyspace at a time (where the "logged" keyspace is the one used by queries that don't
|
||||
* explicitly use a fully qualified table name), it can make sense to create one session per keyspace used. This is
|
||||
@@ -56,11 +56,11 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Returns a snapshot of the Cassandra cluster's topology and schema metadata.
|
||||
* <p/>
|
||||
* <p>
|
||||
* In order to provide atomic updates, this method returns an immutable object: the node list, token map, and schema
|
||||
* contained in a given instance will always be consistent with each other (but note that {@link Node} itself is not
|
||||
* immutable: some of its properties will be updated dynamically, in particular {@link Node#getState()}).
|
||||
* <p/>
|
||||
* <p>
|
||||
* As a consequence of the above, you should call this method each time you need a fresh view of the metadata. <b>Do
|
||||
* not</b> call it once and store the result, because it is a frozen snapshot that will become stale over time.
|
||||
* <p>
|
||||
@@ -76,7 +76,7 @@ public interface ReactiveSession extends Closeable {
|
||||
/**
|
||||
* The keyspace that this session is currently connected to, or {@link Optional#empty()} if this session is not
|
||||
* connected to any keyspace.
|
||||
* <p/>
|
||||
* <p>
|
||||
* There are two ways that this can be set: before initializing the session (either with the {@code session-keyspace}
|
||||
* option in the configuration, or with {@link CqlSessionBuilder#withKeyspace(CqlIdentifier)}); or at runtime, if the
|
||||
* client issues a request that changes the keyspace (such as a CQL {@code USE} query). Note that this second method
|
||||
@@ -90,7 +90,7 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Whether this Session instance has been closed.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Note that this method returns true as soon as the closing of this Session has started but it does not guarantee
|
||||
* that the closing is done. If you want to guarantee that the closing is done, you can call {@code close()} and wait
|
||||
* until it returns (or call the get method on {@code closeAsync()} with a very short timeout and check this doesn't
|
||||
@@ -109,7 +109,7 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Executes the provided query.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This is a convenience method for {@code execute(new SimpleStatement(query))}.
|
||||
*
|
||||
* @param query the CQL query to execute.
|
||||
@@ -120,7 +120,7 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Executes the provided query using the provided values.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This is a convenience method for {@code execute(new SimpleStatement(query, values))}.
|
||||
*
|
||||
* @param query the CQL query to execute.
|
||||
@@ -133,7 +133,7 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Executes the provided query using the provided named values.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This is a convenience method for {@code execute(new SimpleStatement(query, values))}.
|
||||
*
|
||||
* @param query the CQL query to execute.
|
||||
@@ -146,7 +146,7 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Executes the provided query.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This method blocks until at least some result has been received from the database. However, for SELECT queries, it
|
||||
* does not guarantee that the result has been received in full. But it does guarantee that some response has been
|
||||
* received from the database, and in particular guarantees that if the request is invalid, an exception will be
|
||||
@@ -168,7 +168,7 @@ public interface ReactiveSession extends Closeable {
|
||||
|
||||
/**
|
||||
* Prepares the provided query.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This method behaves like {@link #prepare(String)}, but note that the resulting {@code PreparedStatement} will
|
||||
* inherit the query properties set on {@code statement}. Concretely, this means that in the following code:
|
||||
*
|
||||
@@ -180,7 +180,7 @@ public interface ReactiveSession extends Closeable {
|
||||
* </pre>
|
||||
*
|
||||
* the final execution will be performed with Quorum consistency.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Please note that if the same CQL statement is prepared more than once, all calls to this method will return the
|
||||
* same {@code PreparedStatement} object but the method will still apply the properties of the prepared
|
||||
* {@code Statement} to this object.
|
||||
|
||||
@@ -34,7 +34,8 @@ import reactor.core.publisher.Mono;
|
||||
public interface ReactiveSessionFactory {
|
||||
|
||||
/**
|
||||
* Return a {@link ReactiveSession} to be used directly or inside a callback inside {@link ReactiveCqlTemplate}.
|
||||
* Return a {@link ReactiveSession} to be used directly or inside a callback inside
|
||||
* {@link org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate}.
|
||||
*
|
||||
* @return a {@link ReactiveSession}.
|
||||
*/
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
|
||||
package org.springframework.data.cassandra.config;
|
||||
|
||||
|
||||
import org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator;
|
||||
import org.springframework.data.cassandra.core.cql.CqlTemplate;
|
||||
|
||||
/**
|
||||
* Factory for creating and configuring a Cassandra {@link com.datastax.oss.driver.api.core.CqlSession}, which is a
|
||||
* thread-safe singleton. As such, it is sufficient to have one {@link CqlSession} per application and keyspace.
|
||||
* thread-safe singleton. As such, it is sufficient to have one {@link com.datastax.oss.driver.api.core.CqlSession} per
|
||||
* application and keyspace.
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
|
||||
@@ -143,7 +143,7 @@ abstract class ParsingUtils {
|
||||
/**
|
||||
* Adds the named property and value, or reference to the given {@link BeanDefinitionBuilder} with an optional default
|
||||
* value if the value has not been specified.
|
||||
* <p/>
|
||||
* <p>
|
||||
* If {@code required} is <code>false</code>, <code>value</code> is null or empty, and {@code defaultValue} is null or
|
||||
* empty, then no property is added to the bean definition and this method silently returns.
|
||||
*
|
||||
|
||||
@@ -135,7 +135,7 @@ public class AsyncCassandraTemplate
|
||||
*
|
||||
* @param session {@link CqlSession} used to interact with Cassandra; must not be {@literal null}.
|
||||
* @see CassandraConverter
|
||||
* @see Session
|
||||
* @see CqlSession
|
||||
*/
|
||||
public AsyncCassandraTemplate(CqlSession session) {
|
||||
this(session, newConverter(session));
|
||||
|
||||
@@ -72,7 +72,7 @@ class CassandraBatchTemplate implements CassandraBatchOperations {
|
||||
|
||||
/**
|
||||
* Return a reference to the configured {@link CassandraConverter} used to map {@link Object Objects} to
|
||||
* {@link com.datastax.driver.core.Row Rows}.
|
||||
* {@link com.datastax.oss.driver.api.core.cql.Row Rows}.
|
||||
*
|
||||
* @return a reference to the configured {@link CassandraConverter}.
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
|
||||
@@ -98,7 +98,7 @@ public interface CassandraOperations extends FluentCassandraOperations {
|
||||
/**
|
||||
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterator} of entities.
|
||||
* <p>
|
||||
* Returns a {@link Iterator} that wraps the Cassandra {@link com.datastax.driver.core.ResultSet}.
|
||||
* Returns a {@link Iterator} that wraps the Cassandra {@link ResultSet}.
|
||||
*
|
||||
* @param <T> element return type.
|
||||
* @param cql query to execute. Must not be empty or {@literal null}.
|
||||
@@ -160,7 +160,7 @@ public interface CassandraOperations extends FluentCassandraOperations {
|
||||
/**
|
||||
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterator} of entities.
|
||||
* <p>
|
||||
* Returns a {@link Iterator} that wraps the Cassandra {@link com.datastax.driver.core.ResultSet}.
|
||||
* Returns a {@link Iterator} that wraps the Cassandra {@link ResultSet}.
|
||||
*
|
||||
* @param <T> element return type.
|
||||
* @param statement query to execute. Must not be empty or {@literal null}.
|
||||
@@ -212,7 +212,7 @@ public interface CassandraOperations extends FluentCassandraOperations {
|
||||
/**
|
||||
* Execute a {@code SELECT} query and convert the resulting items to a {@link Iterator} of entities.
|
||||
* <p>
|
||||
* Returns a {@link Iterator} that wraps the Cassandra {@link com.datastax.driver.core.ResultSet}.
|
||||
* Returns a {@link Iterator} that wraps the Cassandra {@link ResultSet}.
|
||||
*
|
||||
* @param <T> element return type.
|
||||
* @param query query to execute. Must not be empty or {@literal null}.
|
||||
|
||||
@@ -61,7 +61,6 @@ public class CassandraPersistentEntitySchemaCreator {
|
||||
* Create a new {@link CassandraPersistentEntitySchemaCreator} for the given {@link CassandraMappingContext} and
|
||||
* {@link CassandraAdminOperations}.
|
||||
*
|
||||
* @param mappingContext must not be {@literal null}.
|
||||
* @param cassandraAdminOperations must not be {@literal null}.
|
||||
* @since 3.0
|
||||
*/
|
||||
|
||||
@@ -138,7 +138,7 @@ public class CassandraTemplate implements CassandraOperations, ApplicationEventP
|
||||
*
|
||||
* @param session {@link CqlSession} used to interact with Cassandra; must not be {@literal null}.
|
||||
* @see CassandraConverter
|
||||
* @see Session
|
||||
* @see CqlSession
|
||||
*/
|
||||
public CassandraTemplate(CqlSession session) {
|
||||
this(session, newConverter(session));
|
||||
@@ -152,7 +152,7 @@ public class CassandraTemplate implements CassandraOperations, ApplicationEventP
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see CassandraConverter
|
||||
* @see Session
|
||||
* @see CqlSession
|
||||
*/
|
||||
public CassandraTemplate(CqlSession session, CassandraConverter converter) {
|
||||
this(new DefaultSessionFactory(session), converter);
|
||||
@@ -180,7 +180,7 @@ public class CassandraTemplate implements CassandraOperations, ApplicationEventP
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see CassandraConverter
|
||||
* @see Session
|
||||
* @see CqlSession
|
||||
*/
|
||||
public CassandraTemplate(CqlOperations cqlOperations, CassandraConverter converter) {
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
import com.datastax.oss.driver.api.core.cql.ResultSet;
|
||||
|
||||
/**
|
||||
* The {@link ExecutableSelectOperation} interface allows creation and execution of Cassandra {@code SELECT} operations
|
||||
@@ -31,7 +32,7 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
* <p>
|
||||
* The starting {@literal domainType} is used for mapping the {@link Query} provided via {@code matching} into the
|
||||
* Cassandra-specific representation. By default, the originating {@literal domainType} is also used for mapping back
|
||||
* the result from the {@link com.datastax.driver.core.Row}. However, it is possible to define an different
|
||||
* the result from the {@link com.datastax.oss.driver.api.core.cql.Row}. However, it is possible to define an different
|
||||
* {@literal returnType} via {@code as} for mapping the result.
|
||||
* <p>
|
||||
* By default, the table to operate on is derived from the initial {@literal domainType} and can be defined there with
|
||||
@@ -212,8 +213,8 @@ public interface ExecutableSelectOperation {
|
||||
/**
|
||||
* Stream all matching elements.
|
||||
*
|
||||
* @return a {@link Stream} wrapping the Cassandra {@link com.datastax.driver.core.ResultSet}, which needs to be
|
||||
* closed; never {@literal null}.
|
||||
* @return a {@link Stream} wrapping the Cassandra {@link ResultSet}, which needs to be closed; never
|
||||
* {@literal null}.
|
||||
* @see java.util.stream.Stream
|
||||
* @see #all()
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ class ReactiveCassandraBatchTemplate implements ReactiveCassandraBatchOperations
|
||||
|
||||
/**
|
||||
* Return a reference to the configured {@link CassandraConverter} used to map {@link Object Objects} to
|
||||
* {@link com.datastax.driver.core.Row Rows}.
|
||||
* {@link com.datastax.oss.driver.api.core.cql.Row Rows}.
|
||||
*
|
||||
* @return a reference to the configured {@link CassandraConverter}.
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ReactiveCassandraTemplate
|
||||
*
|
||||
* @param session {@link ReactiveSession} used to interact with Cassandra; must not be {@literal null}.
|
||||
* @see CassandraConverter
|
||||
* @see Session
|
||||
* @see ReactiveSession
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveSession session) {
|
||||
this(session, newConverter(session));
|
||||
@@ -148,7 +148,7 @@ public class ReactiveCassandraTemplate
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see com.datastax.oss.driver.api.core.CqlSession
|
||||
* @see ReactiveSession
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveSession session, CassandraConverter converter) {
|
||||
this(new DefaultReactiveSessionFactory(session), converter);
|
||||
@@ -162,7 +162,7 @@ public class ReactiveCassandraTemplate
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see com.datastax.oss.driver.api.core.CqlSession
|
||||
* @see ReactiveSession
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveSessionFactory sessionFactory, CassandraConverter converter) {
|
||||
this(new ReactiveCqlTemplate(sessionFactory), converter);
|
||||
@@ -177,7 +177,7 @@ public class ReactiveCassandraTemplate
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see com.datastax.oss.driver.api.core.CqlSession
|
||||
* @see ReactiveSession
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveCqlOperations reactiveCqlOperations, CassandraConverter converter) {
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
* <p>
|
||||
* The starting {@literal domainType} is used for mapping the {@link Query} provided via {@code matching} int the
|
||||
* Cassandra specific representation. By default, the originating {@literal domainType} is also used for mapping back
|
||||
* the result from the {@link com.datastax.driver.core.Row}. However, it is possible to define an different
|
||||
* the result from the {@link com.datastax.oss.driver.api.core.cql.Row}. However, it is possible to define an different
|
||||
* {@literal returnType} via {@code as} to mapping the result.
|
||||
* <p>
|
||||
* By default, the table to operate on is derived from the initial {@literal domainType} and can be defined there via
|
||||
|
||||
@@ -52,7 +52,6 @@ public abstract class CassandraJodaTimeConverters {
|
||||
* @return a {@link Collection} of Joda Time {@link Converter Converters} to register.
|
||||
* @see org.springframework.core.convert.converter.Converter
|
||||
* @see java.util.Collection
|
||||
* @see org.joda.time
|
||||
*/
|
||||
public static Collection<Converter<?, ?>> getConvertersToRegister() {
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ public abstract class CassandraThreeTenBackPortConverters {
|
||||
* @return a {@link Collection} of ThreeTen Backport {@link Converter Converters} to register.
|
||||
* @see org.springframework.core.convert.converter.Converter
|
||||
* @see java.util.Collection
|
||||
* @see org.joda.time
|
||||
*/
|
||||
public static Collection<Converter<?, ?>> getConvertersToRegister() {
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CassandraUDTValueProvider extends UdtValueProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link CassandraUDTValueProvider} with the given {@link UDTValue} and
|
||||
* Create a new {@link CassandraUDTValueProvider} with the given {@link UdtValue} and
|
||||
* {@link DefaultSpELExpressionEvaluator}.
|
||||
*
|
||||
* @param udtValue must not be {@literal null}.
|
||||
|
||||
@@ -137,9 +137,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ConversionContext} given {@link ObjectPath}.
|
||||
* Creates a new {@link ConversionContext}.
|
||||
*
|
||||
* @param path the current {@link ObjectPath}, must not be {@literal null}.
|
||||
* @return the {@link ConversionContext}.
|
||||
*/
|
||||
protected ConversionContext getConversionContext() {
|
||||
|
||||
@@ -40,7 +40,6 @@ public class RowValueProvider implements CassandraValueProvider {
|
||||
* {@link SpELExpressionEvaluator}.
|
||||
*
|
||||
* @param source must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
*/
|
||||
public RowValueProvider(Row source, SpELExpressionEvaluator evaluator) {
|
||||
|
||||
@@ -42,7 +42,6 @@ public class TupleValueProvider implements CassandraValueProvider {
|
||||
* Create a new {@link TupleValueProvider} with the given {@link TupleValue} and {@link SpELExpressionEvaluator}.
|
||||
*
|
||||
* @param tupleValue must not be {@literal null}.
|
||||
* @param codecRegistry must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
*/
|
||||
public TupleValueProvider(TupleValue tupleValue, SpELExpressionEvaluator evaluator) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class UdtValueProvider implements CassandraValueProvider {
|
||||
private final SpELExpressionEvaluator evaluator;
|
||||
|
||||
/**
|
||||
* Create a new {@link UdtValueProvider} with the given {@link UDTValue} and {@link SpELExpressionEvaluator}.
|
||||
* Create a new {@link UdtValueProvider} with the given {@link UdtValue} and {@link SpELExpressionEvaluator}.
|
||||
*
|
||||
* @param udtValue must not be {@literal null}.
|
||||
* @param evaluator must not be {@literal null}.
|
||||
|
||||
@@ -838,7 +838,7 @@ public class AsyncCqlTemplate extends CassandraAccessor implements AsyncCqlOpera
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(com.datastax.driver.core.ResultSet)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(ResultSet)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.springframework.data.cassandra.core.cql;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
|
||||
|
||||
/**
|
||||
* Adapter implementation of the {@link ResultSetExtractor} interface that delegates to a {@link RowMapper} which is
|
||||
* supposed to create an object for each row. Each object is added to the results List of this
|
||||
@@ -57,7 +57,7 @@ public class AsyncRowMapperResultSetExtractor<T> implements AsyncResultSetExtrac
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(com.datastax.driver.core.ResultSet)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(ResultSet)
|
||||
*/
|
||||
@Override
|
||||
public ListenableFuture<List<T>> extractData(AsyncResultSet resultSet) throws DriverException, DataAccessException {
|
||||
|
||||
@@ -38,8 +38,7 @@ import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
*
|
||||
* @author David Webb
|
||||
* @author Mark Paluch
|
||||
* @deprecated since 2.0. This class uses an unsafe, static held cache and is not able to prepare
|
||||
* {@link com.datastax.driver.core.querybuilder.BuiltStatement}.
|
||||
* @deprecated since 2.0. This class uses an unsafe, static held cache.
|
||||
*/
|
||||
@Deprecated
|
||||
public class CachedPreparedStatementCreator implements PreparedStatementCreator {
|
||||
|
||||
@@ -17,13 +17,13 @@ package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
|
||||
import com.datastax.oss.driver.api.core.cql.ColumnDefinition;
|
||||
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
|
||||
/**
|
||||
* {@link RowMapper} implementation that creates a {@code java.util.Map} for each row, representing all columns as
|
||||
* key-value pairs: one entry for each column, with the column name as key.
|
||||
@@ -44,7 +44,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.cql.RowMapper#mapRow(com.datastax.driver.core.Row, int)
|
||||
* @see org.springframework.data.cassandra.core.cql.RowMapper#mapRow(com.datastax.oss.driver.api.core.cql.Row, int)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> mapRow(Row rs, int rowNum) {
|
||||
@@ -82,7 +82,7 @@ public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
|
||||
*
|
||||
* @param columnName the column name as returned by the {@link Row}, must not be {@literal null}.
|
||||
* @return the column key to use.
|
||||
* @see ColumnDefinitions#getName(int)
|
||||
* @see ColumnDefinitions#get(int)
|
||||
*/
|
||||
protected String getColumnKey(String columnName) {
|
||||
return columnName;
|
||||
|
||||
@@ -184,9 +184,11 @@ public final class CqlIdentifier implements Comparable<CqlIdentifier>, Serializa
|
||||
* Returns the identifier <em>without</em> encasing quotes, regardless of the value of {@link #isQuoted()}. For
|
||||
* example, if {@link #isQuoted()} is {@code true}, then this value will be the same as {@link #toCql()} and
|
||||
* {@link #toString()}.
|
||||
* <p/>
|
||||
* This is needed, for example, to get the correct {@link TableMetadata} from
|
||||
* {@link KeyspaceMetadata#getTable(String)}: the given string must <em>not</em> be quoted.
|
||||
* <p>
|
||||
* This is needed, for example, to get the correct
|
||||
* {@link com.datastax.oss.driver.api.core.metadata.schema.TableMetadata} from
|
||||
* {@link com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata#getTable(String)}: the given string must
|
||||
* <em>not</em> be quoted.
|
||||
*/
|
||||
public String getUnquoted() {
|
||||
return unquoted;
|
||||
|
||||
@@ -850,7 +850,7 @@ public class CqlTemplate extends CassandraAccessor implements CqlOperations {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(com.datastax.driver.core.ResultSet)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(ResultSet)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
|
||||
@@ -17,13 +17,13 @@ package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
|
||||
/**
|
||||
* This encapsulates the logic for keyspace identifiers.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Keyspace identifiers are converted to lower case. To render, use any of the methods {@link #toCql()},
|
||||
* {@link #toCql(StringBuilder)}, or {@link #toString()}.
|
||||
*
|
||||
|
||||
@@ -15,21 +15,22 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
|
||||
/**
|
||||
* Generic callback interface for code that operates on a {@link PreparedStatement}. Allows to execute any number of
|
||||
* operations on a single {@link PreparedStatement}, for example a single {@link Session#execute(Statement).
|
||||
* operations on a single {@link PreparedStatement}, for example a single {@link CqlSession#execute(Statement)}.
|
||||
* <p>
|
||||
* Used internally by {@link CqlTemplate}, but also useful for application code. Note that the passed-in
|
||||
* {@link PreparedStatement} can have been created by the framework or by a custom {@link PreparedStatementCreator}.
|
||||
* However, the latter is hardly ever necessary, as most custom callback actions will perform updates in which case a
|
||||
* standard {@link PreparedStatement is fine. Custom actions will always set parameter values themselves, so that
|
||||
* standard {@link PreparedStatement} is fine. Custom actions will always set parameter values themselves, so that
|
||||
* {@link PreparedStatementCreator} capability is not needed either.
|
||||
*
|
||||
* @author David Webb
|
||||
|
||||
@@ -25,6 +25,8 @@ import org.springframework.data.cassandra.ReactiveSessionFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
|
||||
/**
|
||||
* Base class for {@link ReactiveCqlTemplate} and other CQL-accessing DAO helpers, defining common properties such as
|
||||
* {@link ReactiveSessionFactory} and exception translator.
|
||||
|
||||
@@ -19,7 +19,6 @@ import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
@@ -116,8 +115,8 @@ public class ReactiveCqlTemplate extends ReactiveCassandraAccessor implements Re
|
||||
private @Nullable ConsistencyLevel serialConsistencyLevel;
|
||||
|
||||
/**
|
||||
* Construct a new {@link ReactiveCqlTemplate Note: The {@link ReactiveSessionFactory} has to be set before using the
|
||||
* instance.
|
||||
* Construct a new {@link ReactiveCqlTemplate}. Note: The {@link ReactiveSessionFactory} has to be set before using
|
||||
* the instance.
|
||||
*
|
||||
* @see #setSessionFactory
|
||||
*/
|
||||
@@ -810,7 +809,7 @@ public class ReactiveCqlTemplate extends ReactiveCassandraAccessor implements Re
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception translation {@link Function} intended for {@link Mono#otherwise(Function)} usage.
|
||||
* Exception translation {@link Function} intended for {@link Mono#onErrorMap(Function)} usage.
|
||||
*
|
||||
* @param task readable text describing the task being attempted
|
||||
* @param cql CQL query or update that caused the problem (may be {@literal null})
|
||||
@@ -846,7 +845,7 @@ public class ReactiveCqlTemplate extends ReactiveCassandraAccessor implements Re
|
||||
/**
|
||||
* Prepare the given CQL Statement applying statement settings such as page size and consistency level.
|
||||
*
|
||||
* @param stmt the CQL Statement to prepare
|
||||
* @param statement the CQL Statement to prepare
|
||||
* @see #setConsistencyLevel(ConsistencyLevel)
|
||||
* @see #setSerialConsistencyLevel(ConsistencyLevel)
|
||||
* @see #setPageSize(int)
|
||||
|
||||
@@ -15,21 +15,23 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.ReactiveSession;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
|
||||
/**
|
||||
* Generic callback interface for code that operates on a {@link PreparedStatement}. Allows to execute any number of
|
||||
* operations on a single {@link PreparedStatement}, for example a single {@link ReactiveSession#execute(Statement).
|
||||
* operations on a single {@link PreparedStatement}, for example a single {@link ReactiveSession#execute(Statement)}.
|
||||
* <p>
|
||||
* Used internally by {@link ReactiveCqlTemplate}, but also useful for application code. Note that the passed-in
|
||||
* {@link PreparedStatement} can have been created by the framework or by a custom
|
||||
* {@link ReactivePreparedStatementCreator}. However, the latter is hardly ever necessary, as most custom callback
|
||||
* actions will perform updates in which case a standard {@link PreparedStatement is fine. Custom actions will always
|
||||
* actions will perform updates in which case a standard {@link PreparedStatement} is fine. Custom actions will always
|
||||
* set parameter values themselves, so that {@link ReactivePreparedStatementCreator} capability is not needed either.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -19,10 +19,10 @@ import java.io.Serializable;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import com.datastax.oss.driver.api.core.metadata.Node;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.oss.driver.api.core.metadata.Node;
|
||||
|
||||
/**
|
||||
* Domain object representing a Cassandra host.
|
||||
*
|
||||
@@ -45,7 +45,7 @@ public final class RingMember implements Serializable {
|
||||
private final String rack;
|
||||
|
||||
/**
|
||||
* Creates a new {@link RingMember} given {@link Host}.
|
||||
* Creates a new {@link RingMember} given {@link Node}.
|
||||
*
|
||||
* @param host
|
||||
* @return
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.ResultSet;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
/**
|
||||
* An interface used by {@link CqlTemplate} for mapping rows of a {@link com.datastax.driver.core.ResultSet} on a
|
||||
* per-row basis. Implementations of this interface perform the actual work of mapping each row to a result object, but
|
||||
* don't need to worry about exception handling. {@link DriverException}s will be caught and handled by the calling
|
||||
* {@link CqlTemplate}.
|
||||
* An interface used by {@link CqlTemplate} for mapping rows of a {@link ResultSet} on a per-row basis. Implementations
|
||||
* of this interface perform the actual work of mapping each row to a result object, but don't need to worry about
|
||||
* exception handling. {@link DriverException}s will be caught and handled by the calling {@link CqlTemplate}.
|
||||
* <p>
|
||||
* Typically used either for {@link CqlTemplate}'s query methods or for out parameters of stored procedures.
|
||||
* {@link RowMapper} objects are typically stateless and thus reusable; they are an ideal choice for implementing
|
||||
@@ -39,8 +39,7 @@ import org.springframework.lang.Nullable;
|
||||
public interface RowMapper<T> {
|
||||
|
||||
/**
|
||||
* Implementations must implement this method to map each row of data in the
|
||||
* {@link com.datastax.driver.core.ResultSet}.
|
||||
* Implementations must implement this method to map each row of data in the {@link ResultSet}.
|
||||
*
|
||||
* @param row the {@link Row} to map, must not be {@literal null}.
|
||||
* @param rowNum the number of the current row.
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.springframework.data.cassandra.core.cql;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.ResultSet;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Adapter implementation of the {@link ResultSetExtractor} interface that delegates to a {@link RowMapper} which is
|
||||
* supposed to create an object for each row. Each object is added to the results List of this
|
||||
@@ -70,7 +70,7 @@ public class RowMapperResultSetExtractor<T> implements ResultSetExtractor<List<T
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(com.datastax.driver.core.ResultSet)
|
||||
* @see org.springframework.data.cassandra.core.cql.ResultSetExtractor#extractData(ResultSet)
|
||||
*/
|
||||
@Override
|
||||
public List<T> extractData(ResultSet resultSet) throws DriverException, DataAccessException {
|
||||
|
||||
@@ -15,19 +15,19 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.ColumnDefinition;
|
||||
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
import org.springframework.dao.TypeMismatchDataAccessException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.NumberUtils;
|
||||
|
||||
import com.datastax.oss.driver.api.core.DriverException;
|
||||
import com.datastax.oss.driver.api.core.cql.ColumnDefinition;
|
||||
import com.datastax.oss.driver.api.core.cql.ColumnDefinitions;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
/**
|
||||
* {@link RowMapper} implementation that converts a single column into a single result value per row. Expects to operate
|
||||
* on a {@link com.datastax.driver.core.Row} that just contains a single column.
|
||||
* on a {@link com.datastax.oss.driver.api.core.cql.Row} that just contains a single column.
|
||||
* <p>
|
||||
* The type of the result value for each row can be specified. The value for the single column will be extracted from a
|
||||
* {@link Row} and converted into the specified target type.
|
||||
|
||||
@@ -18,16 +18,16 @@ package org.springframework.data.cassandra.core.cql.converter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.datastax.oss.driver.api.core.cql.ResultSet;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import com.datastax.oss.driver.api.core.cql.ResultSet;
|
||||
|
||||
/**
|
||||
* Convenient converter that can be used to convert a single-row-single-column, single-row-multi-column, or multi-row
|
||||
* {@link ResultSet} into the a value of a given type. The majority of the expected usage is to convert a
|
||||
* single-row-single-column result set into the target type.
|
||||
* <p/>
|
||||
* <p>
|
||||
* The algorithm is:
|
||||
* <ul>
|
||||
* <li>if there is one row with one column, convert that value to this converter's type if possible or throw,</li>
|
||||
@@ -35,7 +35,7 @@ import org.springframework.lang.Nullable;
|
||||
* throw,</li>
|
||||
* <li>else convert the rows into this converter's type (since there are multiple rows) or throw.</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
* <p>
|
||||
* If the converter throws due to the inability to convert a given {@link ResultSet}, it will throw an
|
||||
* {@link IllegalArgumentException}.
|
||||
*
|
||||
@@ -66,7 +66,7 @@ public abstract class AbstractResultSetConverter<T> implements Converter<ResultS
|
||||
}
|
||||
|
||||
/**
|
||||
* @return surrogate value if the {@link ResultSet} is {@link ResultSet#isExhausted() exhausted}.
|
||||
* @return surrogate value if the {@link ResultSet} is {@link ResultSet#isFullyFetched()}}.
|
||||
*/
|
||||
@Nullable
|
||||
protected T getExhaustedResultSetValue() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.data.cassandra.core.cql.keyspace.Option;
|
||||
* 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.
|
||||
* @param <T> the subtype of this class for which this is a CQL generator.
|
||||
*/
|
||||
public abstract class KeyspaceOptionsCqlGenerator<T extends KeyspaceOptionsSpecification<T>>
|
||||
extends KeyspaceNameCqlGenerator<KeyspaceOptionsSpecification<T>> {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.data.cassandra.core.cql.keyspace.TableOptionsSpecific
|
||||
* 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.
|
||||
* @param <T> the subtype of this class for which this is a CQL generator.
|
||||
*/
|
||||
public abstract class TableOptionsCqlGenerator<T extends TableOptionsSpecification<T>>
|
||||
extends TableNameCqlGenerator<T> {
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.datastax.oss.driver.api.core.type.DataType;
|
||||
|
||||
/**
|
||||
* Object to configure a CQL column specification.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Use {@link #name(String)} and {@link #type(DataType)} to set the name and type of the column, respectively. To
|
||||
* specify a clustered {@code PRIMARY KEY} column, use {@link #clustered()} or {@link #clustered(Ordering)}. To specify
|
||||
* that the {@code PRIMARY KEY} column is or is part of the partition key, use {@link #partitioned()} instead of
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql.keyspace;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
import com.datastax.oss.driver.api.core.type.DataType;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Base value object class to specify user type fields.
|
||||
* <p/>
|
||||
* <p>
|
||||
* A {@link FieldSpecification} consists of a name and a {@link DataType}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
*
|
||||
* @author John McPeek
|
||||
* @author David Webb
|
||||
* @param <T> The subtype of the {@link KeyspaceActionSpecification}
|
||||
*/
|
||||
public abstract class KeyspaceActionSpecification {
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
/**
|
||||
* Abstract builder class to support the construction of table specifications that have table options, that is, those
|
||||
* options normally specified by {@code WITH ... AND ...}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* It is important to note that although this class depends on {@link KeyspaceOption} for convenient and typesafe use,
|
||||
* it ultimately stores its options in a <code>Map<String,Object></code> for flexibility. This means that
|
||||
* it ultimately stores its options in a <code>Map<String,Object></code> for flexibility. This means that
|
||||
* {@link #with(KeyspaceOption)} and {@link #with(KeyspaceOption, 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 John McPeek
|
||||
* @param <T> The subtype of the {@link KeyspaceOptionsSpecification}.
|
||||
* @param <T> the subtype of the {@link KeyspaceOptionsSpecification}.
|
||||
*/
|
||||
public abstract class KeyspaceOptionsSpecification<T extends KeyspaceOptionsSpecification<T>>
|
||||
extends KeyspaceActionSpecification {
|
||||
@@ -74,7 +74,7 @@ public abstract class KeyspaceOptionsSpecification<T extends KeyspaceOptionsSpec
|
||||
|
||||
/**
|
||||
* Adds the given option by name to this keyspaces's options.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Options that have {@literal 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
|
||||
|
||||
@@ -15,25 +15,24 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.cql.keyspace;
|
||||
|
||||
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import static org.springframework.data.cassandra.core.cql.keyspace.CqlStringUtils.*;
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
|
||||
/**
|
||||
* Abstract builder class to support the construction of table specifications that have table options, that is, those
|
||||
* options normally specified by {@code WITH ... AND ...}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* 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 <code>Map<String,Object></code> 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.
|
||||
* ultimately stores its options in a <code>Map</code> 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
|
||||
* @author Mark Paluch
|
||||
@@ -73,7 +72,7 @@ public abstract class TableOptionsSpecification<T extends TableOptionsSpecificat
|
||||
|
||||
/**
|
||||
* Adds the given option by name to this table's options.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Options that have {@literal 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
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
|
||||
/**
|
||||
* {@link PreparedStatementCreator} implementation using caching of prepared statements.
|
||||
* <p />
|
||||
* <p>
|
||||
* Regular CQL statements are prepared on first use and executed as prepared statements. Prepared statements are cached
|
||||
* by Cassandra itself (invalidation/eviction possible), in the driver to be able to re-prepare a statement and in this
|
||||
* {@link CachedPreparedStatementCreator} using {@link PreparedStatementCache}.
|
||||
@@ -35,7 +35,8 @@ import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
* @author Mark Paluch
|
||||
* @since 2.0
|
||||
* @see PreparedStatementCache
|
||||
* @deprecated since 3.2, the Cassandra driver has a built-in prepared statement cache with makes external caching of prepared statements superfluous.
|
||||
* @deprecated since 3.2, the Cassandra driver has a built-in prepared statement cache with makes external caching of
|
||||
* prepared statements superfluous.
|
||||
*/
|
||||
@Deprecated
|
||||
public class CachedPreparedStatementCreator implements PreparedStatementCreator {
|
||||
|
||||
@@ -29,14 +29,15 @@ import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
|
||||
/**
|
||||
* {@link PreparedStatementCache} backed by a {@link Map} cache. Defaults to simple {@link ConcurrentHashMap} caching.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Statements are cached with a key consisting of {@link CqlSession#getName() session name}, {@code keyspace} and the
|
||||
* {@code cql} text. Statement options (idempotency, timeouts) apply from the statement that was initially prepared.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Aldo Bongio
|
||||
* @since 2.0
|
||||
* @deprecated since 3.2, the Cassandra driver has a built-in prepared statement cache with makes external caching of prepared statements superfluous.
|
||||
* @deprecated since 3.2, the Cassandra driver has a built-in prepared statement cache with makes external caching of
|
||||
* prepared statements superfluous.
|
||||
*/
|
||||
@Deprecated
|
||||
public class MapPreparedStatementCache implements PreparedStatementCache {
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
|
||||
/**
|
||||
* Cache interface to synchronously prepare CQL statements.
|
||||
* <p />
|
||||
* <p>
|
||||
* Implementing classes of {@link PreparedStatementCache} come with own synchronization and cache implementation
|
||||
* characteristics. A cache implementation should optimize for reduction of preparation calls and cache statements using
|
||||
* Cassandras cache key which is specific to the Cluster, keyspace, and CQL text.
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Simple implementation of {@link MapId}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* <em>Note:</em> This could be extended in various cool ways, like one that takes a type and validates that the given
|
||||
* name corresponds to an actual field or bean property on that type. There could also be another one that uses a
|
||||
* {@link CassandraPersistentEntity} and {@link CassandraPersistentProperty} instead of a String name.
|
||||
|
||||
@@ -25,8 +25,7 @@ import java.util.Comparator;
|
||||
* <li>Composite primary keys first (equal if both {@link CassandraPersistentProperty} are a composite primary key)</li>
|
||||
* <li>Primary key columns (see {@link CassandraPrimaryKeyColumnAnnotationComparator}, compare by ordinal/name/ordering)
|
||||
* </li>
|
||||
* <li>Regular columns, compared by column name (see
|
||||
* {@link com.datastax.oss.driver.api.core.CqlIdentifier#compareTo(CqlIdentifier)})</li>
|
||||
* <li>Regular columns, compared by column name (see {@link String#compareTo(String)}).</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Alex Shvid
|
||||
|
||||
@@ -43,10 +43,10 @@ public @interface CassandraType {
|
||||
/**
|
||||
* If the property is {@link java.util.Collection Collection-like}, then this attribute holds a single {@link Name
|
||||
* DataType Name} representing the element type of the {@link java.util.Collection}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* If the property is a {@link java.util.Map}, then this attribute holds exactly two {@link Name DataType Names}; the
|
||||
* first is the key type and the second is the value type.
|
||||
* <p/>
|
||||
* <p>
|
||||
* If the property is neither {@link java.util.Collection Collection-like} nor a {@link java.util.Map}, then this
|
||||
* attribute is ignored.
|
||||
*
|
||||
|
||||
@@ -23,9 +23,8 @@ import com.datastax.oss.driver.api.core.type.TupleType;
|
||||
import com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry;
|
||||
|
||||
/**
|
||||
* {@link CodecRegistry}-based {@link TupleTypeFactory} using
|
||||
* {@link TupleType#of(ProtocolVersion, CodecRegistry, DataType...)} to create tuple types. {@link TupleType tuple
|
||||
* types}.
|
||||
* {@link CodecRegistry}-based {@link TupleTypeFactory} using {@link SimpleTupleTypeFactory#create(DataType...)} to
|
||||
* create tuple types. {@link TupleType tuple types}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 2.1
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
* The annotation to configure a value object as embedded in the current table.
|
||||
* <p />
|
||||
* <p>
|
||||
* Depending on the {@link OnEmpty value} of {@link #onEmpty()} the property is set to {@literal null} or an empty
|
||||
* instance in the case all embedded values are {@literal null} when reading from the result set.
|
||||
*
|
||||
@@ -41,10 +41,10 @@ public @interface Embedded {
|
||||
|
||||
/**
|
||||
* Set the load strategy for the embedded object if all contained fields yield {@literal null} values.
|
||||
* <p />
|
||||
* <p>
|
||||
* {@link Nullable @Embedded.Nullable} and {@link Empty @Embedded.Empty} offer shortcuts for this.
|
||||
*
|
||||
* @return never {@link} null.
|
||||
* @return never {@code null}.
|
||||
*/
|
||||
OnEmpty onEmpty();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class IdInterfaceValidator {
|
||||
* then an {@link IdInterfaceExceptions} is thrown containing all of the violations encountered, which can be obtained
|
||||
* from {@link IdInterfaceExceptions#getExceptions()} or, as a convenience,
|
||||
* {@link IdInterfaceExceptions#getMessages()}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Id interfaces are intended to have methods representing setters and getters. Getter methods take the form
|
||||
* <ul>
|
||||
* <li>{@code PropertyType getPropertyName()} or</li>
|
||||
@@ -45,7 +45,7 @@ class IdInterfaceValidator {
|
||||
* <li>{@code void|IdType propertyName(PropertyType)};</li>
|
||||
* </ul>
|
||||
* setter methods may also declare that they return their id interface type to support method chaining.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Id interfaces
|
||||
* <ul>
|
||||
* <li>must be an {@code interface}, not a <code>class</code>,</li>
|
||||
|
||||
@@ -39,8 +39,8 @@ import java.lang.annotation.Target;
|
||||
* @Table
|
||||
* class Person {
|
||||
*
|
||||
* Map<@Indexed String, String> indexedKey; // allows CONTAINS KEY queries
|
||||
* Map<String, @Indexed String> indexedValue; // allows CONTAINS queries
|
||||
* Map<@Indexed String, String> indexedKey; // allows CONTAINS KEY queries
|
||||
* Map<String, @Indexed String> indexedValue; // allows CONTAINS queries
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
|
||||
@@ -27,10 +27,10 @@ import org.springframework.data.annotation.Id;
|
||||
* Identifies the primary key field of the entity, which may be of a basic type or of a type that represents a composite
|
||||
* primary key class. This field corresponds to the {@code PRIMARY KEY} of the corresponding Cassandra table. Only one
|
||||
* field in a given type hierarchy may be annotated with this annotation.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Remember, if the Cassandra table has multiple primary key columns, then you must define a class annotated with
|
||||
* {@link PrimaryKeyClass} to represent the primary key!
|
||||
* <p/>
|
||||
* <p>
|
||||
* Use {@link PrimaryKeyColumn} in conjunction with {@link Id} to specify extended primary key column properties.
|
||||
*
|
||||
* @author Alex Shvid
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.data.annotation.Persistent;
|
||||
|
||||
/**
|
||||
* Annotates a type that represents the identity type of another class whose instances are stored in a table.
|
||||
* <p/>
|
||||
* <p>
|
||||
* If your Cassandra table has multiple primary key columns, then you must define a primary key class, annotate it with
|
||||
* this annotation, and use that class as the {@link PrimaryKey} of your entity class!
|
||||
*
|
||||
|
||||
@@ -87,8 +87,6 @@ public @interface SASI {
|
||||
* Apply standard analyzer to SASI indexing. This analyzer is used for analysis that involves stemming, case
|
||||
* normalization, case sensitivity, skipping common words like "and" and "the", and localization of the language used
|
||||
* to complete the analysis
|
||||
*
|
||||
* @see org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer
|
||||
*/
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
@@ -126,8 +124,6 @@ public @interface SASI {
|
||||
/**
|
||||
* Apply non-tokenizing analyzer to SASI indexing. Use this analyzer for cases where the text is not analyzed, but
|
||||
* case normalization or sensitivity is required.
|
||||
*
|
||||
* @see org.apache.cassandra.index.sasi.analyzer.NonTokenizingAnalyzer
|
||||
*/
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
|
||||
@@ -24,10 +24,10 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Identifies a domain object as Cassandra Tuple. Tuples use ordered fields to map their value to the actual property.
|
||||
* <p/>
|
||||
* <p>
|
||||
* A mapped tuple type is typically annotated with {@code @Tuple} and its properties/accessors are annotated with
|
||||
* {@code @Element(0), @Element(1), ..., @Element(n)}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Example usage:
|
||||
*
|
||||
* <pre class="code">
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
import com.datastax.oss.driver.api.core.cql.Row;
|
||||
|
||||
/**
|
||||
* Event to be triggered after loading {@link com.datastax.driver.core.Row}s to be mapped onto a given type.
|
||||
* Event to be triggered after loading {@link Row}s to be mapped onto a given type.
|
||||
*
|
||||
* @author Lukasz Antoniak
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
|
||||
* allows creation of the first page request and represents through Cassandra paging is based on the progress of fetched
|
||||
* pages and allows forward-only navigation. Accessing a particular page requires fetching of all pages until the
|
||||
* desired page is reached.
|
||||
* <p/>
|
||||
* <p>
|
||||
* The fetching progress is represented as {@link ByteBuffer paging state}. Query results are associated with a
|
||||
* {@link com.datastax.oss.driver.api.core.cql.ExecutionInfo#getPagingState paging state} that is used on the next query
|
||||
* as input parameter to continue page fetching.
|
||||
|
||||
@@ -145,8 +145,8 @@ public interface CriteriaDefinition {
|
||||
|
||||
/**
|
||||
* Render to a CQL-like representation. Rendering does not apply conversion via
|
||||
* {@link com.datastax.driver.core.CodecRegistry} therefore this output is an approximation towards CQL and not
|
||||
* necessarily valid CQL.
|
||||
* {@link com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry} therefore this output is an
|
||||
* approximation towards CQL and not necessarily valid CQL.
|
||||
*
|
||||
* @param value optional predicate value, can be {@literal null}.
|
||||
* @return A CQL-like representation.
|
||||
|
||||
@@ -196,7 +196,7 @@ public class Query implements Filter {
|
||||
/**
|
||||
* Create a {@link Query} initialized with a {@link PageRequest} to fetch the first page of results or advance in
|
||||
* paging along with sorting. Reads (and overrides, if set) {@link Pageable#getPageSize() page size} into
|
||||
* {@link QueryOptions#getPageSize()} and sets {@link PagingState} and {@link Sort}.
|
||||
* {@link QueryOptions#getPageSize()} and sets {@code pagingState} and {@link Sort}.
|
||||
*
|
||||
* @param pageable must not be {@literal null}.
|
||||
* @return a new {@link Query} object containing the former settings with {@link PageRequest} applied.
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.data.repository.NoRepositoryBean;
|
||||
/**
|
||||
* Cassandra-specific extension of the {@link CrudRepository} interface that allows the specification of a type for the
|
||||
* identity of the {@link Table @Table} (or {@link Persistable @Persistable}) type.
|
||||
* <p />
|
||||
* <p>
|
||||
* Repositories based on {@link CassandraRepository} can define either a single primary key, use a primary key class or
|
||||
* a compound primary key without a primary key class. Types using a compound primary key without a primary key class
|
||||
* must use {@link MapId} to declare their key value.
|
||||
@@ -56,7 +56,7 @@ public interface CassandraRepository<T, ID> extends CrudRepository<T, ID> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p/>
|
||||
* <p>
|
||||
* Note: Cassandra supports single-field {@code IN} queries only. When using {@link MapId} with multiple components,
|
||||
* use {@link #findById(Object)}.
|
||||
*
|
||||
|
||||
@@ -23,11 +23,11 @@ import org.springframework.data.repository.NoRepositoryBean;
|
||||
|
||||
/**
|
||||
* Cassandra repository interface using {@link MapId} to represent Ids.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This interface uses {@link MapId} for the id type, allowing you to annotate entity fields or properties with
|
||||
* {@link PrimaryKeyColumn @PrimaryKeyColumn}. Use this interface if you do not require a composite primary key class
|
||||
* and want to specify the Id with {@link MapId}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* Steps to use this interface:
|
||||
* <ul>
|
||||
* <li>Define your entity, including a field or property for each column, including those for partition and (optional)
|
||||
|
||||
@@ -81,7 +81,7 @@ public @interface Query {
|
||||
|
||||
/**
|
||||
* Undefined state (default for all non-{@code SELECT} statements. Leaves
|
||||
* {@link com.datastax.oss.driver.api.core.cql.Statement#setIdempotent(boolean)} state unchanged.
|
||||
* {@link com.datastax.oss.driver.api.core.cql.Statement#setIdempotent(Boolean)} state unchanged.
|
||||
*/
|
||||
UNDEFINED,
|
||||
|
||||
@@ -92,7 +92,7 @@ public @interface Query {
|
||||
|
||||
/**
|
||||
* Statement considered non-idempotent. Sets
|
||||
* {@link com.datastax.oss.driver.api.core.cql.Statement#setIdempotent(boolean)} to {@code false}.
|
||||
* {@link com.datastax.oss.driver.api.core.cql.Statement#setIdempotent(Boolean)} to {@code false}.
|
||||
*/
|
||||
NON_IDEMPOTENT
|
||||
}
|
||||
|
||||
@@ -63,16 +63,16 @@ public interface ReactiveCassandraRepository<T, ID> extends ReactiveCrudReposito
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p/>
|
||||
* <p>
|
||||
* Note: Cassandra supports single-field {@code IN} queries only. Fetches each row individually when using
|
||||
* {@link MapId} with multiple components.
|
||||
* {@link org.springframework.data.cassandra.core.mapping.MapId} with multiple components.
|
||||
*/
|
||||
@Override
|
||||
Flux<T> findAllById(Iterable<ID> iterable);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p/>
|
||||
* <p>
|
||||
* Fetches each row individually.
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -207,7 +207,7 @@ class CassandraQueryCreator extends AbstractQueryCreator<Query, Filter> {
|
||||
|
||||
/**
|
||||
* Compute a {@link Type#BETWEEN} {@link Part}.
|
||||
* <p/>
|
||||
* <p>
|
||||
* In case the first {@literal value} is actually a {@link Range} the lower and upper bounds of the {@link Range} are
|
||||
* used according to their {@link Range.Bound#isInclusive() inclusion} definition. Otherwise the {@literal value} is
|
||||
* used for greater than and {@link Iterator#next() parameters.next()} as less than criterions.
|
||||
|
||||
@@ -211,7 +211,7 @@ interface CassandraQueryExecution {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link CassandraQueryExecution} to return a {@link com.datastax.driver.core.ResultSet}.
|
||||
* {@link CassandraQueryExecution} to return a {@link ResultSet}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -163,7 +163,7 @@ public class CassandraQueryMethod extends QueryMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the method has an annotated {@link com.datastax.driver.core.ConsistencyLevel}.
|
||||
* @return whether the method has an annotated {@link ConsistencyLevel}.
|
||||
* @since 2.0
|
||||
*/
|
||||
public boolean hasConsistencyLevel() {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class MapBuilder<K, V> implements Map<K, V> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to construct a new {@code MapBuilder<Object,Object>}. Convenient if imported statically.
|
||||
* Factory method to construct a new {@code MapBuilder}. Convenient if imported statically.
|
||||
*/
|
||||
public static MapBuilder<Object, Object> map() {
|
||||
return map(Object.class, Object.class);
|
||||
@@ -90,7 +90,7 @@ public class MapBuilder<K, V> implements Map<K, V> {
|
||||
/**
|
||||
* Return a new map based on the current state of this builder's map.
|
||||
*
|
||||
* @return A new Map<K, V> with this builder's map's current content.
|
||||
* @return a new Map with this builder's map's current content.
|
||||
*/
|
||||
public Map<K, V> build() {
|
||||
return new LinkedHashMap<>(map);
|
||||
|
||||
Reference in New Issue
Block a user