org.dbmaintain.script
Class ScriptFactory
java.lang.Object
org.dbmaintain.script.ScriptFactory
public class ScriptFactory
- extends Object
- Author:
- Tim Ducheyne, Filip Neven
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
baseLineRevision
protected ScriptIndexes baseLineRevision
ScriptFactory
public ScriptFactory(String scriptIndexRegexp,
String targetDatabaseRegexp,
String qualifierRegexp,
Set<Qualifier> registeredQualifiers,
Set<Qualifier> patchQualifiers,
String postProcessingScriptDirName,
ScriptIndexes baseLineRevision)
createScriptWithContent
public Script createScriptWithContent(String fileName,
Long fileLastModifiedAt,
ScriptContentHandle scriptContentHandle)
createScriptWithoutContent
public Script createScriptWithoutContent(String fileName,
Long fileLastModifiedAt,
String checkSum)
isPostProcessingScript
protected boolean isPostProcessingScript(String fileName)
- Parameters:
fileName
- The script file name, not null
- Returns:
- True if the given script name is a post processing script
getTargetDatabaseName
protected String getTargetDatabaseName(String[] pathParts)
- Resolves the target database name from the given list of tokens
E.g. 01_@databaseA_myscript.sql
If the file name consists out of multiple path-parts, the last found target database is used
E.g. 01_@database1/01_@database2_myscript.sql
will return database2
- Parameters:
pathParts
- The file path split up in tokens, not null
- Returns:
- The target database name, null if none found
getQualifiers
protected Set<Qualifier> getQualifiers(String[] pathParts)
getScriptIndexes
protected ScriptIndexes getScriptIndexes(String[] pathParts)
- Creates a version by extracting the indexes from the the given script file name.
- Parameters:
pathParts
- The file path split up in tokens, not null
- Returns:
- The version of the script file, not null
getTokens
protected List<String> getTokens(String[] pathParts,
Pattern pattern,
boolean addNullIfNoMatch)
getPathParts
protected String[] getPathParts(String fileName)
isIgnored
protected boolean isIgnored(ScriptIndexes scriptIndexes)
- Parameters:
scriptIndexes
- The revision of the script, not null
- Returns:
- True if a baseline revision was set and the revision of the script was below the baseline
isPatchScript
public boolean isPatchScript(Set<Qualifier> qualifiers)
- Parameters:
qualifiers
- a set of script qualifiers, not null
- Returns:
- True if there is a patch qualifier
Copyright © 2011. All Rights Reserved.