com.atlassian.fisheye.plugins.scm.utils.process
Class PluggableProcessHandler

java.lang.Object
  extended by com.atlassian.fisheye.plugins.scm.utils.process.BaseProcessHandler
      extended by com.atlassian.fisheye.plugins.scm.utils.process.PluggableProcessHandler
All Implemented Interfaces:
ProcessHandler
Direct Known Subclasses:
StringProcessHandler

public class PluggableProcessHandler
extends BaseProcessHandler

An implementation of a ProcessHandler where the processors for the process' IO streams can be plugged in.


Constructor Summary
PluggableProcessHandler()
           
 
Method Summary
 void complete(int exitCode, ProcessException exception)
          Called when the external process has completed
 java.lang.String getError()
           
 OutputHandler getErrorHandler()
           
 ProcessException getException()
          Get any processing exception associated with this handler
 int getExitCode()
          Get the process exit code
 InputHandler getInputHandler()
           
 OutputHandler getOutputHandler()
           
 boolean hasInput()
          Indicate if this handler has input to provide to the process
 boolean isComplete()
          Indicate if the process has completed
 void processError(java.io.InputStream processError)
          Process the process stderr stream
 void processOutput(java.io.InputStream processOutput)
          Process the process stdout stream
 void provideInput(java.io.OutputStream processInput)
          Provide input to the external process.
 void reset()
          Called if the process is to be re-executed.
 void setErrorHandler(OutputHandler errorHandler)
           
 void setInputHandler(InputHandler inputHandler)
           
 void setOutputHandler(OutputHandler outputHandler)
           
 boolean succeeded()
          Indicate if the process execution has been considered successful.
 
Methods inherited from class com.atlassian.fisheye.plugins.scm.utils.process.BaseProcessHandler
getWatchdog, setWatchdog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluggableProcessHandler

public PluggableProcessHandler()
Method Detail

processOutput

public void processOutput(java.io.InputStream processOutput)
                   throws ProcessException
Description copied from interface: ProcessHandler
Process the process stdout stream

Parameters:
processOutput - the external process' output stream (available as an input to this class)
Throws:
ProcessException - if there is a problem processing the output

processError

public void processError(java.io.InputStream processError)
                  throws ProcessException
Description copied from interface: ProcessHandler
Process the process stderr stream

Parameters:
processError - the external process' standard error stream (available as an input to this class)
Throws:
ProcessException - if there is a problem processing the output

hasInput

public boolean hasInput()
Description copied from interface: ProcessHandler
Indicate if this handler has input to provide to the process

Returns:
true if input is available

provideInput

public void provideInput(java.io.OutputStream processInput)
Description copied from interface: ProcessHandler
Provide input to the external process. Input is provided by writing the content to the given output stream. This method will only be called if hasInput() returns true

Parameters:
processInput - the output stream representing standard input to the external process

complete

public void complete(int exitCode,
                     ProcessException exception)
Description copied from interface: ProcessHandler
Called when the external process has completed

Parameters:
exitCode - the exit code of the external process
exception - any process exceptions that were thrown within the VM when handling the external process

getExitCode

public int getExitCode()
Description copied from interface: ProcessHandler
Get the process exit code

Returns:
process exit code

getException

public ProcessException getException()
Description copied from interface: ProcessHandler
Get any processing exception associated with this handler

Returns:
a processing exception instance or null if no exception occurred.

getError

public java.lang.String getError()

setOutputHandler

public void setOutputHandler(OutputHandler outputHandler)

setErrorHandler

public void setErrorHandler(OutputHandler errorHandler)

setInputHandler

public void setInputHandler(InputHandler inputHandler)

getOutputHandler

public OutputHandler getOutputHandler()

getErrorHandler

public OutputHandler getErrorHandler()

getInputHandler

public InputHandler getInputHandler()

succeeded

public boolean succeeded()
Description copied from interface: ProcessHandler
Indicate if the process execution has been considered successful.

Returns:
true if the process execution completed without error

reset

public void reset()
Description copied from interface: ProcessHandler
Called if the process is to be re-executed.


isComplete

public boolean isComplete()
Description copied from interface: ProcessHandler
Indicate if the process has completed

Returns:
true if complete has been called.