org.apache.tools.ant.util

Class ScriptRunner

public class ScriptRunner extends Object

This class is used to run BSF scripts
Method Summary
voidaddBean(String key, Object bean)
Add a single object into the script context.
voidaddBeans(Map dictionary)
Add a list of named objects to the list to be exported to the script
voidaddText(String text)
Set the script text.
voidexecuteScript(String execName)
Do the work.
StringgetLanguage()
Get the script language
voidsetLanguage(String language)
Defines the language (required).
voidsetSrc(File file)
Load the script from an external file ; optional.

Method Detail

addBean

public void addBean(String key, Object bean)
Add a single object into the script context.

Parameters: key the name in the context this object is to stored under. bean the object to be stored in the script context.

addBeans

public void addBeans(Map dictionary)
Add a list of named objects to the list to be exported to the script

Parameters: dictionary a map of objects to be placed into the script context indexed by String names.

addText

public void addText(String text)
Set the script text.

Parameters: text a component of the script text to be added.

executeScript

public void executeScript(String execName)
Do the work.

Parameters: execName the name that will be passed to BSF for this script execution.

Throws: BuildException if someting goes wrong exectuing the script.

getLanguage

public String getLanguage()
Get the script language

Returns: the script language

setLanguage

public void setLanguage(String language)
Defines the language (required).

Parameters: language the scripting language name for the script.

setSrc

public void setSrc(File file)
Load the script from an external file ; optional.

Parameters: file the file containing the script source.

Copyright