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 aCompositeKeyspacePopulatorwith the given populators.CompositeKeyspacePopulator(KeyspacePopulator... populators) Create aCompositeKeyspacePopulatorwith the given populators. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPopulators(KeyspacePopulator... populators) Add one or more populators to the list of delegates.voidpopulate(com.datastax.oss.driver.api.core.CqlSession session) Populate, initialize, or clean up the database using the provided CqlSession connection.voidsetPopulators(KeyspacePopulator... populators) Specify one or more populators to delegate to.
-
Constructor Details
-
CompositeKeyspacePopulator
public CompositeKeyspacePopulator()Create an emptyCompositeKeyspacePopulator. -
CompositeKeyspacePopulator
Create aCompositeKeyspacePopulatorwith the given populators.- Parameters:
populators- one or more populators to delegate to.
-
CompositeKeyspacePopulator
Create aCompositeKeyspacePopulatorwith 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:KeyspacePopulatorPopulate, initialize, or clean up the database using the provided CqlSession connection.Concrete implementations may throw a
RuntimeExceptionif an error is encountered but are strongly encouraged to throw a specificScriptExceptioninstead. For example, Spring'sResourceKeyspacePopulatorwrap all exceptions inScriptExceptions.- Specified by:
populatein interfaceKeyspacePopulator- Parameters:
session- the CQLCqlSessionto use to populate the keyspace; already configured and ready to use; never null- Throws:
ScriptException- in all other error cases
-