org.objectweb.proactive.core.process
Class AbstractListProcessDecorator

java.lang.Object
  extended byorg.objectweb.proactive.core.process.AbstractListProcessDecorator
All Implemented Interfaces:
ExternalProcess, ExternalProcessDecorator, java.io.Serializable, UniversalProcess
Direct Known Subclasses:
RLoginProcessList, RSHProcessList, SSHProcessList

public abstract class AbstractListProcessDecorator
extends java.lang.Object
implements ExternalProcessDecorator

This class contains a list of ExternalProcessDecorator processes that share the same configuration. It represents a wrapper on the list of processes.

Since:
ProActive 2.2
Version:
1.0, 2 mars 2005
Author:
ProActiveTeam
See Also:
Serialized Form

Field Summary
protected  ExternalProcessDecorator baseProcess
           
protected  java.lang.String beginIndex
           
protected  java.lang.String domain
           
protected  java.lang.String endIndex
           
protected  java.util.ArrayList excludeArray
           
protected  java.lang.String fixedName
           
protected  java.lang.String list
           
protected  int nodeNumber
           
protected  int padding
           
protected  java.util.ArrayList processes
           
protected  int step
           
 
Fields inherited from interface org.objectweb.proactive.core.process.ExternalProcessDecorator
APPEND_TO_COMMAND_COMPOSITION, COPY_FILE_AND_APPEND_COMMAND, GIVE_COMMAND_AS_PARAMETER, SEND_TO_OUTPUT_STREAM_COMPOSITION
 
Fields inherited from interface org.objectweb.proactive.core.process.UniversalProcess
logger, UNKNOWN_NODE_NUMBER
 
Constructor Summary
AbstractListProcessDecorator()
           
 
Method Summary
protected  boolean checkNonEmpty(java.lang.String s)
           
 void closeStream()
          Closes Input, Output, Error stream just after forking this process
protected abstract  ExternalProcessDecorator createProcess()
           
 java.lang.String getCommand()
          Returns the command that will be or has been execute by the process.
 java.lang.String getCommandPath()
          Returns the path of the command to be executed by this process
 int getCompositionType()
          Returns the type of this process.
 java.lang.String[] getEnvironment()
          Returns the current environment for this process.
 RemoteProcessMessageLogger getErrorMessageLogger()
          Returns the RemoteProcessMessageLogger handling the error stream of the process
 FileTransferWorkShop getFileTransferWorkShopDeploy()
          This method returns a single FileTransferStructure instance for this process.
 FileTransferWorkShop getFileTransferWorkShopRetrieve()
          This method returns a single FileTransferStructure instance for this process.
 UniversalProcess getFinalProcess()
          Returns the last process of the chain
 java.lang.String getHostname()
          Return the hostname target of this process.
 RemoteProcessMessageLogger getInputMessageLogger()
          Returns the RemoteProcessMessageLogger handling the input stream of the process
 int getNodeNumber()
          Returns the number of nodes targeted
 MessageSink getOutputMessageSink()
          Returns the MessageSink handling the output stream of the process
 java.lang.String getProcessId()
          Returns the id of the process
 ExternalProcess getTargetProcess()
          Returns the process target of this process.
 java.lang.String getUsername()
          Return the username that will be used to run the command.
protected  java.lang.String handlePadding(java.lang.String word)
           
 boolean isFinished()
          Returns true if and only if this process has been stopped.
 boolean isHierarchical()
          Returns true if and only if this process is hierarchical
 boolean isStarted()
          Returns true if and only if this process has been started.
