public class ScriptConfiguredToolRunner extends Object
ScriptConfiguredTools.
ScriptRunner can be used to run classes implementing
ScriptConfiguredRunner interface. It works in conjunction with
jsr-223 to allow a script to be used to configure the ScriptConfiguredTool.
By default java has a scripting engine for javascript. Groovy script can be added by using the following maven dependency.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-jsr223</artifactId>
<version>2.3.7</version>
</dependency>
And python support can be added using the following maven dependency.
<dependency>
<groupId>org.python</groupId>
<artifactId>jython</artifactId>
<version>2.5.3</version>
</dependency>
ScriptConfiguredTool| Modifier and Type | Method and Description |
|---|---|
static <C> int |
run(File scriptFile,
ScriptConfiguredTool<C> tool)
Runs the given
ScriptedTool by calling ScriptConfiguredTool#run(C), after
creating the configuration from the script in the scriptFile. |
static <C> int |
run(File scriptFile,
ScriptConfiguredTool<C> tool,
String[] args)
Runs the given
ScriptedTool by calling ScriptConfiguredTool#run(C), after
creating the configuration from the script in the scriptFile. |
static <C> int |
run(String[] args,
ScriptConfiguredTool<C> tool)
Runs the given
ScriptedTool by calling ScriptConfiguredTool#run(C), after
creating the configuration from the script in the scriptFile. |
public static <C> int run(String[] args, ScriptConfiguredTool<C> tool) throws Exception
ScriptedTool by calling ScriptConfiguredTool#run(C), after
creating the configuration from the script in the scriptFile. The args are set as a script variable called args.args - the arguments. the first argument has to contains the path to the script file. The remaining arguments are
passed to the scrip as the args scripting variabletool - ScriptTool to runScriptConfiguredTool.run(Object) method.FileNotFoundException - if the script file cannot be foundScriptException - if the script cannot be compiledExceptionpublic static <C> int run(File scriptFile, ScriptConfiguredTool<C> tool) throws Exception
ScriptedTool by calling ScriptConfiguredTool#run(C), after
creating the configuration from the script in the scriptFile.scriptFile - the file containing the scripttool - ScriptTool to runScriptConfiguredTool.run(Object) method.FileNotFoundException - if the script file cannot be foundScriptException - if the script cannot be compiledExceptionpublic static <C> int run(File scriptFile, ScriptConfiguredTool<C> tool, String[] args) throws Exception
ScriptedTool by calling ScriptConfiguredTool#run(C), after
creating the configuration from the script in the scriptFile. The args are set as a script variable called args.scriptFile - the file containing the scripttool - ScriptTool to runargs - the arguments to set as the args script variableScriptConfiguredTool.run(Object) method.FileNotFoundException - if the script file cannot be foundScriptException - if the script cannot be compiledExceptionCopyright © 2016. All Rights Reserved.