Class CassandraAdminTemplate

java.lang.Object
org.springframework.data.cassandra.core.CassandraTemplate
org.springframework.data.cassandra.core.CassandraAdminTemplate
All Implemented Interfaces:
Aware, ApplicationContextAware, ApplicationEventPublisherAware, CassandraAdminOperations, CassandraOperations, ExecutableDeleteOperation, ExecutableInsertOperation, ExecutableSelectOperation, ExecutableUpdateOperation, FluentCassandraOperations

public class CassandraAdminTemplate extends CassandraTemplate implements CassandraAdminOperations
Default implementation of CassandraAdminOperations.
Author:
Mark Paluch, Fabio J. Mendes, John Blum, Vagif Zeynalov, Mikhail Polivakha
  • Field Details

    • DEFAULT_DROP_TABLE_IF_EXISTS

      protected static final boolean DEFAULT_DROP_TABLE_IF_EXISTS
      See Also:
  • Constructor Details

    • CassandraAdminTemplate

      public CassandraAdminTemplate(com.datastax.oss.driver.api.core.CqlSession session)
      Constructor used for a basic template configuration.
      Parameters:
      session - must not be null.
      Since:
      2.2
    • CassandraAdminTemplate

      public CassandraAdminTemplate(com.datastax.oss.driver.api.core.CqlSession session, CassandraConverter converter)
      Constructor used for a basic template configuration.
      Parameters:
      session - must not be null.
      converter - must not be null.
    • CassandraAdminTemplate

      public CassandraAdminTemplate(SessionFactory sessionFactory, CassandraConverter converter)
      Constructor used for a basic template configuration.
      Parameters:
      sessionFactory - must not be null.
      converter - must not be null.
    • CassandraAdminTemplate

      public CassandraAdminTemplate(CqlOperations cqlOperations, CassandraConverter converter)
      Constructor used for a basic template configuration.
      Parameters:
      cqlOperations - must not be null.
      converter - must not be null.
      Since:
      2.2
  • Method Details

    • getSchemaFactory

      public SchemaFactory getSchemaFactory()
      Specified by:
      getSchemaFactory in interface CassandraAdminOperations
      Returns:
      the SchemaFactory.
    • createTable

      public void createTable(boolean ifNotExists, com.datastax.oss.driver.api.core.CqlIdentifier tableName, Class<?> entityClass, Map<String,Object> optionsByName)
      Description copied from interface: CassandraAdminOperations
      Create a table with the name given and fields corresponding to the given class. If the table already exists and parameter ifNotExists is true, this is a no-op and false is returned. If the table doesn't exist, parameter ifNotExists is ignored, the table is created and true is returned.
      Specified by:
      createTable in interface CassandraAdminOperations
      Parameters:
      ifNotExists - if true, create the table only if it doesn't exist.
      tableName - the name of the table.
      entityClass - the class whose fields determine the columns created.
      optionsByName - table options, given by the string option name and the appropriate option value.
    • dropTable

      public void dropTable(Class<?> entityClass)
      Description copied from interface: CassandraAdminOperations
      Drops a table based on the given entity type. The name of the table is derived from either the simple name of the entity class or name of the table specified with the Table mapping annotation.
      Specified by:
      dropTable in interface CassandraAdminOperations
      Parameters:
      entityClass - type of the entity for which the table will be dropped.
    • dropTable

      public void dropTable(com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Description copied from interface: CassandraAdminOperations
      Drops the named table.
      Specified by:
      dropTable in interface CassandraAdminOperations
      Parameters:
      tableName - Name of the table to drop.
      See Also:
    • dropTable

      public void dropTable(boolean ifExists, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Description copied from interface: CassandraAdminOperations
      Drops the named table.
      Specified by:
      dropTable in interface CassandraAdminOperations
      Parameters:
      ifExists - if true, drop the table only if it exists.
      tableName - Name of the table to drop.
    • dropUserType

      public void dropUserType(com.datastax.oss.driver.api.core.CqlIdentifier typeName)
      Description copied from interface: CassandraAdminOperations
      Drops a user type.
      Specified by:
      dropUserType in interface CassandraAdminOperations
      Parameters:
      typeName - must not be null.
    • getTableMetadata

      public Optional<com.datastax.oss.driver.api.core.metadata.schema.TableMetadata> getTableMetadata(com.datastax.oss.driver.api.core.CqlIdentifier keyspace, com.datastax.oss.driver.api.core.CqlIdentifier tableName)
      Description copied from interface: CassandraAdminOperations
      Lookup TableMetadata.
      Specified by:
      getTableMetadata in interface CassandraAdminOperations
      Parameters:
      keyspace - must not be null.
      tableName - must not be null.
      Returns:
      the TableMetadata or null.
    • getKeyspaceMetadata

      public com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata getKeyspaceMetadata()
      Description copied from interface: CassandraAdminOperations
      Returns KeyspaceMetadata for the current keyspace.
      Specified by:
      getKeyspaceMetadata in interface CassandraAdminOperations
      Returns:
      KeyspaceMetadata for the current keyspace.