Class AbstractDatabaseVersionService
- java.lang.Object
-
- com.avoka.core.service.initialization.AbstractDatabaseVersionService
-
- Direct Known Subclasses:
DatabaseVersionService
public abstract class AbstractDatabaseVersionService extends Object
Provides an abstract Database version management service.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringATTRIBUTE_IGNORE_ERRORSstatic StringDATABASE_PRODUCT_MYSQLThe database product for MySQLstatic StringDATABASE_PRODUCT_ORACLEThe database product for Oraclestatic StringDATABASE_PRODUCT_SQLSERVERThe database product for MS SQL Server without Unicode supportstatic StringDATABASE_PRODUCT_SQLSERVER_UNICODEThe database product for MS SQL Server with Unicode supportprotected static StringDATETIME_FORMATprotected static StringDB_VERSION_FILE_NAMEprotected static StringLOG_DIRECTORY_RELATIVEprotected org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description AbstractDatabaseVersionService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcreateVersionUpdate(org.apache.cayenne.access.DataContext dataContext, Element updateElement, int rowsUpdated, String updatePerformed, Date finishTime, long updateDuration)protected voidfail(String message)protected abstract List<Integer>getCurrentDatabaseVersions()protected abstract StringgetDatabaseProduct()protected abstract StringgetHistoryJndiName()protected abstract StringgetJndiName()protected StringgetLogFileLocation(File appserverDirectory)protected abstract StringgetVersionUpdateEntityName()voidperformUpdate(File appserverDirectory, boolean debugFlag)Perform database schema and data migration update.voidperformUpdate(File appserverDirectory, Set<Integer> skipVersions, boolean debugFlag)Perform database schema and data migration update, with option to skip version execution.
-
-
-
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
-
DB_VERSION_FILE_NAME
protected static final String DB_VERSION_FILE_NAME
- See Also:
- Constant Field Values
-
DATETIME_FORMAT
protected static final String DATETIME_FORMAT
- See Also:
- Constant Field Values
-
ATTRIBUTE_IGNORE_ERRORS
protected static final String ATTRIBUTE_IGNORE_ERRORS
- See Also:
- Constant Field Values
-
logger
protected org.slf4j.Logger logger
-
-
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 pathdebugFlag- 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 pathskipVersions- skip execution of those versionsdebugFlag- 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()
-
getDatabaseProduct
protected abstract String getDatabaseProduct()
-
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)
-
-