@Configuration public abstract class AbstractCassandraConfiguration extends AbstractClusterConfiguration implements BeanClassLoaderAware
Constructor and Description |
---|
AbstractCassandraConfiguration() |
Modifier and Type | Method and Description |
---|---|
CassandraConverter |
cassandraConverter()
Creates a
CassandraConverter using the configured cassandraMapping() . |
CassandraMappingContext |
cassandraMapping()
Return the
MappingContext instance to map Entities to properties. |
CassandraAdminTemplate |
cassandraTemplate()
Creates a
CassandraAdminTemplate . |
CustomConversions |
customConversions()
Register custom
Converter s in a CustomConversions object if required. |
String[] |
getEntityBasePackages()
Base packages to scan for entities annotated with
Table annotations. |
protected Set<Class<?>> |
getInitialEntitySet()
Return the
Set of initial entity classes. |
protected abstract String |
getKeyspaceName()
Return the name of the keyspace to connect to.
|
protected com.datastax.driver.core.Session |
getRequiredSession()
Returns the initialized
Session instance. |
SchemaAction |
getSchemaAction()
The
SchemaAction to perform at startup. |
CassandraSessionFactoryBean |
session()
Creates a
CassandraSessionFactoryBean that provides a Cassandra Session . |
SessionFactory |
sessionFactory()
|
void |
setBeanClassLoader(ClassLoader classLoader) |
cluster, getAddressTranslator, getAuthProvider, getClusterBuilderConfigurer, getClusterName, getCompressionType, getContactPoints, getKeyspaceCreations, getKeyspaceDrops, getLoadBalancingPolicy, getMaxSchemaAgreementWaitSeconds, getMetricsEnabled, getNettyOptions, getPoolingOptions, getPort, getProtocolVersion, getQueryOptions, getReconnectionPolicy, getRequiredCluster, getRetryPolicy, getShutdownScripts, getSocketOptions, getSpeculativeExecutionPolicy, getStartupScripts, getTimestampGenerator
protected com.datastax.driver.core.Session getRequiredSession()
Session
instance.Session
.IllegalStateException
- if the session factory is not initialized.@Bean public CassandraSessionFactoryBean session()
CassandraSessionFactoryBean
that provides a Cassandra Session
.
The lifecycle of CassandraSessionFactoryBean
initializes the schema
in the
configured keyspace
.@Bean public SessionFactory sessionFactory()
SessionFactory
used to initialize the Template API.@Bean public CassandraConverter cassandraConverter()
CassandraConverter
using the configured cassandraMapping()
. Will apply all specified
customConversions()
.CassandraConverter
used to convert Java and Cassandra value types during the mapping process.cassandraMapping()
,
customConversions()
@Bean public CassandraMappingContext cassandraMapping() throws ClassNotFoundException
MappingContext
instance to map Entities to properties.ClassNotFoundException
- if the Cassandra Entity class type identified by name cannot be found during the
scan.CassandraMappingContext
@Bean public CustomConversions customConversions()
Converter
s in a CustomConversions
object if required. These
CustomConversions
will be registered with the cassandraConverter()
and cassandraMapping()
. Returns an empty CustomConversions
instance by default.protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException
Set
of initial entity classes. Scans by default the class path using
getEntityBasePackages()
. Can be overriden by subclasses to skip class path scanning and return a fixed set
of entity classes.Set
of initial entity classes.ClassNotFoundException
- if the entity scan fails.getEntityBasePackages()
,
CassandraEntityClassScanner
@Bean public CassandraAdminTemplate cassandraTemplate() throws Exception
CassandraAdminTemplate
.Exception
- if the Session
could not be obtained.public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public String[] getEntityBasePackages()
Table
annotations. By default, returns the package name
of this (this.getClass().getPackage().getName()
. This method must never return null.protected abstract String getKeyspaceName()
public SchemaAction getSchemaAction()
SchemaAction
to perform at startup. Defaults to SchemaAction.NONE
.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.