org.objectweb.proactive.core.process
Class AbstractUniversalProcess

java.lang.Object
  extended byorg.objectweb.proactive.core.process.AbstractUniversalProcess
All Implemented Interfaces:
java.io.Serializable, UniversalProcess
Direct Known Subclasses:
AbstractExternalProcess

public abstract class AbstractUniversalProcess
extends java.lang.Object
implements UniversalProcess

See Also:
Serialized Form

Field Summary
protected  java.lang.String certificateLocation
           
protected  java.lang.String command
           
protected  java.lang.String command_path
           
static java.lang.String DEFAULT_HOSTNAME
           
static java.lang.String DEFAULT_USERNAME
           
protected  java.lang.String[] environment
           
protected  java.lang.String hostname
           
protected  boolean isFinished
           
protected  boolean isStarted
           
protected static java.lang.String LOCALHOST
           
protected  java.lang.String privateKeyLocation
           
protected  java.lang.String securityFile
           
protected  java.lang.String username
           
 
Fields inherited from interface org.objectweb.proactive.core.process.UniversalProcess
logger, UNKNOWN_NODE_NUMBER
 
Constructor Summary
protected AbstractUniversalProcess()
           
 
Method Summary
protected abstract  java.lang.String buildCommand()
           
protected  void checkStarted()
           
 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.
 java.lang.String getHostname()
          Return the hostname target of this process.
 java.lang.String getUsername()
          Return the username that will be used to run the command.
protected abstract  void internalStartFileTransfer(FileTransferWorkShop fts)
          Starts the FileTransfer specified by the parameter.
protected abstract  void internalStartProcess(java.lang.String commandToExecute)
           
protected abstract  void internalStopProcess()
           
protected abstract  int internalWaitFor()
           
 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 pushProcessAttributes(FileTransferWorkShop.StructureInformation infoParams)
          This method sets attributes into the FileTransferWorkshop.StructureInformation For now: : hostname, username If the attributes already exists then it remains unchanged.
 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.
 java.lang.String toString()
           
protected  void toString(java.lang.StringBuffer sb)
           
 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, wait, wait, wait
 
Methods inherited from interface org.objectweb.proactive.core.process.UniversalProcess
getFinalProcess, getNodeNumber, getProcessId
 

Field Detail

LOCALHOST

protected static final java.lang.String LOCALHOST

DEFAULT_USERNAME

public static final java.lang.String DEFAULT_USERNAME

DEFAULT_HOSTNAME

public static final java.lang.String DEFAULT_HOSTNAME

hostname

protected java.lang.String hostname

username

protected java.lang.String username

environment

protected java.lang.String[] environment

command

protected java.lang.String command

command_path

protected java.lang.String command_path

isStarted

protected boolean isStarted

isFinished

protected boolean isFinished

certificateLocation

protected java.lang.String certificateLocation

privateKeyLocation

protected java.lang.String privateKeyLocation

securityFile

protected java.lang.String securityFile
Constructor Detail

AbstractUniversalProcess

protected AbstractUniversalProcess()
Method Detail

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

startFileTransfer

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

Specified by:
startFileTransfer in interface UniversalProcess

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

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

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.

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.

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.

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.

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.

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

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

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

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

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

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

toString

public java.lang.String toString()

toString

protected void toString(java.lang.StringBuffer sb)

checkStarted

protected void checkStarted()

buildCommand

protected abstract java.lang.String buildCommand()

internalStartProcess

protected abstract void internalStartProcess(java.lang.String commandToExecute)
                                      throws java.io.IOException
Throws:
java.io.IOException

internalStartFileTransfer

protected abstract void internalStartFileTransfer(FileTransferWorkShop fts)
Starts the FileTransfer specified by the parameter.


internalStopProcess

protected abstract void internalStopProcess()

internalWaitFor

protected abstract int internalWaitFor()
                                throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

pushProcessAttributes

protected void pushProcessAttributes(FileTransferWorkShop.StructureInformation infoParams)
This method sets attributes into the FileTransferWorkshop.StructureInformation For now: : hostname, username If the attributes already exists then it remains unchanged. This method should be overriden if the process want's to set specific parameters to the FileTransferWorkshop before starting the FileTransfer.

Parameters:
infoParams -


Copyright 2001-2005 INRIA All Rights Reserved.