Class JavaxScriptRunner
java.lang.Object
org.apache.tools.ant.util.ScriptRunnerBase
org.apache.tools.ant.util.optional.JavaxScriptRunner
This class is used to run scripts using JSR 223.
- Since:
- Ant 1.7.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluateScript(String execName) Do the work to eval the script.voidexecuteScript(String execName) Do the work to run the script.Get the name of the manager prefix.booleanCheck if a script engine can be created for this language.Methods inherited from class ScriptRunnerBase
addBean, addBeans, addText, bindToComponent, bindToComponentMinimum, checkLanguage, clearScript, getBeans, getCompiled, getKeepEngine, getLanguage, getProject, getScript, getScriptClassLoader, loadResource, loadResources, replaceContextLoader, restoreContextLoader, setCompiled, setEncoding, setKeepEngine, setLanguage, setProject, setScriptClassLoader, setSrcModifier and TypeMethodDescriptionvoidAdd a single object into the script context.voidAdd a list of named objects to the list to be exported to the scriptvoidSet the script text.voidbindToComponent(ProjectComponent component) Bind the runner to a project component.voidbindToComponentMinimum(ProjectComponent component) Bind the runner to a project component.protected voidCheck if the language attribute is set.voidClear the current script text content.getBeans()Get the beans used for the script.final booleanGet the compiled attribute.booleanGet the keep engine attribute.Get the script languageGet the project for this runner.Get the current script text content.protected ClassLoaderGet the classloader used to load the script engine.voidloadResource(Resource sourceResource) Add a resource to the source list.voidloadResources(ResourceCollection collection) Add all resources in a resource collection to the source list.protected ClassLoaderReplace the current context classloader with the script context classloader.protected voidrestoreContextLoader(ClassLoader origLoader) Restore the context loader with the original context classloader.final voidsetCompiled(boolean compiled) Whether to use script compilation if available.voidsetEncoding(String encoding) Set encoding of the script from an external file; optional.voidsetKeepEngine(boolean keepEngine) Whether to keep the script engine between calls.voidsetLanguage(String language) Defines the language (required).voidsetProject(Project project) Set the project for this runner.voidsetScriptClassLoader(ClassLoader classLoader) Set the script classloader.voidLoad the script from an external file; optional.
-
Constructor Details
-
JavaxScriptRunner
public JavaxScriptRunner()
-
-
Method Details
-
getManagerName
Get the name of the manager prefix.- Specified by:
getManagerNamein classScriptRunnerBase- Returns:
- "javax"
-
supportsLanguage
public boolean supportsLanguage()Check if a script engine can be created for this language..- Specified by:
supportsLanguagein classScriptRunnerBase- Returns:
- true if a script engine can be created, false otherwise.
-
executeScript
Do the work to run the script.- Specified by:
executeScriptin classScriptRunnerBase- Parameters:
execName- the name that will be passed to the scripting engine for this script execution.- Throws:
BuildException- if something goes wrong executing the script.
-
evaluateScript
Do the work to eval the script.- Specified by:
evaluateScriptin classScriptRunnerBase- Parameters:
execName- the name that will be passed to the scripting engine for this script execution.- Returns:
- the result of the evaluation
- Throws:
BuildException- if something goes wrong executing the script.
-