org.jppf.process
Class ProcessWrapper

java.lang.Object
  extended by org.jppf.utils.EventEmitter<ProcessWrapperEventListener>
      extended by org.jppf.process.ProcessWrapper

public final class ProcessWrapper
extends EventEmitter<ProcessWrapperEventListener>

Wrapper around an external process started with ProcessBuilder. Instances of this class read the output ands error streams generated by the process and provide a notification mechanism with separate events for the respective streams.

Author:
Laurent Cohen

Field Summary
 
Fields inherited from class org.jppf.utils.EventEmitter
eventListeners
 
Constructor Summary
ProcessWrapper()
          Initialize this process handler.
ProcessWrapper(Process process)
          Initialize this process handler with the specified process.
 
Method Summary
protected  void fireStreamEvent(boolean output, String content)
          Notify all listeners that a stream event has occurred.
 Process getProcess()
          Get the process to handle.
 void setProcess(Process process)
          Set the process to handle.
 
Methods inherited from class org.jppf.utils.EventEmitter
addListener, getListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessWrapper

public ProcessWrapper()
Initialize this process handler.


ProcessWrapper

public ProcessWrapper(Process process)
Initialize this process handler with the specified process.

Parameters:
process - the process to handle.
Method Detail

getProcess

public Process getProcess()
Get the process to handle.

Returns:
a Process instance.

setProcess

public void setProcess(Process process)
Set the process to handle. If the process has already been set through this setter or the corresponding contructor, this method does nothing.

Parameters:
process - - a Process instance.

fireStreamEvent

protected void fireStreamEvent(boolean output,
                               String content)
Notify all listeners that a stream event has occurred.

Parameters:
output - true if the event is for the outpuit stream, false if it is for the error stream.
content - the text that written to the stream.


Copyright © 2005-2010 JPPF Team.