public class CassandraCqlSessionFactoryBean extends Object implements FactoryBean<com.datastax.driver.core.Session>, InitializingBean, DisposableBean, PersistenceExceptionTranslator
Session, which is a thread-safe singleton. As such, it is sufficient to
have one Session per application and keyspace.| Modifier and Type | Field and Description |
|---|---|
protected com.datastax.driver.core.Cluster |
cluster |
protected PersistenceExceptionTranslator |
exceptionTranslator |
protected String |
keyspaceName |
protected com.datastax.driver.core.Session |
session |
protected List<String> |
shutdownScripts |
protected List<String> |
startupScripts |
| Constructor and Description |
|---|
CassandraCqlSessionFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
protected void |
executeScripts(List<String> scripts)
Executes given scripts.
|
com.datastax.driver.core.Session |
getObject() |
Class<? extends com.datastax.driver.core.Session> |
getObjectType() |
List<String> |
getShutdownScripts()
Returns an unmodifiable list of shutdown scripts.
|
List<String> |
getStartupScripts()
Returns an unmodifiable list of startup scripts.
|
boolean |
isSingleton() |
void |
setCluster(com.datastax.driver.core.Cluster cluster)
Sets the cluster to use.
|
void |
setKeyspaceName(String keyspaceName)
Sets the keyspace name to connect to.
|
void |
setShutdownScripts(List<String> scripts)
Sets CQL scripts to be executed immediately before the session is shutdown.
|
void |
setStartupScripts(List<String> scripts)
Sets CQL scripts to be executed immediately after the session is connected.
|
DataAccessException |
translateExceptionIfPossible(RuntimeException ex) |
protected com.datastax.driver.core.Cluster cluster
protected com.datastax.driver.core.Session session
protected String keyspaceName
protected final PersistenceExceptionTranslator exceptionTranslator
public com.datastax.driver.core.Session getObject()
getObject in interface FactoryBean<com.datastax.driver.core.Session>public Class<? extends com.datastax.driver.core.Session> getObjectType()
getObjectType in interface FactoryBean<com.datastax.driver.core.Session>public boolean isSingleton()
isSingleton in interface FactoryBean<com.datastax.driver.core.Session>public DataAccessException translateExceptionIfPossible(RuntimeException ex)
translateExceptionIfPossible in interface PersistenceExceptionTranslatorpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanExceptionprotected void executeScripts(List<String> scripts)
public void destroy()
throws Exception
destroy in interface DisposableBeanExceptionpublic void setKeyspaceName(String keyspaceName)
null, empty string, or only whitespace will cause the
system keyspace to be used.public void setCluster(com.datastax.driver.core.Cluster cluster)
public void setStartupScripts(List<String> scripts)
public List<String> getStartupScripts()
public void setShutdownScripts(List<String> scripts)
Copyright © 2011-2014–2015 Pivotal Software, Inc.. All rights reserved.