protected  void setAllIndex(java.lang.String list)
           
 void setCommandPath(java.lang.String path)
          Sets the path of the command to be executed by this process
 void setCompositionType(int compositionType)
          Sets the type of composition that occurs between the commands of two processes.
 void setEnvironment(java.lang.String[] environment)
          Set the environment for this process.
 void setErrorMessageLogger(RemoteProcessMessageLogger errorMessageLogger)
          sets the RemoteProcessMessageLogger handling the error stream of the process
 void setHostConfig(java.lang.String fixedName, java.lang.String list, java.lang.String domain, int padding)
           
 void setHostList(java.lang.String hostlistattr, java.lang.String domain)
           
 void setHostname(java.lang.String hostname)
          Set the hostname target of this process.
 void setInputMessageLogger(RemoteProcessMessageLogger inputMessageLogger)
          sets the RemoteProcessMessageLogger handling the input stream of the process
 void setOutputMessageSink(MessageSink outputMessageSink)
          sets the MessageSink handling the output stream of the process
 void setTargetProcess(ExternalProcess targetProcess)
          Sets the process target of this process.
 void setUsername(java.lang.String username)
          Set the username that will be used to run the command.
 void startFileTransfer()
          Starts the FileTransfer if defined for this process.
 void startProcess()
          Starts the process by executing the command.
 void stopProcess()
          Stops the running process.
 int waitFor()
          Causes the current thread to wait until this Process has terminated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

processes

protected java.util.ArrayList processes

baseProcess

protected ExternalProcessDecorator baseProcess

fixedName

protected java.lang.String fixedName

domain

protected java.lang.String domain

list

protected java.lang.String list

beginIndex

protected java.lang.String beginIndex

endIndex

protected java.lang.String endIndex

padding

protected int padding

step

protected int step

excludeArray

protected java.util.ArrayList excludeArray

nodeNumber

protected int nodeNumber
Constructor Detail

AbstractListProcessDecorator

public AbstractListProcessDecorator()
Method Detail

setHostConfig

public void setHostConfig(java.lang.String fixedName,
                          java.lang.String list,
                          java.lang.String domain,
                          int padding)

setHostList

public void setHostList(java.lang.String hostlistattr,
                        java.lang.String domain)

getTargetProcess

public ExternalProcess getTargetProcess()
Description copied from interface: ExternalProcessDecorator
Returns the process target of this process. The target process is embedded inside the current process.

Specified by:
getTargetProcess in interface ExternalProcessDecorator
Returns:
the process target of this process
See Also:
ExternalProcessDecorator.getTargetProcess()

setTargetProcess

public void setTargetProcess(ExternalProcess targetProcess)
Description copied from interface: ExternalProcessDecorator
Sets the process target of this process. The target process is embedded inside the current process.

Specified by:
setTargetProcess in interface ExternalProcessDecorator
Parameters:
targetProcess - the process target of this process
See Also:
ExternalProcessDecorator.setTargetProcess(org.objectweb.proactive.core.process.ExternalProcess)

getCompositionType

public int getCompositionType()
Description copied from interface: ExternalProcess
Returns the type of this process. For processes that does not reference another process, the type is NO_COMPOSITION For other types are APPEND_TO_COMMAND_COMPOSITION or SEND_TO_OUTPUT_STREAM_COMPOSITION or GIVE_COMMAND_AS_PARAMETER or COPY_FILE_AND_APPEND_COMMAND.

Specified by:
getCompositionType in interface ExternalProcess
Returns:
the type this process.
See Also:
ExternalProcess.getCompositionType()

setCompositionType

public void setCompositionType(int compositionType)
Description copied from interface: ExternalProcessDecorator
Sets the type of composition that occurs between the commands of two processes. Type are APPEND_TO_COMMAND_COMPOSITION or SEND_TO_OUTPUT_STREAM_COMPOSITION.

Specified by:
setCompositionType in interface ExternalProcessDecorator
Parameters:
compositionType - the type of composition that occurs between the commands of two processes
See Also:
ExternalProcessDecorator.setCompositionType(int)

getFileTransferWorkShopRetrieve

public FileTransferWorkShop getFileTransferWorkShopRetrieve()
Description copied from interface: ExternalProcess
This method returns a single FileTransferStructure instance for this process. If many invocations to this method are done, the same instance of FileTransferStructure will be returned. This means, that changes made to the structure will be reflected on all the references obtained through this method for this process. Note that different process do not share a FileTransferStructure, and thus changes made to one will not reflect on the other.

Specified by:
getFileTransferWorkShopRetrieve in interface ExternalProcess

