Class DatabaseUtil

java.lang.Object
org.duracloud.common.util.DatabaseUtil

public abstract class DatabaseUtil extends Object
 This abstract class provides the ability to create/clear/remove a database
 and its tables.
 It also provides a 'javax.sql.DataSource' for the database.
 Finally, sql operations can be executed on the database through the retrieval
 of the 'JdbcOperations' object provided by the method: getOps().
 
Author:
Andrew Woods
  • Field Details

    • log

      protected final org.slf4j.Logger log
    • NOT_ENCRYPTED

      public static String NOT_ENCRYPTED
  • Constructor Details

  • Method Details

    • getTableSpecs

      protected abstract List<TableSpec> getTableSpecs()
    • initializeDB

      public void initializeDB() throws Exception
      This method sets-up empty tables for this database.
      Throws:
      Exception
    • ensureDatabaseExists

      public void ensureDatabaseExists()
    • ensureTablesExist

      public void ensureTablesExist() throws SQLException
      Throws:
      SQLException
    • clearDB

      public void clearDB()
    • disconnect

      public void disconnect()
    • getSimpleJdbcTemplate

      public org.springframework.jdbc.core.JdbcTemplate getSimpleJdbcTemplate()
    • getDataSource

      public DataSource getDataSource()
    • getOps

      public org.springframework.jdbc.core.JdbcOperations getOps()
    • execute

      protected void execute(String sql)