@Plugin(name="ScriptCondition", category="Core", printObject=true) public class ScriptCondition extends Object
DeleteAction
where a user-provided script selects the files to delete from a provided
list. The specified script may be a Script
, a ScriptFile
or a ScriptRef
.Constructor and Description |
---|
ScriptCondition(AbstractScript script,
Configuration configuration)
Constructs a new ScriptCondition.
|
Modifier and Type | Method and Description |
---|---|
static ScriptCondition |
createCondition(AbstractScript script,
Configuration configuration)
Creates the ScriptCondition.
|
List<PathWithAttributes> |
selectFilesToDelete(Path basePath,
List<PathWithAttributes> candidates)
Executes the script
|
public ScriptCondition(AbstractScript script, Configuration configuration)
script
- the script that can select files to deleteconfiguration
- configuration containing the StrSubstitutor passed to the scriptpublic List<PathWithAttributes> selectFilesToDelete(Path basePath, List<PathWithAttributes> candidates)
baseDir
- candidates
- @PluginFactory public static ScriptCondition createCondition(@PluginElement(value="Script") AbstractScript script, @PluginConfiguration Configuration configuration)
script
- The script to run. This may be a Script
, a ScriptFile
or a ScriptRef
. The
script must return a List<PathWithAttributes>
. When the script is executed, it is provided the
following bindings:
Delete
action started scanning for
files to delete. Can be used to relativize the paths in the pathList.java.util.List
containing PathWithAttribute
objects. (The script is
free to modify and return this list.)StrSubstitutor
that can be used to look up variables embedded in the base
dir or other properties
StatusLogger
that can be used to log events during script execution
configuration
- the configurationCopyright © 1999-2019 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.