getFileTransferWorkShopDeploy

public FileTransferWorkShop getFileTransferWorkShopDeploy()
Description copied from interface: ExternalProcess
This method returns a single FileTransferStructure instance for this process. If many invocations to this method are done, the same instance of FileTransferStructure will be returned. This means, that changes made to the structure will be reflected on all the references obtained through this method for this process. Note that different process do not share a FileTransferStructure, and thus changes made to one will not reflect on the other.

Specified by:
getFileTransferWorkShopDeploy in interface ExternalProcess

startFileTransfer

public void startFileTransfer()
Description copied from interface: UniversalProcess
Starts the FileTransfer if defined for this process.

Specified by:
startFileTransfer in interface UniversalProcess

closeStream

public void closeStream()
Description copied from interface: ExternalProcess
Closes Input, Output, Error stream just after forking this process

Specified by:
closeStream in interface ExternalProcess
See Also:
ExternalProcess.closeStream()

getInputMessageLogger

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

Specified by:
getInputMessageLogger in interface ExternalProcess
Returns:
the RemoteProcessMessageLogger handling the input stream of the process
See Also:
ExternalProcess.getInputMessageLogger()

getErrorMessageLogger

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

Specified by:
getErrorMessageLogger in interface ExternalProcess
Returns:
the RemoteProcessMessageLogger handling the error stream of the process
See Also:
ExternalProcess.getErrorMessageLogger()

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
See Also:
ExternalProcess.getOutputMessageSink()

setInputMessageLogger

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

Specified by:
setInputMessageLogger in interface ExternalProcess
Parameters:
inputMessageLogger - the handler of the input stream of the process
See Also:
ExternalProcess.setInputMessageLogger(org.objectweb.proactive.core.util.RemoteProcessMessageLogger)

setErrorMessageLogger

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

Specified by:
setErrorMessageLogger in interface ExternalProcess
Parameters:
errorMessageLogger - the handler of the error stream of the process
See Also:
ExternalProcess.setErrorMessageLogger(org.objectweb.proactive.core.util.RemoteProcessMessageLogger)

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
See Also:
ExternalProcess.setOutputMessageSink(org.objectweb.proactive.core.process.MessageSink)

getEnvironment

public java.lang.String[] getEnvironment()
Description copied from interface: UniversalProcess
Returns the current environment for this process. Each cell of the array contains the definition of one variable in a syntax that is system dependant.

Specified by:
getEnvironment in interface UniversalProcess
Returns:
an array of string containing all environment variables or null if the environment is empty
See Also:
UniversalProcess.getEnvironment()

setEnvironment

public void setEnvironment(java.lang.String[] environment)
Description copied from interface: UniversalProcess
Set the environment for this process. Each cell of the array contains the definition of one variable in a syntax that is system dependant.

Specified by:
setEnvironment in interface UniversalProcess
Parameters:
environment - an array of string containing all environment variables or null if the environment is empty
See Also:
UniversalProcess.setEnvironment(java.lang.String[])

getHostname

public java.lang.String getHostname()
Description copied from interface: UniversalProcess
Return the hostname target of this process.

Specified by:
getHostname in interface UniversalProcess
Returns:
the hostname target of this process.
See Also:
UniversalProcess.getHostname()

setHostname

public void setHostname(java.lang.String hostname)
Description copied from interface: UniversalProcess
Set the hostname target of this process. By default the target host is the localhost.

Specified by:
setHostname in interface UniversalProcess
Parameters:
hostname - the target hostname.
See Also:
UniversalProcess.setHostname(java.lang.String)

getUsername

public java.lang.String getUsername()
Description copied from interface: UniversalProcess
Return the username that will be used to run the command.

Specified by:
getUsername in interface UniversalProcess
Returns:
the username that will be used to run the command.
See Also:
UniversalProcess.getUsername()

setUsername

public void setUsername(java.lang.String username)
Description copied from interface: UniversalProcess
Set the username that will be used to run the command. By default the current username owner of the JVM process is used.

