org.apache.tools.ant.util
public abstract class ScriptRunnerBase extends Object
Since: Ant 1.7.0
Method Summary | |
---|---|
void | addBean(String key, Object bean)
Add a single object into the script context.
|
void | addBeans(Map dictionary)
Add a list of named objects to the list to be exported to the script
|
void | addText(String text)
Set the script text. |
void | bindToComponent(ProjectComponent component)
Bind the runner to a project component.
|
void | bindToComponentMinimum(ProjectComponent component)
Bind the runner to a project component.
|
protected void | checkLanguage()
Check if the language attribute is set. |
void | clearScript()
Clear the current script text content. |
abstract Object | evaluateScript(String execName)
Evaluate the script. |
abstract void | executeScript(String execName)
Do the work. |
protected Map | getBeans()
Get the beans used for the script. |
boolean | getKeepEngine()
Get the keep engine attribute. |
String | getLanguage()
Get the script language |
abstract String | getManagerName()
Get the name of the manager prefix used for this
scriptrunner. |
Project | getProject()
Get the project for this runner. |
String | getScript()
Get the current script text content. |
protected ClassLoader | getScriptClassLoader()
Get the classloader used to load the script engine. |
void | loadResource(Resource sourceResource)
Add a resource to the source list. |
void | loadResources(ResourceCollection collection)
Add all resources in a resource collection to the source list. |
protected ClassLoader | replaceContextLoader()
Replace the current context classloader with the
script context classloader. |
protected void | restoreContextLoader(ClassLoader origLoader)
Restore the context loader with the original context classloader.
script context loader. |
void | setKeepEngine(boolean keepEngine)
Whether to keep the script engine between calls. |
void | setLanguage(String language)
Defines the language (required). |
void | setProject(Project project)
Set the project for this runner. |
void | setScriptClassLoader(ClassLoader classLoader)
Set the script classloader. |
void | setSrc(File file)
Load the script from an external file; optional. |
abstract boolean | supportsLanguage()
Check if a script engine can be created for
this language. |
Parameters: key the name in the context this object is to stored under. bean the object to be stored in the script context.
Parameters: dictionary a map of objects to be placed into the script context indexed by String names.
Parameters: text a component of the script text to be added.
Parameters: component to become self
Parameters: component to become self
Throws: BuildException if it is not.
Parameters: execName the name that will be passed to the scripting engine for this script execution.
Returns: the result of evaluating the script.
Parameters: execName the name that will be passed to BSF for this script execution.
Returns: the map of beans.
Returns: the attribute.
Returns: the script language
Returns: the prefix string.
Returns: the project.
Returns: the script text.
Returns: the classloader.
Parameters: sourceResource the resource to load
Throws: BuildException if the resource cannot be read
Since: Ant 1.7.1
Parameters: collection the resource to load
Throws: BuildException if a resource cannot be read
Since: Ant 1.7.1
Returns: the current context classloader.
Parameters: origLoader the original context classloader.
Parameters: keepEngine if true, keep the engine.
Parameters: language the scripting language name for the script.
Parameters: project the project.
Parameters: classLoader the classloader to use.
Parameters: file the file containing the script source.
Returns: true if a script engine can be created, false otherwise.