Fields Summary |
---|
private boolean | usingInputWhether the input mapper was set via setOutput . |
private boolean | usingOutputWhether the output mapper was set via setOutput . |
private boolean | usingErrorWhether the error mapper was set via setError . |
private Boolean | logErrorIndicates if standard error should be logged to Ant's log system
rather than the output. This has no effect if standard error is
redirected to a file or property. |
private String | outputPropertyThe name of the property into which output is to be stored |
private String | errorPropertyThe name of the property into which error output is to be stored |
private String | inputStringString from which input is taken |
private Boolean | appendFlag which indicates if error and output files are to be appended. |
private Boolean | alwaysLogFlag which indicates that output should be always sent to the log |
private Boolean | createEmptyFilesFlag which indicates whether files should be created even if empty. |
private Mapper | inputMapperInput file mapper. |
private Mapper | outputMapperOutput file mapper. |
private Mapper | errorMapperError file mapper. |
private Vector | inputFilterChainsinput filter chains. |
private Vector | outputFilterChainsoutput filter chains. |
private Vector | errorFilterChainserror filter chains. |
private String | outputEncodingThe output encoding |
private String | errorEncodingThe error encoding |
private String | inputEncodingThe input encoding |
private Boolean | logInputStringwhether to log the inputstring |
Methods Summary |
---|
public void | addConfiguredErrorMapper(Mapper errorMapper)Add the error file mapper.
if (isReference()) {
throw noChildrenAllowed();
}
if (this.errorMapper != null) {
if (usingError) {
throw new BuildException("attribute \"error\""
+ " cannot coexist with a nested <errormapper>");
} else {
throw new BuildException("Cannot have > 1 <errormapper>");
}
}
this.errorMapper = errorMapper;
|
public void | addConfiguredInputMapper(Mapper inputMapper)Add the input file mapper.
if (isReference()) {
throw noChildrenAllowed();
}
if (this.inputMapper != null) {
if (usingInput) {
throw new BuildException("attribute \"input\""
+ " cannot coexist with a nested <inputmapper>");
} else {
throw new BuildException("Cannot have > 1 <inputmapper>");
}
}
this.inputMapper = inputMapper;
|
public void | addConfiguredOutputMapper(Mapper outputMapper)Add the output file mapper.
if (isReference()) {
throw noChildrenAllowed();
}
if (this.outputMapper != null) {
if (usingOutput) {
throw new BuildException("attribute \"output\""
+ " cannot coexist with a nested <outputmapper>");
} else {
throw new BuildException("Cannot have > 1 <outputmapper>");
}
}
this.outputMapper = outputMapper;
|
public void | configure(org.apache.tools.ant.taskdefs.Redirector redirector)Configure the specified Redirector .
configure(redirector, null);
|
public void | configure(org.apache.tools.ant.taskdefs.Redirector redirector, java.lang.String sourcefile)Configure the specified Redirector
for the specified sourcefile.
if (isReference()) {
getRef().configure(redirector, sourcefile);
return;
}
if (alwaysLog != null) {
redirector.setAlwaysLog(alwaysLog.booleanValue());
}
if (logError != null) {
redirector.setLogError(logError.booleanValue());
}
if (append != null) {
redirector.setAppend(append.booleanValue());
}
if (createEmptyFiles != null) {
redirector.setCreateEmptyFiles(createEmptyFiles.booleanValue());
}
if (outputProperty != null) {
redirector.setOutputProperty(outputProperty);
}
if (errorProperty != null) {
redirector.setErrorProperty(errorProperty);
}
if (inputString != null) {
redirector.setInputString(inputString);
}
if (logInputString != null) {
redirector.setLogInputString(logInputString.booleanValue());
}
if (inputMapper != null) {
String[] inputTargets = null;
try {
inputTargets =
inputMapper.getImplementation().mapFileName(sourcefile);
} catch (NullPointerException enPeaEx) {
if (sourcefile != null) {
throw enPeaEx;
}
}
if (inputTargets != null && inputTargets.length > 0) {
redirector.setInput(toFileArray(inputTargets));
}
}
if (outputMapper != null) {
String[] outputTargets = null;
try {
outputTargets =
outputMapper.getImplementation().mapFileName(sourcefile);
} catch (NullPointerException enPeaEx) {
if (sourcefile != null) {
throw enPeaEx;
}
}
if (outputTargets != null && outputTargets.length > 0) {
redirector.setOutput(toFileArray(outputTargets));
}
}
if (errorMapper != null) {
String[] errorTargets = null;
try {
errorTargets =
errorMapper.getImplementation().mapFileName(sourcefile);
} catch (NullPointerException enPeaEx) {
if (sourcefile != null) {
throw enPeaEx;
}
}
if (errorTargets != null && errorTargets.length > 0) {
redirector.setError(toFileArray(errorTargets));
}
}
if (inputFilterChains.size() > 0) {
redirector.setInputFilterChains(inputFilterChains);
}
if (outputFilterChains.size() > 0) {
redirector.setOutputFilterChains(outputFilterChains);
}
if (errorFilterChains.size() > 0) {
redirector.setErrorFilterChains(errorFilterChains);
}
if (inputEncoding != null) {
redirector.setInputEncoding(inputEncoding);
}
if (outputEncoding != null) {
redirector.setOutputEncoding(outputEncoding);
}
if (errorEncoding != null) {
redirector.setErrorEncoding(errorEncoding);
}
|
public FilterChain | createErrorFilterChain()Create a nested error FilterChain .
if (isReference()) {
throw noChildrenAllowed();
}
FilterChain result = new FilterChain();
result.setProject(getProject());
errorFilterChains.add(result);
return result;
|
public FilterChain | createInputFilterChain()Create a nested input FilterChain .
if (isReference()) {
throw noChildrenAllowed();
}
FilterChain result = new FilterChain();
result.setProject(getProject());
inputFilterChains.add(result);
return result;
|
protected Mapper | createMergeMapper(java.io.File destfile)Create a merge mapper pointing to the specified destination file.
Mapper result = new Mapper(getProject());
result.setClassname(
org.apache.tools.ant.util.MergingMapper.class.getName());
result.setTo(destfile.getAbsolutePath());
return result;
|
public FilterChain | createOutputFilterChain()Create a nested output FilterChain .
if (isReference()) {
throw noChildrenAllowed();
}
FilterChain result = new FilterChain();
result.setProject(getProject());
outputFilterChains.add(result);
return result;
|
protected void | dieOnCircularReference(java.util.Stack stk, org.apache.tools.ant.Project p)Overrides the version of DataType to recurse on all DataType
child elements that may have been added.
if (isChecked()) {
return;
}
if (isReference()) {
super.dieOnCircularReference(stk, p);
} else {
Mapper[] m = new Mapper[] {inputMapper, outputMapper, errorMapper};
for (int i = 0; i < m.length; i++) {
if (m[i] != null) {
stk.push(m[i]);
m[i].dieOnCircularReference(stk, p);
stk.pop();
}
}
Vector[] v = new Vector[]
{inputFilterChains, outputFilterChains, errorFilterChains};
for (int i = 0; i < v.length; i++) {
if (v[i] != null) {
for (Iterator fci = v[i].iterator(); fci.hasNext();) {
FilterChain fc = (FilterChain) fci.next();
stk.push(fc);
fc.dieOnCircularReference(stk, p);
stk.pop();
}
}
}
setChecked(true);
}
|
private org.apache.tools.ant.types.RedirectorElement | getRef()Perform the check for circular references, returning the
referenced RedirectorElement.
return (RedirectorElement) getCheckedRef();
|
public void | setAlwaysLog(boolean alwaysLog)If true, (error and non-error) output will be "teed", redirected
as specified while being sent to Ant's logging mechanism as if no
redirection had taken place. Defaults to false.
if (isReference()) {
throw tooManyAttributes();
}
this.alwaysLog = ((alwaysLog) ? Boolean.TRUE : Boolean.FALSE);
|
public void | setAppend(boolean append)Whether output should be appended to or overwrite an existing file.
Defaults to false.
if (isReference()) {
throw tooManyAttributes();
}
this.append = ((append) ? Boolean.TRUE : Boolean.FALSE);
|
public void | setCreateEmptyFiles(boolean createEmptyFiles)Whether output and error files should be created even when empty.
Defaults to true.
if (isReference()) {
throw tooManyAttributes();
}
this.createEmptyFiles = ((createEmptyFiles)
? Boolean.TRUE : Boolean.FALSE);
|
public void | setError(java.io.File error)Set the file to which standard error is to be redirected.
if (isReference()) {
throw tooManyAttributes();
}
if (error == null) {
throw new IllegalArgumentException("error file specified as null");
}
usingError = true;
errorMapper = createMergeMapper(error);
|
public void | setErrorEncoding(java.lang.String errorEncoding)Set the error encoding.
if (isReference()) {
throw tooManyAttributes();
}
this.errorEncoding = errorEncoding;
|
public void | setErrorProperty(java.lang.String errorProperty)Property name whose value should be set to the error of
the process.
if (isReference()) {
throw tooManyAttributes();
}
this.errorProperty = errorProperty;
|
public void | setInput(java.io.File input)Set the input to use for the task.
if (isReference()) {
throw tooManyAttributes();
}
if (inputString != null) {
throw new BuildException("The \"input\" and \"inputstring\" "
+ "attributes cannot both be specified");
}
usingInput = true;
inputMapper = createMergeMapper(input);
|
public void | setInputEncoding(java.lang.String inputEncoding)Set the input encoding.
if (isReference()) {
throw tooManyAttributes();
}
this.inputEncoding = inputEncoding;
|
public void | setInputString(java.lang.String inputString)Set the string to use as input
if (isReference()) {
throw tooManyAttributes();
}
if (usingInput) {
throw new BuildException("The \"input\" and \"inputstring\" "
+ "attributes cannot both be specified");
}
this.inputString = inputString;
|
public void | setLogError(boolean logError)Controls whether error output of exec is logged. This is only useful
when output is being redirected and error output is desired in the
Ant log.
if (isReference()) {
throw tooManyAttributes();
}
this.logError = ((logError) ? Boolean.TRUE : Boolean.FALSE);
|
public void | setLogInputString(boolean logInputString)Set whether to include the value of the input string in log messages.
Defaults to true.
if (isReference()) {
throw tooManyAttributes();
}
this.logInputString = logInputString ? Boolean.TRUE : Boolean.FALSE;
|
public void | setOutput(java.io.File out)File the output of the process is redirected to. If error is not
redirected, it too will appear in the output.
if (isReference()) {
throw tooManyAttributes();
}
if (out == null) {
throw new IllegalArgumentException("output file specified as null");
}
usingOutput = true;
outputMapper = createMergeMapper(out);
|
public void | setOutputEncoding(java.lang.String outputEncoding)Set the output encoding.
if (isReference()) {
throw tooManyAttributes();
}
this.outputEncoding = outputEncoding;
|
public void | setOutputProperty(java.lang.String outputProperty)Property name whose value should be set to the output of
the process.
if (isReference()) {
throw tooManyAttributes();
}
this.outputProperty = outputProperty;
|
public void | setRefid(Reference r)Make this instance in effect a reference to another instance.
You must not set another attribute or nest elements inside
this element if you make it a reference.
if (usingInput
|| usingOutput
|| usingError
|| inputString != null
|| logError != null
|| append != null
|| createEmptyFiles != null
|| inputEncoding != null
|| outputEncoding != null
|| errorEncoding != null
|| outputProperty != null
|| errorProperty != null
|| logInputString != null) {
throw tooManyAttributes();
}
super.setRefid(r);
|
protected java.io.File[] | toFileArray(java.lang.String[] name)Return a File[] from the specified set of filenames.
if (name == null) {
return null;
}
//remove any null elements
ArrayList list = new ArrayList(name.length);
for (int i = 0; i < name.length; i++) {
if (name[i] != null) {
list.add(getProject().resolveFile(name[i]));
}
}
return (File[]) (list.toArray(new File[list.size()]));
|