Class CompositeKeyspacePopulator
java.lang.Object
org.springframework.data.cassandra.core.cql.session.init.CompositeKeyspacePopulator
- All Implemented Interfaces:
KeyspacePopulator
Composite
KeyspacePopulator
that delegates to a list of given KeyspacePopulator
implementations,
executing all scripts.- Since:
- 3.0
- Author:
- Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an emptyCompositeKeyspacePopulator
.CompositeKeyspacePopulator
(Collection<KeyspacePopulator> populators) Create aCompositeKeyspacePopulator
with the given populators.CompositeKeyspacePopulator
(KeyspacePopulator... populators) Create aCompositeKeyspacePopulator
with the given populators. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPopulators
(KeyspacePopulator... populators) Add one or more populators to the list of delegates.void
populate
(com.datastax.oss.driver.api.core.CqlSession session) Populate, initialize, or clean up the database using the provided CqlSession connection.void
setPopulators
(KeyspacePopulator... populators) Specify one or more populators to delegate to.
-
Constructor Details
-
CompositeKeyspacePopulator
public CompositeKeyspacePopulator()Create an emptyCompositeKeyspacePopulator
. -
CompositeKeyspacePopulator
Create aCompositeKeyspacePopulator
with the given populators.- Parameters:
populators
- one or more populators to delegate to.
-
CompositeKeyspacePopulator
Create aCompositeKeyspacePopulator
with the given populators.- Parameters:
populators
- one or more populators to delegate to.
-
-
Method Details
-
setPopulators
Specify one or more populators to delegate to. -
addPopulators
Add one or more populators to the list of delegates. -
populate
Description copied from interface:KeyspacePopulator
Populate, initialize, or clean up the database using the provided CqlSession connection.Concrete implementations may throw a
RuntimeException
if an error is encountered but are strongly encouraged to throw a specificScriptException
instead. For example, Spring'sResourceKeyspacePopulator
wrap all exceptions inScriptExceptions
.- Specified by:
populate
in interfaceKeyspacePopulator
- Parameters:
session
- the CQLCqlSession
to use to populate the keyspace; already configured and ready to use; never null- Throws:
ScriptException
- in all other error cases
-