Top Description Fields Constructors Methods
org.apache.tools.ant.types.optional

public abstract Class AbstractScriptComponent

extends ProjectComponent
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.types.optional.ScriptCondition, org.apache.tools.ant.types.optional.ScriptMapper
Imports
java.io.File, org.apache.tools.ant.Project, .ProjectComponent, org.apache.tools.ant.types.Path, .Reference, org.apache.tools.ant.util.ScriptManager, .ScriptRunnerBase, .ScriptRunnerHelper

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

Field Summary

Modifier and TypeField and Description
private ScriptRunnerHelper
helper

script runner helper

private ScriptRunnerBase
runner

script runner.

Inherited from org.apache.tools.ant.ProjectComponent:
descriptionlocationproject

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addText(String
a component of the script text to be added.
text
)

The script text.

public Path

Returns:

an empty Path instance to be configured by Ant.
createClasspath
()

Classpath to be used when searching for classes and resources.

protected void
executeScript(String
name of the script
execName
)

Run a script

public ScriptRunnerBase

Returns:

the runner
getRunner
()

Get our script runner

protected void
initScriptRunner()

Initialize the script runner.

public void
setClasspath(Path
an Ant Path object containing the search path.
classpath
)

Set the classpath to be used when searching for classes and resources.

public void
setClasspathRef(Reference
a Reference to a Path instance to be used as the classpath value.
r
)

Set the classpath by reference.

public void
setEncoding(String
the encoding of the file containing the script source.
encoding
)

Set the encoding of the script from an external file; optional.

public void
setLanguage(String
the scripting language name for the script.
language
)

Defines the language (required).

public void
setManager(String
the scripting manager.
manager
)

Deprecated
Defines the manager.
public void
setManager(ScriptManager manager)

Set the script manager.

public void
setProject(Project
the owner of this component.
project
)

Overrides org.apache.tools.ant.ProjectComponent.setProject.

Set the project.
public void
setSetBeans(boolean
the value to set.
setBeans
)

Set the setbeans attribute.

public void
setSrc(File
the file containing the script source.
file
)

Load the script from an external file; optional.

Inherited from org.apache.tools.ant.ProjectComponent:
clonegetDescriptiongetLocationgetProjectloglogsetDescriptionsetLocation

Field Detail

helperback to summary
private ScriptRunnerHelper helper

script runner helper

runnerback to summary
private ScriptRunnerBase runner

script runner.

Constructor Detail

AbstractScriptComponentback to summary
public AbstractScriptComponent()

Method Detail

addTextback to summary
public void addText(String text)

The script text.

Parameters
text:String

a component of the script text to be added.

createClasspathback to summary
public Path createClasspath()

Classpath to be used when searching for classes and resources.

Returns:Path

an empty Path instance to be configured by Ant.

executeScriptback to summary
protected void executeScript(String execName)

Run a script

Parameters
execName:String

name of the script

getRunnerback to summary
public ScriptRunnerBase getRunner()

Get our script runner

Returns:ScriptRunnerBase

the runner

initScriptRunnerback to summary
protected void initScriptRunner()

Initialize the script runner. Calls this before running the system

setClasspathback to summary
public void setClasspath(Path classpath)

Set the classpath to be used when searching for classes and resources.

Parameters
classpath:Path

an Ant Path object containing the search path.

setClasspathRefback to summary
public void setClasspathRef(Reference r)

Set the classpath by reference.

Parameters
r:Reference

a Reference to a Path instance to be used as the classpath value.

setEncodingback to summary
public void setEncoding(String encoding)

Set the encoding of the script from an external file; optional.

Parameters
encoding:String

the encoding of the file containing the script source.

Since
Ant 1.10.2
setLanguageback to summary
public void setLanguage(String language)

Defines the language (required).

Parameters
language:String

the scripting language name for the script.

setManagerback to summary
public void setManager(String manager)

Deprecated

Defines the manager.

Parameters
manager:String

the scripting manager.

Annotations
@Deprecated
setManagerback to summary
public void setManager(ScriptManager manager)

Set the script manager.

setProjectback to summary
public void setProject(Project project)

Overrides org.apache.tools.ant.ProjectComponent.setProject.

Set the project.

Parameters
project:Project

the owner of this component.

Annotations
@Override
setSetBeansback to summary
public void setSetBeans(boolean setBeans)

Set the setbeans attribute. If this is true, <script> will create variables in the script instance for all properties, targets and references of the current project. It this is false, only the project and self variables will be set. The default is true.

Parameters
setBeans:boolean

the value to set.

Since
Ant 1.8.0
setSrcback to summary
public void setSrc(File file)

Load the script from an external file; optional.

Parameters
file:File

the file containing the script source.