org.dbmaintain.launch.ant
Class CheckScriptUpdatesAntTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.dbmaintain.launch.ant.BaseAntTask
              extended by org.dbmaintain.launch.ant.BaseDatabaseAntTask
                  extended by org.dbmaintain.launch.ant.CheckScriptUpdatesAntTask

public class CheckScriptUpdatesAntTask
extends BaseDatabaseAntTask

Performs a dry run of the database update. May be used to verify if there are any updates or in a test that fails if it appears that an irregular script update was performed.

Author:
Filip Neven, Tim Ducheyne

Field Summary
 
Fields inherited from class org.dbmaintain.launch.ant.BaseDatabaseAntTask
databases
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
CheckScriptUpdatesAntTask()
           
 
Method Summary
protected  DbMaintainTask createDbMaintainTask()
           
 void setAllowOutOfSequenceExecutionOfPatches(boolean allowOutOfSequenceExecutionOfPatches)
          If this property is set to true, a patch script is allowed to be executed even if another script with a higher index was already executed.
 void setAutoCreateDbMaintainScriptsTable(boolean autoCreateDbMaintainScriptsTable)
          Sets the autoCreateDbMaintainScriptsTable property.
 void setExcludedQualifiers(String excludedQualifiers)
          Optional comma-separated list of script qualifiers.
 void setFromScratchEnabled(boolean fromScratchEnabled)
          Sets the fromScratchEnabled property, that indicates the database can be recreated from scratch if needed.
 void setIncludedQualifiers(String includedQualifiers)
          Optional comma-separated list of script qualifiers.
 void setPatchQualifiers(String patchQualifiers)
          The qualifiers to use to determine whether a script is a patch script.
 void setPostProcessingScriptDirectoryName(String postProcessingScriptDirectoryName)
          Comma separated list of directories and files in which the post processing database scripts are located.
 void setQualifiers(String qualifiers)
          Optional comma-separated list of script qualifiers.
 void setScriptEncoding(String scriptEncoding)
          Encoding to use when reading the script files.
 void setScriptFileExtensions(String scriptFileExtensions)
          Sets the scriptFileExtensions property, that defines the extensions of the files that are regarded to be database scripts.
 void setScriptLocations(String scriptLocations)
          Defines where the scripts can be found that must be executed on the database.
 void setUseLastModificationDates(boolean useLastModificationDates)
          Defines whether the last modification dates of the scripts files can be used to determine whether the contents of a script has changed.
 
Methods inherited from class org.dbmaintain.launch.ant.BaseDatabaseAntTask
addDatabase, getDbMaintainDatabases
 
Methods inherited from class org.dbmaintain.launch.ant.BaseAntTask
execute, getAntProperties, getCustomConfigFile, setConfigFile
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckScriptUpdatesAntTask

public CheckScriptUpdatesAntTask()
Method Detail

createDbMaintainTask

protected DbMaintainTask createDbMaintainTask()
Specified by:
createDbMaintainTask in class BaseAntTask

setScriptLocations

public void setScriptLocations(String scriptLocations)
Defines where the scripts can be found that must be executed on the database. Multiple locations may be configured, separated by comma's. A script location can be a folder or a jar file. This property is required.

Parameters:
scriptLocations - Comma separated list of script locations

setScriptEncoding

public void setScriptEncoding(String scriptEncoding)
Encoding to use when reading the script files. Defaults to ISO-8859-1

Parameters:
scriptEncoding - The encoding

setPostProcessingScriptDirectoryName

public void setPostProcessingScriptDirectoryName(String postProcessingScriptDirectoryName)
Comma separated list of directories and files in which the post processing database scripts are located. Directories in this list are recursively search for files. Defaults to postprocessing

Parameters:
postProcessingScriptDirectoryName - The directory names

setFromScratchEnabled

public void setFromScratchEnabled(boolean fromScratchEnabled)
Sets the fromScratchEnabled property, that indicates the database can be recreated from scratch if needed. From-scratch recreation is needed in following cases: If set to false, the DbMaintainer will give an error if one of these situations occurs. The default is false.

Parameters:
fromScratchEnabled - True if the database can be updated from scratch.

setAutoCreateDbMaintainScriptsTable

public void setAutoCreateDbMaintainScriptsTable(boolean autoCreateDbMaintainScriptsTable)
Sets the autoCreateDbMaintainScriptsTable property. If set to true, the table DBMAINTAIN_SCRIPTS will be created automatically if it does not exist yet. If false, an exception is thrown, indicating how to create the table manually. False by default.

Parameters:
autoCreateDbMaintainScriptsTable - True if the DBMAINTAIN_SCRIPTS table can be created automatically

setAllowOutOfSequenceExecutionOfPatches

public void setAllowOutOfSequenceExecutionOfPatches(boolean allowOutOfSequenceExecutionOfPatches)
If this property is set to true, a patch script is allowed to be executed even if another script with a higher index was already executed.

Parameters:
allowOutOfSequenceExecutionOfPatches - true if out-of-sequence execution of patches is enabled

setQualifiers

public void setQualifiers(String qualifiers)
Optional comma-separated list of script qualifiers. All custom qualifiers that are used in script file names must be declared.

Parameters:
qualifiers - the registered (allowed) script qualifiers

setPatchQualifiers

public void setPatchQualifiers(String patchQualifiers)
The qualifiers to use to determine whether a script is a patch script. Defaults to patch. E.g. 01_#patch_myscript.sql

Parameters:
patchQualifiers - The patch qualifiers

setIncludedQualifiers

public void setIncludedQualifiers(String includedQualifiers)
Optional comma-separated list of script qualifiers. All included qualifiers must be registered using the qualifiers property. Only scripts which are qualified with one of the included qualifiers will be executed.

Parameters:
includedQualifiers - the included script qualifiers

setExcludedQualifiers

public void setExcludedQualifiers(String excludedQualifiers)
Optional comma-separated list of script qualifiers. All excluded qualifiers must be registered using the qualifiers property. Scripts qualified with one of the excluded qualifiers will not be executed.

Parameters:
excludedQualifiers - the excluded script qualifiers

setScriptFileExtensions

public void setScriptFileExtensions(String scriptFileExtensions)
Sets the scriptFileExtensions property, that defines the extensions of the files that are regarded to be database scripts. The extensions should not start with a dot. The default is 'sql,ddl'.

Parameters:
scriptFileExtensions - Comma separated list of file extensions.

setUseLastModificationDates

public void setUseLastModificationDates(boolean useLastModificationDates)
Defines whether the last modification dates of the scripts files can be used to determine whether the contents of a script has changed. If set to true, DbMaintain will not look at the contents of scripts that were already executed on the database, if the last modification date is still the same. If it did change, it will first calculate the checksum of the file to verify that the content really changed. Setting this property to true improves performance: if set to false the checksum of every script must be calculated for each run. True by default.

Parameters:
useLastModificationDates - True if script file last modification dates can be used.


Copyright © 2011. All Rights Reserved.