org.unitils.dbmaintainer.script.impl.ResourceScriptSource Maven / Gradle / Ivy
package org.unitils.dbmaintainer.script.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.unitils.dbmaintainer.locator.ClassPathScriptLocator;
import org.unitils.dbmaintainer.locator.resourcepickingstrategie.ResourcePickingStrategie;
import org.unitils.dbmaintainer.locator.resourcepickingstrategie.impl.UniqueMostRecentPickingStrategie;
import org.unitils.dbmaintainer.script.Script;
import org.unitils.util.PropertyUtils;
/**
* Implementation of {@link ScriptSource} that reads script files from the classpath.
*
*
* Wildcards in naming are allowed. When looking through the classpath it will use the {@link 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 {@link #PROPKEY_SCRIPT_LOCATIONS}. Valid script files start with a version number followed by an underscore, and
* end with the extension configured by {@link #PROPKEY_SCRIPT_EXTENSIONS}.
*
* @author Thomas De Rycke
* @author Jef Verelst
*
* @since 1.0.2
*
*/
public class ResourceScriptSource extends DefaultScriptSource {
private static final Log LOGGER = LogFactory.getLog(ResourceScriptSource.class);
/** */
public ResourceScriptSource() {
}
/**
*
* @see org.unitils.dbmaintainer.script.impl.DefaultScriptSource#loadAllScripts()
*/
@Override
protected List