Search in sources :

Example 1 with CassandraAdminOperations

use of org.springframework.data.cassandra.core.CassandraAdminOperations in project spring-data-cassandra by spring-projects.

the class SessionFactoryFactoryBean method performSchemaActions.

@SuppressWarnings("all")
private void performSchemaActions(boolean drop, boolean dropUnused, boolean ifNotExists) throws Exception {
    CassandraAdminOperations adminOperations = new CassandraAdminTemplate(getObject(), this.converter);
    CassandraPersistentEntitySchemaCreator schemaCreator = new CassandraPersistentEntitySchemaCreator(this.converter.getMappingContext(), adminOperations);
    if (drop) {
        CassandraPersistentEntitySchemaDropper schemaDropper = new CassandraPersistentEntitySchemaDropper(this.converter.getMappingContext(), adminOperations);
        schemaDropper.dropTables(dropUnused);
        schemaDropper.dropUserTypes(dropUnused);
    }
    schemaCreator.createUserTypes(ifNotExists);
    schemaCreator.createTables(ifNotExists);
    schemaCreator.createIndexes(ifNotExists);
}
Also used : CassandraPersistentEntitySchemaDropper(org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaDropper) CassandraAdminOperations(org.springframework.data.cassandra.core.CassandraAdminOperations) CassandraAdminTemplate(org.springframework.data.cassandra.core.CassandraAdminTemplate) CassandraPersistentEntitySchemaCreator(org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaCreator)

Aggregations

CassandraAdminOperations (org.springframework.data.cassandra.core.CassandraAdminOperations)1 CassandraAdminTemplate (org.springframework.data.cassandra.core.CassandraAdminTemplate)1 CassandraPersistentEntitySchemaCreator (org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaCreator)1 CassandraPersistentEntitySchemaDropper (org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaDropper)1