Class ReactiveCassandraAccessor
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
ReactiveCqlTemplate
ReactiveCqlTemplate and other CQL-accessing DAO helpers, defining common properties such as
ReactiveSessionFactory and exception translator.
Not intended to be used directly.
- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures the CassandraReactiveSessionFactoryand exception translator has been properly set.Returns the exception translator for this instance.Returns the configuredReactiveSessionFactory.voidsetExceptionTranslator(CqlExceptionTranslator exceptionTranslator) Sets the exception translator used by this template to translate Cassandra specific exceptions into Spring DAO's Exception Hierarchy.voidsetSessionFactory(ReactiveSessionFactory sessionFactory) Sets theReactiveSessionFactoryto use.protected static StringDetermine CQL from potential provider object.protected DataAccessExceptiontranslate(String task, String cql, RuntimeException ex) Translate the givenDriverExceptioninto a genericDataAccessException.protected DataAccessExceptionTranslate the givenDriverExceptioninto a genericDataAccessException.
-
Field Details
-
logger
Logger available to subclasses
-
-
Constructor Details
-
ReactiveCassandraAccessor
public ReactiveCassandraAccessor()
-
-
Method Details
-
setSessionFactory
Sets theReactiveSessionFactoryto use.- Parameters:
sessionFactory- must not be null.
-
getSessionFactory
Returns the configuredReactiveSessionFactory.- Returns:
- the configured
ReactiveSessionFactory.
-
setExceptionTranslator
Sets the exception translator used by this template to translate Cassandra specific exceptions into Spring DAO's Exception Hierarchy.- Parameters:
exceptionTranslator- exception translator to set; must not be null.- See Also:
-
getExceptionTranslator
Returns the exception translator for this instance.- Returns:
- the Cassandra exception translator.
- See Also:
-
afterPropertiesSet
public void afterPropertiesSet()Ensures the CassandraReactiveSessionFactoryand exception translator has been properly set.- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
translateExceptionIfPossible
Translate the givenDriverExceptioninto a genericDataAccessException.The returned
DataAccessExceptionis supposed to contain the originalDriverExceptionas root cause. However, client code may not generally rely on this due toDataAccessExceptions possibly being caused by other resource APIs as well. That said, agetRootCause() instanceof DataAccessExceptioncheck (and subsequent cast) is considered reliable when expecting Cassandra-based access to have happened.- Parameters:
ex- the offendingDriverException- Returns:
- the DataAccessException, wrapping the
DriverException - See Also:
-
translate
Translate the givenDriverExceptioninto a genericDataAccessException.The returned
DataAccessExceptionis supposed to contain the originalDriverExceptionas root cause. However, client code may not generally rely on this due toDataAccessExceptions possibly being caused by other resource APIs as well. That said, agetRootCause() instanceof DataAccessExceptioncheck (and subsequent cast) is considered reliable when expecting Cassandra-based access to have happened.- Parameters:
task- readable text describing the task being attemptedcql- CQL query or update that caused the problem (may be null)ex- the offendingDriverException- Returns:
- the DataAccessException, wrapping the
DriverException - See Also:
-
toCql
Determine CQL from potential provider object.- Parameters:
cqlProvider- object that's potentially aCqlProvider- Returns:
- the CQL string, or null
- Since:
- 3.2.7
- See Also:
-