@Configuration public abstract class AbstractSessionConfiguration extends Object implements BeanFactoryAware
Configuration
class used to configure a Cassandra client application CqlSession
connected to a
Cassandra cluster. Enables a Cassandra Keyspace to be specified along with the ability to execute arbitrary CQL on
startup as well as shutdown.Configuration
Constructor and Description |
---|
AbstractSessionConfiguration() |
Modifier and Type | Method and Description |
---|---|
CqlSessionFactoryBean |
cassandraSession()
Creates a
CqlSessionFactoryBean that provides a Cassandra CqlSession . |
CqlTemplate |
cqlTemplate()
Creates a
CqlTemplate configured with getRequiredSessionFactory() . |
protected String |
getClusterName()
Deprecated.
since 3.0, use
getSessionName() instead. |
protected CompressionType |
getCompressionType()
Returns the
CompressionType . |
protected String |
getContactPoints()
Returns the Cassandra contact points.
|
protected List<CreateKeyspaceSpecification> |
getKeyspaceCreations()
Returns the list of keyspace creations to be run right after initialization.
|
protected List<DropKeyspaceSpecification> |
getKeyspaceDrops()
Returns the list of keyspace drops to be run before shutdown.
|
protected abstract String |
getKeyspaceName()
Return the name of the keyspace to connect to.
|
protected String |
getLocalDataCenter()
Returns the local data center name used for
LoadBalancingPolicy . |
protected int |
getPort()
Returns the Cassandra port.
|
protected com.datastax.oss.driver.api.core.CqlSession |
getRequiredSession()
Returns the initialized
CqlSession instance. |
protected SessionFactory |
getRequiredSessionFactory()
Returns the initialized
CqlSession instance. |
protected SessionBuilderConfigurer |
getSessionBuilderConfigurer()
Returns the
SessionBuilderConfigurer . |
protected String |
getSessionName()
Returns the session name.
|
protected List<String> |
getShutdownScripts()
Deprecated.
since 3.0, declare a
SessionFactoryInitializer bean. |
protected List<String> |
getStartupScripts()
Deprecated.
since 3.0, declare a
SessionFactoryInitializer bean. |
void |
setBeanFactory(BeanFactory beanFactory) |
protected abstract String getKeyspaceName()
protected SessionFactory getRequiredSessionFactory()
CqlSession
instance.CqlSession
.IllegalStateException
- if the session factory is not initialized.@Nullable protected SessionBuilderConfigurer getSessionBuilderConfigurer()
SessionBuilderConfigurer
.SessionBuilderConfigurer
; may be null.@Nullable @Deprecated protected String getClusterName()
getSessionName()
instead.@Nullable protected String getSessionName()
@Nullable protected CompressionType getCompressionType()
CompressionType
.CompressionType
, may be null.protected String getContactPoints()
localhost
CqlSessionFactoryBean.DEFAULT_CONTACT_POINTS
protected int getPort()
9042
.CqlSessionFactoryBean.DEFAULT_PORT
protected List<CreateKeyspaceSpecification> getKeyspaceCreations()
null
.protected List<DropKeyspaceSpecification> getKeyspaceDrops()
null
.protected String getLocalDataCenter()
LoadBalancingPolicy
.@Deprecated protected List<String> getStartupScripts()
SessionFactoryInitializer
bean.keyspace creations
and after
initialization in the system
keyspace.null
.@Deprecated protected List<String> getShutdownScripts()
SessionFactoryInitializer
bean.keyspace drops
and right before
shutdown in the system
keyspace.null
.protected com.datastax.oss.driver.api.core.CqlSession getRequiredSession()
CqlSession
instance.CqlSession
.IllegalStateException
- if the session factory is not initialized.@Bean public CqlSessionFactoryBean cassandraSession()
CqlSessionFactoryBean
that provides a Cassandra CqlSession
.CqlSessionFactoryBean
.getKeyspaceName()
,
getStartupScripts()
,
getShutdownScripts()
@Bean public CqlTemplate cqlTemplate()
CqlTemplate
configured with getRequiredSessionFactory()
.CqlTemplate
.getRequiredSession()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.