.
| Method from org.apache.tools.ant.types.RedirectorElement Detail: |
public void addConfiguredErrorMapper(Mapper errorMapper) {
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 >");
}
}
setChecked(false);
this.errorMapper = errorMapper;
}
Add the error file mapper. |
public void addConfiguredInputMapper(Mapper inputMapper) {
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 >");
}
}
setChecked(false);
this.inputMapper = inputMapper;
}
Add the input file mapper. |
public void addConfiguredOutputMapper(Mapper outputMapper) {
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 >");
}
}
setChecked(false);
this.outputMapper = outputMapper;
}
Add the output file mapper. |
public void configure(Redirector redirector) {
configure(redirector, null);
}
Configure the specified Redirector. |
public void configure(Redirector redirector,
String sourcefile) {
if (isReference()) {
getRef().configure(redirector, sourcefile);
return;
}
dieOnCircularReference();
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);
}
}
Configure the specified Redirector
for the specified sourcefile. |
public FilterChain createErrorFilterChain() {
if (isReference()) {
throw noChildrenAllowed();
}
FilterChain result = new FilterChain();
result.setProject(getProject());
errorFilterChains.add(result);
setChecked(false);
return result;
}
Create a nested error FilterChain. |
public FilterChain createInputFilterChain() {
if (isReference()) {
throw noChildrenAllowed();
}
FilterChain result = new FilterChain();
result.setProject(getProject());
inputFilterChains.add(result);
setChecked(false);
return result;
}
Create a nested input FilterChain. |
protected Mapper createMergeMapper(File destfile) {
Mapper result = new Mapper(getProject());
result.setClassname(
org.apache.tools.ant.util.MergingMapper.class.getName());
result.setTo(destfile.getAbsolutePath());
return result;
}
Create a merge mapper pointing to the specified destination file. |
public FilterChain createOutputFilterChain() {
if (isReference()) {
throw noChildrenAllowed();
}
FilterChain result = new FilterChain();
result.setProject(getProject());
outputFilterChains.add(result);
setChecked(false);
return result;
}
Create a nested output FilterChain. |
protected void dieOnCircularReference(Stack stk,
Project p) throws BuildException {
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();
pushAndInvokeCircularReferenceCheck(fc, stk, p);
}
}
}
setChecked(true);
}
}
Overrides the version of DataType to recurse on all DataType
child elements that may have been added. |
public void setAlwaysLog(boolean alwaysLog) {
if (isReference()) {
throw tooManyAttributes();
}
this.alwaysLog = ((alwaysLog) ? Boolean.TRUE : Boolean.FALSE);
}
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. |
public void setAppend(boolean append) {
if (isReference()) {
throw tooManyAttributes();
}
this.append = ((append) ? Boolean.TRUE : Boolean.FALSE);
}
Whether output should be appended to or overwrite an existing file.
Defaults to false. |
public void setCreateEmptyFiles(boolean createEmptyFiles) {
if (isReference()) {
throw tooManyAttributes();
}
this.createEmptyFiles = ((createEmptyFiles)
? Boolean.TRUE : Boolean.FALSE);
}
Whether output and error files should be created even when empty.
Defaults to true. |
public void setError(File error) {
if (isReference()) {
throw tooManyAttributes();
}
if (error == null) {
throw new IllegalArgumentException("error file specified as null");
}
usingError = true;
errorMapper = createMergeMapper(error);
}
Set the file to which standard error is to be redirected. |
public void setErrorEncoding(String errorEncoding) {
if (isReference()) {
throw tooManyAttributes();
}
this.errorEncoding = errorEncoding;
}
|
public void setErrorProperty(String errorProperty) {
if (isReference()) {
throw tooManyAttributes();
}
this.errorProperty = errorProperty;
}
Property name whose value should be set to the error of
the process. |
public void setInput(File input) {
if (isReference()) {
throw tooManyAttributes();
}
if (inputString != null) {
throw new BuildException("The \"input\" and \"inputstring\" "
+ "attributes cannot both be specified");
}
usingInput = true;
inputMapper = createMergeMapper(input);
}
Set the input to use for the task. |
public void setInputEncoding(String inputEncoding) {
if (isReference()) {
throw tooManyAttributes();
}
this.inputEncoding = inputEncoding;
}
|
public void setInputString(String inputString) {
if (isReference()) {
throw tooManyAttributes();
}
if (usingInput) {
throw new BuildException("The \"input\" and \"inputstring\" "
+ "attributes cannot both be specified");
}
this.inputString = inputString;
}
Set the string to use as input |
public void setLogError(boolean logError) {
if (isReference()) {
throw tooManyAttributes();
}
this.logError = ((logError) ? Boolean.TRUE : Boolean.FALSE);
}
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. |
public void setLogInputString(boolean logInputString) {
if (isReference()) {
throw tooManyAttributes();
}
this.logInputString = logInputString ? Boolean.TRUE : Boolean.FALSE;
}
Set whether to include the value of the input string in log messages.
Defaults to true. |
public void setOutput(File out) {
if (isReference()) {
throw tooManyAttributes();
}
if (out == null) {
throw new IllegalArgumentException("output file specified as null");
}
usingOutput = true;
outputMapper = createMergeMapper(out);
}
File the output of the process is redirected to. If error is not
redirected, it too will appear in the output. |
public void setOutputEncoding(String outputEncoding) {
if (isReference()) {
throw tooManyAttributes();
}
this.outputEncoding = outputEncoding;
}
|
public void setOutputProperty(String outputProperty) {
if (isReference()) {
throw tooManyAttributes();
}
this.outputProperty = outputProperty;
}
Property name whose value should be set to the output of
the process. |
public void setRefid(Reference r) throws BuildException {
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 File[] toFileArray(String[] name) {
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()]));
}
Return a File[] from the specified set of filenames. |