org.unitils.dbmaintainer.script.impl
Class ResourceScriptSource

java.lang.Object
  extended by org.unitils.core.util.BaseConfigurable
      extended by org.unitils.dbmaintainer.script.impl.DefaultScriptSource
          extended by org.unitils.dbmaintainer.script.impl.ResourceScriptSource
All Implemented Interfaces:
Configurable, ScriptSource

public class ResourceScriptSource
extends DefaultScriptSource

Implementation of ScriptSource that reads script files from the classpath.

Wildcards in naming are allowed. When looking through the classpath it will use the PathMatchingResourcePatternResolver provided by Spring.

When finding multiple files that have the same name the system will take te most recent one. Script files should be located in the package configured by DefaultScriptSource.PROPKEY_SCRIPT_LOCATIONS. Valid script files start with a version number followed by an underscore, and end with the extension configured by DefaultScriptSource.PROPKEY_SCRIPT_EXTENSIONS.

Since:
1.0.2
Author:
Thomas De Rycke, Jef Verelst

Field Summary
 
Fields inherited from class org.unitils.dbmaintainer.script.impl.DefaultScriptSource
allPostProcessingScripts, allUpdateScripts, PROPKEY_POSTPROCESSINGSCRIPT_DIRNAME, PROPKEY_SCRIPT_EXTENSIONS, PROPKEY_SCRIPT_LOCATIONS, PROPKEY_USESCRIPTFILELASTMODIFICATIONDATES
 
Fields inherited from class org.unitils.core.util.BaseConfigurable
configuration
 
Constructor Summary
ResourceScriptSource()
           
 
Method Summary
protected  ResourcePickingStrategie getResourcePickingStrategie()
          use unitil propertie instead of hardcoding
protected  void getScriptsAt(List<Script> scripts, String scriptRoot, String relativeLocation)
          Adds all scripts available in the given directory or one of its subdirectories to the given List of files
protected  List<Script> loadAllScripts(String dialect)
           
 
Methods inherited from class org.unitils.dbmaintainer.script.impl.DefaultScriptSource
assertNoDuplicateIndexes, convertToScriptNameScriptMap, createScript, getAllUpdateScripts, getIncrementalScripts, getNewScripts, getPostProcessingScripts, getScriptExtensions, isExistingIndexedScriptModified, isPostProcessingScript, isScriptFile, loadAndOrganizeAllScripts, useScriptFileLastModificationDates
 
Methods inherited from class org.unitils.core.util.BaseConfigurable
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.core.util.Configurable
init
 

Constructor Detail

ResourceScriptSource

public ResourceScriptSource()
Method Detail

loadAllScripts

protected List<Script> loadAllScripts(String dialect)
Overrides:
loadAllScripts in class DefaultScriptSource
Returns:
A List containing all scripts in the given script locations, not null
See Also:
org.unitils.dbmaintainer.script.impl.DefaultScriptSource#loadAllScripts()

getScriptsAt

protected void getScriptsAt(List<Script> scripts,
                            String scriptRoot,
                            String relativeLocation)
Description copied from class: DefaultScriptSource
Adds all scripts available in the given directory or one of its subdirectories to the given List of files

Overrides:
getScriptsAt in class DefaultScriptSource
See Also:
DefaultScriptSource.getScriptsAt(java.util.List, java.lang.String, java.lang.String)

getResourcePickingStrategie

protected ResourcePickingStrategie getResourcePickingStrategie()
use unitil propertie instead of hardcoding

Returns:


Copyright © 2014. All Rights Reserved.