Class AbstractDatabaseVersionService

  • Direct Known Subclasses:
    DatabaseVersionService

    public abstract class AbstractDatabaseVersionService
    extends Object
    Provides an abstract Database version management service.
    • Field Detail

      • DATABASE_PRODUCT_MYSQL

        public static final String DATABASE_PRODUCT_MYSQL
        The database product for MySQL
        See Also:
        Constant Field Values
      • DATABASE_PRODUCT_ORACLE

        public static final String DATABASE_PRODUCT_ORACLE
        The database product for Oracle
        See Also:
        Constant Field Values
      • DATABASE_PRODUCT_SQLSERVER

        public static final String DATABASE_PRODUCT_SQLSERVER
        The database product for MS SQL Server without Unicode support
        See Also:
        Constant Field Values
      • DATABASE_PRODUCT_SQLSERVER_UNICODE

        public static final String DATABASE_PRODUCT_SQLSERVER_UNICODE
        The database product for MS SQL Server with Unicode support
        See Also:
        Constant Field Values
      • LOG_DIRECTORY_RELATIVE

        protected static final String LOG_DIRECTORY_RELATIVE
      • logger

        protected org.slf4j.Logger logger
    • Constructor Detail

      • AbstractDatabaseVersionService

        public AbstractDatabaseVersionService()
    • Method Detail

      • performUpdate

        public void performUpdate​(File appserverDirectory,
                                  boolean debugFlag)
        Perform database schema and data migration update.
        Parameters:
        appserverDirectory - the application server directory, used to determine log file path
        debugFlag - specify whether to perform debug logging
      • performUpdate

        public void performUpdate​(File appserverDirectory,
                                  Set<Integer> skipVersions,
                                  boolean debugFlag)
        Perform database schema and data migration update, with option to skip version execution. Note: usage of that method is preferred for unit testing.
        Parameters:
        appserverDirectory - the application server directory, used to determine log file path
        skipVersions - skip execution of those versions
        debugFlag - specify whether to perform debug logging
        Since:
        19.11.0
      • getJndiName

        protected abstract String getJndiName()
      • getHistoryJndiName

        protected abstract String getHistoryJndiName()
      • getVersionUpdateEntityName

        protected abstract String getVersionUpdateEntityName()
      • getCurrentDatabaseVersions

        protected abstract List<Integer> getCurrentDatabaseVersions()
      • getDatabaseProduct

        protected abstract String getDatabaseProduct()
      • getCurrentDatabaseReleaseVersions

        protected abstract List<String> getCurrentDatabaseReleaseVersions()
      • createVersionUpdate

        protected abstract void createVersionUpdate​(org.apache.cayenne.access.DataContext dataContext,
                                                    Element updateElement,
                                                    int rowsUpdated,
                                                    String updatePerformed,
                                                    Date finishTime,
                                                    long updateDuration)
                                             throws SQLException
        Throws:
        SQLException
      • fail

        protected void fail​(String message)
      • getLogFileLocation

        protected String getLogFileLocation​(File appserverDirectory)