com.parabon.client
Class RuntimeResult

java.lang.Object
  extended by com.parabon.client.RuntimeResult
All Implemented Interfaces:
java.io.Serializable

public class RuntimeResult
extends java.lang.Object
implements java.io.Serializable

RuntimeResult consumes a TaskResultEvent to obtain the execution details of a particular runtime task.

See Also:
RuntimeTaskSpec, Serialized Form

Field Summary
protected  int exitValue
           
protected  java.io.File outputBundle
           
protected  java.util.zip.ZipFile outputZip
           
protected  java.lang.String stdoutBuffer
           
protected  short version
           
 
Constructor Summary
RuntimeResult(TaskIntermediateResultEvent event)
          Construct a RuntimeResult object from a TaskResultEvent.
RuntimeResult(TaskIntermediateResultEvent event, java.io.File outputBundleFile)
          Construct a RuntimeResult object from a TaskResultEvent.
RuntimeResult(TaskResultEvent event)
          Construct a RuntimeResult object from a TaskResultEvent.
RuntimeResult(TaskResultEvent event, java.io.File outputBundleFile)
          Construct a RuntimeResult object from a TaskResultEvent.
 
Method Summary
protected  void deserializeResults(TaskEvent event, java.io.InputStream stream)
          Deserialize the TaskResultEvent and populate this object.
protected  void finalize()
           
 int getExitValue()
          Get exit value of executed command line.
 java.io.InputStream getFileStream(java.lang.String file)
          Get an InputStream to an output file generated by the task.
 java.lang.String getStdout()
          Get the stdout/stderr output generated by the task as a String.
 java.io.InputStream getStdoutStream()
          Get an InputStream to the stdout/stderr output generated by the task.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

protected short version

exitValue

protected int exitValue

stdoutBuffer

protected java.lang.String stdoutBuffer

outputBundle

protected java.io.File outputBundle

outputZip

protected java.util.zip.ZipFile outputZip
Constructor Detail

RuntimeResult

public RuntimeResult(TaskResultEvent event)
              throws java.io.IOException
Construct a RuntimeResult object from a TaskResultEvent.

Parameters:
event - Task result event.
Throws:
java.io.IOException - Thrown if the event could not be deserialized.

RuntimeResult

public RuntimeResult(TaskIntermediateResultEvent event)
              throws java.io.IOException
Construct a RuntimeResult object from a TaskResultEvent.

Parameters:
event - Task result event.
Throws:
java.io.IOException - Thrown if the event could not be deserialized.

RuntimeResult

public RuntimeResult(TaskResultEvent event,
                     java.io.File outputBundleFile)
              throws java.io.IOException
Construct a RuntimeResult object from a TaskResultEvent.

Parameters:
event - Task result event.
outputBundleFile - File to cache the output bundle. The output bundle contains a zip archive of all output files defined by RuntimeTaskSpec.setOutputFile()
Throws:
java.io.IOException - Thrown if the event could not be deserialized.

RuntimeResult

public RuntimeResult(TaskIntermediateResultEvent event,
                     java.io.File outputBundleFile)
              throws java.io.IOException
Construct a RuntimeResult object from a TaskResultEvent.

Parameters:
event - Task result event.
outputBundleFile - File to cache the output bundle. The output bundle contains a zip archive of all output files defined by RuntimeTaskSpec.setOutputFile()
Throws:
java.io.IOException - Thrown if the event could not be deserialized.
Method Detail

getExitValue

public int getExitValue()
Get exit value of executed command line.

Returns:
int Exit value.

getFileStream

public java.io.InputStream getFileStream(java.lang.String file)
                                  throws java.io.IOException
Get an InputStream to an output file generated by the task. The output file must have been defined on RuntimeTaskSpec setup. If the requested output file name was not present on the remote runtime during data collection, a FileNotFoundException will be thrown.

Parameters:
file - Name of output file as defined by RuntimeTaskSpec.setOutputFile()
Returns:
InputStream to the output file reference.
Throws:
java.io.IOException - If file doesn't exist or error reading stream.

getStdout

public java.lang.String getStdout()
                           throws java.io.IOException
Get the stdout/stderr output generated by the task as a String. This method should only be used if the output is known to be relatively small. For larger task output, use the getStdoutStream() method.

Returns:
Combined stdout and stderr streams as a String object.
Throws:
java.io.IOException - If the stream can't be read.
See Also:
getStdoutStream()

getStdoutStream

public java.io.InputStream getStdoutStream()
                                    throws java.io.IOException
Get an InputStream to the stdout/stderr output generated by the task. If no output was generated, an empty stream will be returned.

Returns:
InputStream to the remote process combined stdout and stderr streams.
Throws:
java.io.IOException - If the stream can't be read.

deserializeResults

protected void deserializeResults(TaskEvent event,
                                  java.io.InputStream stream)
                           throws java.io.IOException
Deserialize the TaskResultEvent and populate this object.

Parameters:
event - Task result event.
Throws:
java.io.IOException - If the result data can't be read.

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable