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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Ensures the CassandraReactiveSessionFactory
and exception translator has been properly set.Returns the exception translator for this instance.Returns the configuredReactiveSessionFactory
.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 theReactiveSessionFactory
to use.protected static String
Determine CQL from potential provider object.protected DataAccessException
translate
(String task, String cql, RuntimeException ex) Translate the givenDriverException
into a genericDataAccessException
.protected DataAccessException
Translate the givenDriverException
into a genericDataAccessException
.
-
Field Details
-
logger
Logger available to subclasses
-
-
Constructor Details
-
ReactiveCassandraAccessor
public ReactiveCassandraAccessor()
-
-
Method Details
-
setSessionFactory
Sets theReactiveSessionFactory
to 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 CassandraReactiveSessionFactory
and exception translator has been properly set.- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
translateExceptionIfPossible
Translate the givenDriverException
into a genericDataAccessException
.The returned
DataAccessException
is supposed to contain the originalDriverException
as root cause. However, client code may not generally rely on this due toDataAccessException
s possibly being caused by other resource APIs as well. That said, agetRootCause() instanceof DataAccessException
check (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 givenDriverException
into a genericDataAccessException
.The returned
DataAccessException
is supposed to contain the originalDriverException
as root cause. However, client code may not generally rely on this due toDataAccessException
s possibly being caused by other resource APIs as well. That said, agetRootCause() instanceof DataAccessException
check (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:
-