org.objectweb.proactive.core.process
Interface UniversalProcess

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
ExternalProcess, ExternalProcessDecorator, JVMProcess
All Known Implementing Classes:
AbstractExternalProcess, AbstractExternalProcessDecorator, AbstractListProcessDecorator, AbstractUniversalProcess, JVMProcessImpl, RSHJVMProcess, SSHJVMProcess

public interface UniversalProcess
extends java.io.Serializable

A class implementing this interface is able to start a process based on a command to execute. The command is built from arbitrary parameters (up to the implementation) and from the environment. The external process can be customized up to the moment it is started. Once started the call to methods to set the command throw an exception.


Field Summary
static org.apache.log4j.Logger logger
           
static int UNKNOWN_NODE_NUMBER
           
 
Method Summary
 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
 java.lang.String[] getEnvironment()
          Returns the current environment for this process.
 UniversalProcess getFinalProcess()
          Returns the last process of the chain
 java.lang.String getHostname()
          Return the hostname target of this process.
 int getNodeNumber()
          Returns the number of nodes targeted
 java.lang.String getProcessId()
          Returns the id of the process
 java.lang.String getUsername()
          Return the username that will be used to run the command.
 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.
 void setCommandPath(java.lang.String path)
          Sets the path of the command to be executed by this process
 void setEnvironment(java.lang.String[] environment)
          Set the environment for this process.
 void setHostname(java.lang.String hostname)
          Set the hostname 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.
 

Field Detail

logger

public static final org.apache.log4j.Logger logger

UNKNOWN_NODE_NUMBER

public static final int UNKNOWN_NODE_NUMBER
See Also:
Constant Field Values
Method Detail

getEnvironment

public java.lang.String[] getEnvironment()
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.

Returns:
an array of string containing all environment variables or null if the environment is empty

setEnvironment

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

Parameters:
environment - an array of string containing all environment variables or null if the environment is empty

getHostname

public java.lang.String getHostname()
Return the hostname target of this process.

Returns:
the hostname target of this process.

setHostname

public void setHostname(java.lang.String hostname)
Set the hostname target of this process. By default the target host is the localhost.

Parameters:
hostname - the target hostname.

getUsername

public java.lang.String getUsername()
Return the username that will be used to run the command.

Returns:
the username that will be used to run the command.

setUsername

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

Parameters:
username - the target username or null to use the default one.

getCommand

public java.lang.String getCommand()
Returns the command that will be or has been execute by the process.

Returns:
the command of this external process

getProcessId

public java.lang.String getProcessId()
Returns the id of the process

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

getNodeNumber

public int getNodeNumber()
Returns the number of nodes targeted

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.

getFinalProcess

public UniversalProcess getFinalProcess()
Returns the last process of the chain

Returns:
the last process of the chain

startProcess

public void startProcess()
                  throws java.io.IOException
Starts the process by executing the command. The process can only be started once.

Throws:
java.io.IOException - if the process cannot be started.

startFileTransfer

public void startFileTransfer()
Starts the FileTransfer if defined for this process.


stopProcess

public void stopProcess()
Stops the running process. If called on a stopped process this method has no effect.


waitFor

public int waitFor()
            throws java.lang.InterruptedException
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.

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

isStarted

public boolean isStarted()
Returns true if and only if this process has been started. A process that has been started can be finished or running.


isFinished

public boolean isFinished()
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.


setCommandPath

public void setCommandPath(java.lang.String path)
Sets the path of the command to be executed by this process


getCommandPath

public java.lang.String getCommandPath()
Returns the path of the command to be executed by this process

Returns:
the path of the command to be executed by this process

isHierarchical

public boolean isHierarchical()
Returns true if and only if this process is hierarchical



Copyright 2001-2005 INRIA All Rights Reserved.