|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.unitils.dbmaintainer.util.BaseDatabaseAccessor
org.unitils.dbmaintainer.version.impl.DefaultExecutedScriptInfoSource
public class DefaultExecutedScriptInfoSource
Implementation of VersionSource that stores the version in the database. The version is stored in the
table whose name is defined by the property PROPERTY_EXECUTED_SCRIPTS_TABLE_NAME. The version index column name is
defined by PROPERTY_FILE_NAME_COLUMN_NAME, the version timestamp colmumn name is defined by
PROPERTY_SCRIPT_VERSION_COLUMN_NAME. The last updated succeeded column name is defined by
PROPERTY_EXECUTED_AT_COLUMN_NAME.
| Field Summary | |
|---|---|
protected boolean |
autoCreateExecutedScriptsTable
True if the scripts table should be created automatically if it does not exist yet |
protected java.lang.String |
checksumColumnName
The name of the database column in which the checksum calculated on the script content is stored |
protected int |
checksumColumnSize
|
protected java.lang.String |
executedAtColumnName
The name of the database column in which the script execution timestamp is stored |
protected int |
executedAtColumnSize
|
protected java.util.Set<ExecutedScript> |
executedScripts
|
protected java.lang.String |
executedScriptsTableName
The name of the database table in which the executed script info is stored |
protected java.lang.String |
fileLastModifiedAtColumnName
The name of the database column in which the file last modification timestamp is stored |
protected java.lang.String |
fileNameColumnName
The name of the database column in which the script name is stored |
protected int |
fileNameColumnSize
|
static java.lang.String |
PROPERTY_AUTO_CREATE_EXECUTED_SCRIPTS_TABLE
|
static java.lang.String |
PROPERTY_CHECKSUM_COLUMN_NAME
|
static java.lang.String |
PROPERTY_CHECKSUM_COLUMN_SIZE
|
static java.lang.String |
PROPERTY_EXECUTED_AT_COLUMN_NAME
|
static java.lang.String |
PROPERTY_EXECUTED_AT_COLUMN_SIZE
|
static java.lang.String |
PROPERTY_EXECUTED_SCRIPTS_TABLE_NAME
|
static java.lang.String |
PROPERTY_FILE_LAST_MODIFIED_AT_COLUMN_NAME
|
static java.lang.String |
PROPERTY_FILE_NAME_COLUMN_NAME
|
static java.lang.String |
PROPERTY_FILE_NAME_COLUMN_SIZE
|
static java.lang.String |
PROPERTY_SCRIPT_VERSION_COLUMN_NAME
|
static java.lang.String |
PROPERTY_SCRIPT_VERSION_COLUMN_SIZE
|
static java.lang.String |
PROPERTY_SUCCEEDED_COLUMN_NAME
|
static java.lang.String |
PROPERTY_TIMESTAMP_FORMAT
|
protected java.lang.String |
succeededColumnName
The name of the database column in which the script name is stored |
protected java.text.DateFormat |
timestampFormat
Format of the contents of the executed_at column |
protected java.lang.String |
versionColumnName
The name of the database column in which the script version is stored |
protected int |
versionColumnSize
|
| Fields inherited from class org.unitils.dbmaintainer.util.BaseDatabaseAccessor |
|---|
configuration, dbSupports, defaultDbSupport, sqlHandler |
| Constructor Summary | |
|---|---|
DefaultExecutedScriptInfoSource()
|
|
| Method Summary | |
|---|---|
protected boolean |
checkExecutedScriptsTable()
Checks if the version table and columns are available and if a record exists in which the version info is stored. |
void |
clearAllExecutedScripts()
Clears all script executions that have been registered. |
protected void |
createExecutedScriptsTable()
Creates the version table and inserts a version record. |
protected void |
doClearAllExecutedScripts()
|
protected java.util.Set<ExecutedScript> |
doGetExecutedScripts()
Precondition: The table dbmaintain_scripts must exist |
protected void |
doInit(java.util.Properties configuration)
Initializes the name of the version table and its columns using the given configuration. |
protected void |
doRegisterExecutedScript(ExecutedScript executedScript)
Registers the fact that the given script has been executed on the database Precondition: The table dbmaintain_scripts must exist |
protected void |
doSaveExecutedScript(ExecutedScript executedScript)
Saves the given registered script Precondition: The table dbmaintain_scripts must exist |
protected void |
doUpdateExecutedScript(ExecutedScript executedScript)
Updates the given registered script Precondition: The table dbmaintain_scripts must exist |
protected java.lang.String |
getCreateExecutedScriptsTableStatement()
|
java.util.Set<ExecutedScript> |
getExecutedScripts()
|
protected boolean |
isExecutedScriptsTableValid()
Checks if the version table and columns are available and if a record exists in which the version info is stored. |
boolean |
isFromScratchUpdateRecommended()
This method returns whether a from scratch update is recommended: It will return true if the database is in it's initial state (i.e. the dbmaintain_scripts table doesn't exist yet or is invalid) and the autoCreateExecutedScriptsTable property is set to true. |
void |
registerExecutedScript(ExecutedScript executedScript)
Registers the fact that the given script has been executed on the database |
void |
updateExecutedScript(ExecutedScript executedScript)
Updates the given registered script |
| Methods inherited from class org.unitils.dbmaintainer.util.BaseDatabaseAccessor |
|---|
getDbSupport, init |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.unitils.dbmaintainer.util.DatabaseAccessing |
|---|
init |
| Field Detail |
|---|
public static final java.lang.String PROPERTY_EXECUTED_SCRIPTS_TABLE_NAME
public static final java.lang.String PROPERTY_FILE_NAME_COLUMN_NAME
public static final java.lang.String PROPERTY_FILE_NAME_COLUMN_SIZE
public static final java.lang.String PROPERTY_SCRIPT_VERSION_COLUMN_NAME
public static final java.lang.String PROPERTY_SCRIPT_VERSION_COLUMN_SIZE
public static final java.lang.String PROPERTY_FILE_LAST_MODIFIED_AT_COLUMN_NAME
public static final java.lang.String PROPERTY_CHECKSUM_COLUMN_NAME
public static final java.lang.String PROPERTY_CHECKSUM_COLUMN_SIZE
public static final java.lang.String PROPERTY_EXECUTED_AT_COLUMN_NAME
public static final java.lang.String PROPERTY_EXECUTED_AT_COLUMN_SIZE
public static final java.lang.String PROPERTY_SUCCEEDED_COLUMN_NAME
public static final java.lang.String PROPERTY_AUTO_CREATE_EXECUTED_SCRIPTS_TABLE
public static final java.lang.String PROPERTY_TIMESTAMP_FORMAT
protected java.util.Set<ExecutedScript> executedScripts
protected java.lang.String executedScriptsTableName
protected java.lang.String fileNameColumnName
protected int fileNameColumnSize
protected java.lang.String versionColumnName
protected int versionColumnSize
protected java.lang.String fileLastModifiedAtColumnName
protected java.lang.String checksumColumnName
protected int checksumColumnSize
protected java.lang.String executedAtColumnName
protected int executedAtColumnSize
protected java.lang.String succeededColumnName
protected boolean autoCreateExecutedScriptsTable
protected java.text.DateFormat timestampFormat
| Constructor Detail |
|---|
public DefaultExecutedScriptInfoSource()
| Method Detail |
|---|
protected void doInit(java.util.Properties configuration)
doInit in class BaseDatabaseAccessorconfiguration - the configuration, not nullpublic boolean isFromScratchUpdateRecommended()
isFromScratchUpdateRecommended in interface ExecutedScriptInfoSourcepublic java.util.Set<ExecutedScript> getExecutedScripts()
getExecutedScripts in interface ExecutedScriptInfoSourceprotected java.util.Set<ExecutedScript> doGetExecutedScripts()
public void registerExecutedScript(ExecutedScript executedScript)
registerExecutedScript in interface ExecutedScriptInfoSourceexecutedScript - The script that was executed on the databaseprotected void doRegisterExecutedScript(ExecutedScript executedScript)
executedScript - The script that was executed on the databasepublic void updateExecutedScript(ExecutedScript executedScript)
updateExecutedScript in interface ExecutedScriptInfoSourceexecutedScript - The script, not nullprotected void doSaveExecutedScript(ExecutedScript executedScript)
executedScript - The script, not nullprotected void doUpdateExecutedScript(ExecutedScript executedScript)
executedScript - The script, not nullpublic void clearAllExecutedScripts()
getExecutedScripts() will return an empty set.
clearAllExecutedScripts in interface ExecutedScriptInfoSourceprotected void doClearAllExecutedScripts()
protected boolean checkExecutedScriptsTable()
protected boolean isExecutedScriptsTableValid()
protected void createExecutedScriptsTable()
protected java.lang.String getCreateExecutedScriptsTableStatement()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||