org.objectweb.proactive.core.process
Class AbstractExternalProcess

java.lang.Object
  |
  +--org.objectweb.proactive.core.process.AbstractUniversalProcess
        |
        +--org.objectweb.proactive.core.process.AbstractExternalProcess
All Implemented Interfaces:
ExternalProcess, java.io.Serializable, UniversalProcess
Direct Known Subclasses:
AbstractExternalProcessDecorator, JVMProcessImpl, SimpleExternalProcess

public abstract class AbstractExternalProcess
extends AbstractUniversalProcess
implements ExternalProcess

See Also:
Serialized Form

Nested Class Summary
static class AbstractExternalProcess.NullMessageLogger
          Implementation of a MessageLogger that discard all output
protected  class AbstractExternalProcess.ProcessInputHandler
          This class reads all messages from an input and log them using a MessageLogger
protected  class AbstractExternalProcess.ProcessOutputHandler
          This class uses a MessageSink to write all messages produced in a given output
static class AbstractExternalProcess.SimpleMessageSink
          Implementation of a MessageSink that can receive one message at a time
static class AbstractExternalProcess.StandardOutputMessageLogger
          Implementation of a MessageLogger that output all messages to the standard output
 
Field Summary
protected static org.apache.log4j.Logger clogger
           
protected  MessageLogger errorMessageLogger
           
protected  java.lang.Process externalProcess
           
protected  MessageLogger inputMessageLogger
           
protected static boolean IS_WINDOWS_SYSTEM
           
protected  MessageSink outputMessageSink
           
 
Fields inherited from class org.objectweb.proactive.core.process.AbstractUniversalProcess
certificateLocation, command, DEFAULT_HOSTNAME, DEFAULT_USERNAME, environment, hostname, isFinished, isStarted, LOCALHOST, privateKeyLocation, securityFile, username
 
Fields inherited from interface org.objectweb.proactive.core.process.UniversalProcess
logger
 
Constructor Summary
protected AbstractExternalProcess()
           
  AbstractExternalProcess(MessageLogger messageLogger)
           
  AbstractExternalProcess(MessageLogger inputMessageLogger, MessageLogger errorMessageLogger)
           
  AbstractExternalProcess(MessageLogger inputMessageLogger, MessageLogger errorMessageLogger, MessageSink outputMessageSink)
           
 
Method Summary
protected abstract  java.lang.String buildCommand()
           
protected  java.lang.String buildEnvironmentCommand()
           
protected  java.lang.String buildUnixEnvironmentCommand()
           
protected  java.lang.String buildWindowsEnvironmentCommand()
           
 MessageLogger getErrorMessageLogger()
          Returns the MessageLogger handling the error stream of the process
 MessageLogger getInputMessageLogger()
          Returns the MessageLogger handling the input stream of the process
 MessageSink getOutputMessageSink()
          Returns the MessageSink handling the output stream of the process
protected  void handleError(java.io.BufferedReader err)
           
protected  void handleInput(java.io.BufferedReader in)
           
protected  void handleOutput(java.io.BufferedWriter out)
           
protected  void handleProcess(java.io.BufferedReader in, java.io.BufferedWriter out, java.io.BufferedReader err)
           
protected  void internalStartProcess(java.lang.String commandToExecute)
           
protected  void internalStopProcess()
           
protected  int internalWaitFor()
           
 void setErrorMessageLogger(MessageLogger errorMessageLogger)
          sets the MessageLogger handling the error stream of the process
 void setInputMessageLogger(MessageLogger inputMessageLogger)
          sets the MessageLogger handling the input stream of the process
 void setOutputMessageSink(MessageSink outputMessageSink)
          sets the MessageSink handling the output stream of the process
 
Methods inherited from class org.objectweb.proactive.core.process.AbstractUniversalProcess
checkStarted, getCertificateLocation, getCommand, getEnvironment, getHostname, getPrivateKeyLocation, getSecurityFile, getUsername, isFinished, isStarted, setCertificateLocation, setEnvironment, setHostname, setPrivateKeyLocation, setSecurityFile, setUsername, startProcess, stopProcess, toString, toString, waitFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.objectweb.proactive.core.process.UniversalProcess
getCertificateLocation, getCommand, getEnvironment, getHostname, getPrivateKeyLocation, getSecurityFile, getUsername, isFinished, isStarted, setCertificateLocation, setEnvironment, setHostname, setPrivateKeyLocation, setSecurityFile, setUsername, startProcess, stopProcess, waitFor
 