Specified by:
setUsername in interface UniversalProcess
Parameters:
username - the target username or null to use the default one.
See Also:
UniversalProcess.setUsername(java.lang.String)

getCommand

public java.lang.String getCommand()
Description copied from interface: UniversalProcess
Returns the command that will be or has been execute by the process.

Specified by:
getCommand in interface UniversalProcess
Returns:
the command of this external process
See Also:
UniversalProcess.getCommand()

getProcessId

public java.lang.String getProcessId()
Description copied from interface: UniversalProcess
Returns the id of the process

Specified by:
getProcessId in interface UniversalProcess
Returns:
the id of the process. This id is just the first letters of the process class, to be able to identify the sequence of processes used
See Also:
UniversalProcess.getProcessId()

getNodeNumber

public int getNodeNumber()
Description copied from interface: UniversalProcess
Returns the number of nodes targeted

Specified by:
getNodeNumber in interface UniversalProcess
Returns:
the number of nodes targeted. Represents the number of nodes expected to use when starting this process. If this number cannot be known, waiting for all available nodes for example, UNKNOWN_NODE_NUMBER is returned.
See Also:
UniversalProcess.getNodeNumber()

getFinalProcess

public UniversalProcess getFinalProcess()
Description copied from interface: UniversalProcess
Returns the last process of the chain

Specified by:
getFinalProcess in interface UniversalProcess
Returns:
the last process of the chain
See Also:
UniversalProcess.getFinalProcess()

startProcess

public void startProcess()
                  throws java.io.IOException
Description copied from interface: UniversalProcess
Starts the process by executing the command. The process can only be started once.

Specified by:
startProcess in interface UniversalProcess
Throws:
java.io.IOException - if the process cannot be started.
See Also:
UniversalProcess.startProcess()

stopProcess

public void stopProcess()
Description copied from interface: UniversalProcess
Stops the running process. If called on a stopped process this method has no effect.

Specified by:
stopProcess in interface UniversalProcess
See Also:
UniversalProcess.stopProcess()

waitFor

public int waitFor()
            throws java.lang.InterruptedException
Description copied from interface: UniversalProcess
Causes the current thread to wait until this Process has terminated. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.

Specified by:
waitFor in interface UniversalProcess
Returns:
int exit value
Throws:
java.lang.InterruptedException - if the current thread is interrupted by another thread while it is waiting. Then the wait is ended and an InterruptedException is thrown
See Also:
UniversalProcess.waitFor()

isStarted

public boolean isStarted()
Description copied from interface: UniversalProcess
Returns true if and only if this process has been started. A process that has been started can be finished or running.

Specified by:
isStarted in interface UniversalProcess
See Also:
UniversalProcess.isStarted()

isFinished

public boolean isFinished()
Description copied from interface: UniversalProcess
Returns true if and only if this process has been stopped. A process that has been stopped has been started and is no more running.

Specified by:
isFinished in interface UniversalProcess
See Also:
UniversalProcess.isFinished()

isHierarchical

public boolean isHierarchical()
Description copied from interface: UniversalProcess
Returns true if and only if this process is hierarchical

Specified by:
isHierarchical in interface UniversalProcess

setCommandPath

public void setCommandPath(java.lang.String path)
Description copied from interface: UniversalProcess
Sets the path of the command to be executed by this process

Specified by:
setCommandPath in interface UniversalProcess
See Also:
UniversalProcess.setCommandPath(java.lang.String)

getCommandPath

public java.lang.String getCommandPath()
Description copied from interface: UniversalProcess
Returns the path of the command to be executed by this process

Specified by:
getCommandPath in interface UniversalProcess
Returns:
the path of the command to be executed by this process
See Also:
UniversalProcess.getCommandPath()

createProcess

protected abstract ExternalProcessDecorator createProcess()

setAllIndex

protected void setAllIndex(java.lang.String list)

handlePadding

protected java.lang.String handlePadding(java.lang.String word)

checkNonEmpty

protected boolean checkNonEmpty(java.lang.String s)


Copyright 2001-2005 INRIA All Rights Reserved.