com.continuent.tungsten.common.exec
Class LoggerInputStreamSink

java.lang.Object
  extended by com.continuent.tungsten.common.exec.LoggerInputStreamSink
All Implemented Interfaces:
InputStreamSink, java.lang.Runnable

public class LoggerInputStreamSink
extends java.lang.Object
implements InputStreamSink

Runnable to read from an InputStream until exhausted and append results into a Logger.


Constructor Summary
LoggerInputStreamSink(java.lang.String tag, java.io.InputStream in, org.apache.log4j.Logger outLogger)
          Creates a new instance.
 
Method Summary
 java.lang.String getOutput()
          Return output lines if we are storing output in a string or null if storing to a file.
 void run()
          Reads from the input stream and stores output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerInputStreamSink

public LoggerInputStreamSink(java.lang.String tag,
                             java.io.InputStream in,
                             org.apache.log4j.Logger outLogger)
Creates a new instance.

Parameters:
tag - A tag for this processor to help with logging. If "stderr" is given, log will be appended into ERROR stream instead of the usual INFO.
in - InputStream from which we read.
outLogger - Logger to append output of the stream into.
Method Detail

run

public void run()
Reads from the input stream and stores output. Terminates when the input stream ends.

Specified by:
run in interface InputStreamSink
Specified by:
run in interface java.lang.Runnable
See Also:
InputStreamSink.run()

getOutput

public java.lang.String getOutput()
Return output lines if we are storing output in a string or null if storing to a file.

Specified by:
getOutput in interface InputStreamSink
Returns:
Output line array.
See Also:
InputStreamSink.getOutput()