org.apache.tools.ant.types.optional

Class AbstractScriptComponent

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
ScriptCondition, ScriptMapper

public abstract class AbstractScriptComponent
extends ProjectComponent

This is a ProjectComponent that has script support built in Use it as a foundation for scriptable things.

Field Summary

Fields inherited from class org.apache.tools.ant.ProjectComponent

description, location, project

Method Summary

void
addText(String text)
The script text.
Path
createClasspath()
Classpath to be used when searching for classes and resources.
protected void
executeScript(String execName)
Run a script
ScriptRunnerBase
getRunner()
Get our script runner
protected void
initScriptRunner()
Initialize the script runner.
void
setClasspath(Path classpath)
Set the classpath to be used when searching for classes and resources.
void
setClasspathRef(Reference r)
Set the classpath by reference.
void
setLanguage(String language)
Defines the language (required).
void
setManager(String manager)
Defines the manager.
void
setProject(Project project)
Set the project.
void
setSrc(File file)
Load the script from an external file ; optional.

Methods inherited from class org.apache.tools.ant.ProjectComponent

clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject

Method Details

addText

public void addText(String text)
The script text.
Parameters:
text - a component of the script text to be added.

createClasspath

public Path createClasspath()
Classpath to be used when searching for classes and resources.
Returns:
an empty Path instance to be configured by Ant.

executeScript

protected void executeScript(String execName)
Run a script
Parameters:
execName - name of the script

getRunner

public ScriptRunnerBase getRunner()
Get our script runner
Returns:
the runner

initScriptRunner

protected void initScriptRunner()
Initialize the script runner. Calls this before running the system

setClasspath

public void setClasspath(Path classpath)
Set the classpath to be used when searching for classes and resources.
Parameters:
classpath - an Ant Path object containing the search path.

setClasspathRef

public void setClasspathRef(Reference r)
Set the classpath by reference.
Parameters:
r - a Reference to a Path instance to be used as the classpath value.

setLanguage

public void setLanguage(String language)
Defines the language (required).
Parameters:
language - the scripting language name for the script.

setManager

public void setManager(String manager)
Defines the manager.
Parameters:
manager - the scripting manager.

setProject

public void setProject(Project project)
Set the project.
Overrides:
setProject in interface ProjectComponent
Parameters:
project - the owner of this component.

setSrc

public void setSrc(File file)
Load the script from an external file ; optional.
Parameters:
file - the file containing the script source.