org.apache.tools.ant.util

Class ScriptRunner


public class ScriptRunner
extends java.lang.Object

This class is used to run BSF scripts

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
executeScript(String execName)
Do the work.
String
getLanguage()
Get the script language
void
setLanguage(String language)
Defines the language (required).
void
setSrc(File file)
Load the script from an external file ; optional.

Method Details

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)
            throws BuildException
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 B) 2000-2007 Apache Software Foundation. All Rights Reserved.