org.objectweb.proactive.core.process
Interface UniversalProcess

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
ExternalProcess, ExternalProcessDecorator, JVMProcess
All Known Implementing Classes:
AbstractExternalProcess, AbstractExternalProcessDecorator, 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
           
 
Method Summary
 java.lang.String getCertificateLocation()
           
 java.lang.String getCommand()
          Returns the command that will be or has been execute by the process.
 java.lang.String[] getEnvironment()
          Returns the current environment for this process.
 java.lang.String getHostname()
          Return the hostname target of this process.
 java.lang.String getPrivateKeyLocation()
           
 java.lang.String getSecurityFile()
           
 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 isStarted()
          Returns true if and only if this process has been started.
 void setCertificateLocation(java.lang.String file)
           
 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 setPrivateKeyLocation(java.lang.String privatekey)
           
 void setSecurityFile(java.lang.String privatekey)
           
 void setUsername(java.lang.String username)
          Set the username that will be used to run the command.
 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
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.


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.


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.


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

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.

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.


setCertificateLocation

public void setCertificateLocation(java.lang.String file)

getCertificateLocation

public java.lang.String getCertificateLocation()

setPrivateKeyLocation

public void setPrivateKeyLocation(java.lang.String privatekey)

getPrivateKeyLocation

public java.lang.String getPrivateKeyLocation()

setSecurityFile

public void setSecurityFile(java.lang.String privatekey)

getSecurityFile

public java.lang.String getSecurityFile()


Copyright © April 2004 INRIA All Rights Reserved.