Field Detail

clogger

protected static org.apache.log4j.Logger clogger

IS_WINDOWS_SYSTEM

protected static final boolean IS_WINDOWS_SYSTEM

externalProcess

protected java.lang.Process externalProcess

inputMessageLogger

protected MessageLogger inputMessageLogger

errorMessageLogger

protected MessageLogger errorMessageLogger

outputMessageSink

protected MessageSink outputMessageSink
Constructor Detail

AbstractExternalProcess

protected AbstractExternalProcess()

AbstractExternalProcess

public AbstractExternalProcess(MessageLogger messageLogger)

AbstractExternalProcess

public AbstractExternalProcess(MessageLogger inputMessageLogger,
                               MessageLogger errorMessageLogger)

AbstractExternalProcess

public AbstractExternalProcess(MessageLogger inputMessageLogger,
                               MessageLogger errorMessageLogger,
                               MessageSink outputMessageSink)
Method Detail

getInputMessageLogger

public MessageLogger getInputMessageLogger()
Description copied from interface: ExternalProcess
Returns the MessageLogger handling the input stream of the process

Specified by:
getInputMessageLogger in interface ExternalProcess
Returns:
the MessageLogger handling the input stream of the process

getErrorMessageLogger

public MessageLogger getErrorMessageLogger()
Description copied from interface: ExternalProcess
Returns the MessageLogger handling the error stream of the process

Specified by:
getErrorMessageLogger in interface ExternalProcess
Returns:
the MessageLogger handling the error stream of the process

getOutputMessageSink

public MessageSink getOutputMessageSink()
Description copied from interface: ExternalProcess
Returns the MessageSink handling the output stream of the process

Specified by:
getOutputMessageSink in interface ExternalProcess
Returns:
the MessageSink handling the output stream of the process

setInputMessageLogger

public void setInputMessageLogger(MessageLogger inputMessageLogger)
Description copied from interface: ExternalProcess
sets the MessageLogger handling the input stream of the process

Specified by:
setInputMessageLogger in interface ExternalProcess
Parameters:
inputMessageLogger - the handler of the input stream of the process

setErrorMessageLogger

public void setErrorMessageLogger(MessageLogger errorMessageLogger)
Description copied from interface: ExternalProcess
sets the MessageLogger handling the error stream of the process

Specified by:
setErrorMessageLogger in interface ExternalProcess
Parameters:
errorMessageLogger - the handler of the error stream of the process

setOutputMessageSink

public void setOutputMessageSink(MessageSink outputMessageSink)
Description copied from interface: ExternalProcess
sets the MessageSink handling the output stream of the process

Specified by:
setOutputMessageSink in interface ExternalProcess
Parameters:
outputMessageSink - the handler of the output stream of the process

buildCommand

protected abstract java.lang.String buildCommand()
Specified by:
buildCommand in class AbstractUniversalProcess

buildEnvironmentCommand

protected java.lang.String buildEnvironmentCommand()

buildWindowsEnvironmentCommand

protected java.lang.String buildWindowsEnvironmentCommand()

buildUnixEnvironmentCommand

protected java.lang.String buildUnixEnvironmentCommand()

internalStartProcess

protected void internalStartProcess(java.lang.String commandToExecute)
                             throws java.io.IOException
Specified by:
internalStartProcess in class AbstractUniversalProcess
java.io.IOException

internalStopProcess

protected void internalStopProcess()
Specified by:
internalStopProcess in class AbstractUniversalProcess

internalWaitFor

protected int internalWaitFor()
                       throws java.lang.InterruptedException
Specified by:
internalWaitFor in class AbstractUniversalProcess
java.lang.InterruptedException

handleProcess

protected void handleProcess(java.io.BufferedReader in,
                             java.io.BufferedWriter out,
                             java.io.BufferedReader err)

handleInput

protected void handleInput(java.io.BufferedReader in)

handleError

protected void handleError(java.io.BufferedReader err)

handleOutput

protected void handleOutput(java.io.BufferedWriter out)


Copyright © April 2004 INRIA All Rights Reserved.