Fields Summary |
---|
protected org.apache.tools.ant.taskdefs.Redirector | redirectorRedirector helper |
protected org.apache.tools.ant.types.RedirectorElement | redirectorElementRedirector element for this task |
protected OutputStream | redirectOutStreamThe stream for info output |
protected OutputStream | redirectErrStreamThe stream for error output |
PrintStream | redirectOutPrintStreamThe print stream for info output |
PrintStream | redirectErrPrintStreamThe print stream for error output |
protected boolean | failOnErrorWhether to fail (with a BuildException) if
ManagerServlet returns an error. The default behavior is
to do so.
This flag does not control parameters checking. If the task is called
with wrong or invalid parameters, it will throw BuildException
independently from the setting of this flag. |
protected boolean | redirectOutputtrue true when output redirection is requested for this task .
Default is to log on Ant log. |
protected boolean | redirectorConfiguredwill be set to true when the configuration of the Redirector is
complete. |
protected boolean | alwaysLogFlag which indicates that, if redirected, output should also be
always sent to the log. Default is that otput is sent only to
redirected streams. |
Methods Summary |
---|
public void | addConfiguredRedirector(org.apache.tools.ant.types.RedirectorElement redirectorElement)Add a RedirectorElement to this task.
if (this.redirectorElement != null) {
throw new BuildException("Cannot have > 1 nested <redirector>s");
} else {
this.redirectorElement = redirectorElement;
}
|
protected void | closeRedirector()Ask redirector to close all the streams. It is necessary to call this method
before leaving the Task to have the Streams flush their contents. If you are
collecting output in a property, it will be created only if this method is
called, otherwise you'll find it unset.
try {
if (redirectOutput) {
redirector.complete();
}
} catch (IOException ioe) {
log("Error closing redirector: "
+ ioe.getMessage(), Project.MSG_ERR);
}
/*
* Due to depends chain, Ant could call the Task more than once,
* this is to prevent that we attempt to reuse the previuosly
* closed Streams.
*/
redirectOutStream = null;
redirectOutPrintStream = null;
redirectErrStream = null;
redirectErrPrintStream = null;
|
private void | configureRedirector()Set up properties on the Redirector from RedirectorElement if present.
if (redirectorElement != null) {
redirectorElement.configure(redirector);
redirectOutput = true;
}
/*
* Due to depends chain, Ant could call the Task more than once,
* this is to prevent that we attempt to configure uselessly
* more than once the Redirector.
*/
redirectorConfigured = true;
|
protected void | handleErrorFlush(java.lang.String output)Handles error output with the ERR priority and flushes the stream.
handleErrorOutput(output);
redirectErrPrintStream.flush();
|
protected void | handleErrorOutput(java.lang.String output)Handles error output with the ERR priority.
if (redirectOutput) {
if (redirectErrPrintStream == null) {
openRedirector();
}
redirectErrPrintStream.println(output);
if (alwaysLog) {
log(output, Project.MSG_ERR);
}
} else {
log(output, Project.MSG_ERR);
}
|
protected void | handleFlush(java.lang.String output)Handles output with the INFO priority and flushes the stream.
handleOutput(output);
redirectOutPrintStream.flush();
|
protected void | handleFlush(java.lang.String output, int priority)Handles output with ERR priority to error stream and all other
pritorities to output stream, then flushes the stream.
if (priority == Project.MSG_ERR) {
handleErrorFlush(output);
} else {
handleFlush(output);
}
|
protected void | handleOutput(java.lang.String output)Handles output with the INFO priority.
if (redirectOutput) {
if (redirectOutPrintStream == null) {
openRedirector();
}
redirectOutPrintStream.println(output);
if (alwaysLog) {
log(output, Project.MSG_INFO);
}
} else {
log(output, Project.MSG_INFO);
}
|
protected void | handleOutput(java.lang.String output, int priority)Handles output with ERR priority to error stream and all other
pritorities to output stream.
if (priority == Project.MSG_ERR) {
handleErrorOutput(output);
} else {
handleOutput(output);
}
|
public boolean | isFailOnError()Returns the value of the failOnError
property.
return failOnError;
|
protected void | openRedirector()Set up properties on the Redirector and create output streams.
if (! redirectorConfigured) {
configureRedirector();
}
if (redirectOutput) {
redirector.createStreams();
redirectOutStream = redirector.getOutputStream();
redirectOutPrintStream = new PrintStream(redirectOutStream);
redirectErrStream = redirector.getErrorStream();
redirectErrPrintStream = new PrintStream(redirectErrStream);
}
|
public void | setAlwaysLog(boolean alwaysLog)If true, (error and non-error) output will be redirected
as specified while being sent to Ant's logging mechanism as if no
redirection had taken place. Defaults to false.
Actually handled internally, with Ant 1.6.3 it will be handled by
the Redirector itself.
this.alwaysLog = alwaysLog;
//redirector.setAlwaysLog(alwaysLog);
redirectOutput = true;
|
public void | setAppend(boolean append)If true, append output to existing file.
redirector.setAppend(append);
redirectOutput = true;
|
public void | setCreateEmptyFiles(boolean createEmptyFiles)Whether output and error files should be created even when empty.
Defaults to true.
redirector.setCreateEmptyFiles(createEmptyFiles);
redirectOutput = true;
|
public void | setError(java.io.File error)File the error output of the task is redirected to.
redirector.setError(error);
redirectOutput = true;
|
public void | setErrorProperty(java.lang.String errorProperty)Property name whose value should be set to the error of
the task..
redirector.setErrorProperty(errorProperty);
redirectOutput = true;
|
public void | setFailonerror(boolean fail)Whether to fail (with a BuildException) if
ManagerServlet returns an error. The default behavior is
to do so.
failOnError = fail;
|
public void | setLogError(boolean logError)Controls whether error output is logged. This is only useful
when output is being redirected and error output is desired in the
Ant log
redirector.setLogError(logError);
redirectOutput = true;
|
public void | setOutput(java.io.File out)File the output of the task is redirected to.
redirector.setOutput(out);
redirectOutput = true;
|
public void | setOutputproperty(java.lang.String outputProperty)Property name whose value should be set to the output of
the task.
redirector.setOutputProperty(outputProperty);
redirectOutput = true;
|