FileDocCategorySizeDatePackage
ScriptFilter.javaAPI DocApache Ant 1.704581Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types.optional

ScriptFilter

public class ScriptFilter extends TokenFilter.ChainableReaderFilter
Most of this is CAP (Cut And Paste) from the Script task ScriptFilter class, implements TokenFilter.Filter for scripts to use. This provides the same beans as the Script Task to a script. The script is meant to use get self.token and set self.token in the reply.
since
Ant 1.6

Fields Summary
private org.apache.tools.ant.util.ScriptRunnerHelper
helper
script runner helper
private org.apache.tools.ant.util.ScriptRunnerBase
runner
script runner.
private String
token
the token used by the script
Constructors Summary
Methods Summary
public voidaddText(java.lang.String text)
The script text.

param
text a component of the script text to be added.

        helper.addText(text);
    
public org.apache.tools.ant.types.PathcreateClasspath()
Classpath to be used when searching for classes and resources.

return
an empty Path instance to be configured by Ant.

        return helper.createClasspath();
    
public java.lang.Stringfilter(java.lang.String token)
Called filter the token. This sets the token in this object, calls the script and returns the token.

param
token the token to be filtered
return
the filtered token

        init();
        setToken(token);
        runner.executeScript("ant_filter");
        return getToken();
    
public java.lang.StringgetToken()
The current token

return
the string filtered by the script

        return token;
    
private voidinit()
Initialize.

exception
BuildException if someting goes wrong

        if (runner != null) {
            return;
        }
        runner = helper.getScriptRunner();
    
public voidsetClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath to be used when searching for classes and resources.

param
classpath an Ant Path object containing the search path.

        helper.setClasspath(classpath);
    
public voidsetClasspathRef(org.apache.tools.ant.types.Reference r)
Set the classpath by reference.

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

        helper.setClasspathRef(r);
    
public voidsetLanguage(java.lang.String language)
Defines the language (required).

param
language the scripting language name for the script.

        helper.setLanguage(language);
    
public voidsetManager(java.lang.String manager)
Defines the manager.

param
manager the scripting manager.

        helper.setManager(manager);
    
public voidsetProject(org.apache.tools.ant.Project project)
Set the project.

param
project the owner of this component.


                   
        
        super.setProject(project);
        helper.setProjectComponent(this);
    
public voidsetSrc(java.io.File file)
Load the script from an external file ; optional.

param
file the file containing the script source.

        helper.setSrc(file);
    
public voidsetToken(java.lang.String token)
The current token

param
token the string filtered by the script

        this.token = token;