public abstract class ReactiveCassandraAccessor extends Object implements InitializingBean
ReactiveCqlTemplate and other CQL-accessing DAO helpers, defining common properties such as
ReactiveSessionFactory and exception translator.
Not intended to be used directly.
InitializingBean,
ReactiveSession,
ReactiveCqlTemplate| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
Logger available to subclasses
|
| Constructor and Description |
|---|
ReactiveCassandraAccessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Ensures the Cassandra
ReactiveSessionFactory and exception translator has been properly set. |
CqlExceptionTranslator |
getExceptionTranslator()
Returns the exception translator for this instance.
|
ReactiveSessionFactory |
getSessionFactory()
Returns the configured
ReactiveSessionFactory. |
void |
setExceptionTranslator(CqlExceptionTranslator exceptionTranslator)
Sets the exception translator used by this template to translate Cassandra specific exceptions into Spring DAO's
Exception Hierarchy.
|
void |
setSessionFactory(ReactiveSessionFactory sessionFactory)
Sets the
ReactiveSessionFactory to use. |
protected DataAccessException |
translate(String task,
String cql,
RuntimeException ex)
Translate the given
DriverException into a generic DataAccessException. |
protected DataAccessException |
translateExceptionIfPossible(RuntimeException ex)
Translate the given
DriverException into a generic DataAccessException. |
public void setSessionFactory(ReactiveSessionFactory sessionFactory)
ReactiveSessionFactory to use.sessionFactory - must not be null.@Nullable public ReactiveSessionFactory getSessionFactory()
ReactiveSessionFactory.ReactiveSessionFactory.public void setExceptionTranslator(CqlExceptionTranslator exceptionTranslator)
exceptionTranslator - exception translator to set; must not be null.CassandraExceptionTranslator,
DataAccessExceptionpublic CqlExceptionTranslator getExceptionTranslator()
CassandraExceptionTranslatorpublic void afterPropertiesSet()
ReactiveSessionFactory and exception translator has been properly set.afterPropertiesSet in interface InitializingBean@Nullable protected DataAccessException translateExceptionIfPossible(RuntimeException ex)
DriverException into a generic DataAccessException.
The returned DataAccessException is supposed to contain the original DriverException as root cause.
However, client code may not generally rely on this due to DataAccessExceptions possibly being caused by
other resource APIs as well. That said, a getRootCause() instanceof DataAccessException check (and
subsequent cast) is considered reliable when expecting Cassandra-based access to have happened.
ex - the offending DriverExceptionDriverExceptionDataAccessExceptionprotected DataAccessException translate(String task, @Nullable String cql, RuntimeException ex)
DriverException into a generic DataAccessException.
The returned DataAccessException is supposed to contain the original DriverException as root cause.
However, client code may not generally rely on this due to DataAccessExceptions possibly being caused by
other resource APIs as well. That said, a getRootCause() instanceof DataAccessException check (and
subsequent cast) is considered reliable when expecting Cassandra-based access to have happened.
task - readable text describing the task being attemptedcql - CQL query or update that caused the problem (may be null)ex - the offending DriverExceptionDriverExceptionNestedRuntimeException.getRootCause(),
Consistent
exception hierarchyCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.