org.apache.tools.ant.util
Class ScriptRunner

java.lang.Object
  |
  +--org.apache.tools.ant.util.ScriptRunner

public class ScriptRunner
extends java.lang.Object

This class is used to run BSF scripts


Constructor Summary
ScriptRunner()
           
 
Method Summary
 void addBean(java.lang.String key, java.lang.Object bean)
          Add a single object into the script context.
 void addBeans(java.util.Map dictionary)
          Add a list of named objects to the list to be exported to the script
 void addText(java.lang.String text)
          Set the script text.
 void executeScript(java.lang.String execName)
          Do the work.
 java.lang.String getLanguage()
          Get the script language
 void setLanguage(java.lang.String language)
          Defines the language (required).
 void setSrc(java.io.File file)
          Load the script from an external file ; optional.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptRunner

public ScriptRunner()
Method Detail

addBeans

public void addBeans(java.util.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.

addBean

public void addBean(java.lang.String key,
                    java.lang.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.

executeScript

public void executeScript(java.lang.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.

setLanguage

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

Parameters:
language - the scripting language name for the script.

getLanguage

public java.lang.String getLanguage()
Get the script language

Returns:
the script language

setSrc

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

Parameters:
file - the file containing the script source.

addText

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

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


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.