org.objectweb.proactive.core.process
Class JVMProcessImpl

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

public class JVMProcessImpl
extends AbstractExternalProcess
implements JVMProcess, java.io.Serializable

The JVMProcess class is able to start localy any class of the ProActive library by creating a Java Virtual Machine.

For instance:

 .............
 JVMProcessImpl process = new JVMProcessImpl(new StandardOutputMessageLogger());
 process.setClassname("org.objectweb.proactive.core.node.StartNode");
 process.setParameters("nodeName");
 process.startProcess();
 .............
 

This piece of code launches the ProActive java class org.objectweb.proactive.core.node.StartNode with nodeName as parameter.

Since:
ProActive 0.9.4
Version:
1.0, 2002/09/20
Author:
ProActive Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.objectweb.proactive.core.process.AbstractExternalProcess
AbstractExternalProcess.NullMessageLogger, AbstractExternalProcess.ProcessInputHandler, AbstractExternalProcess.ProcessOutputHandler, AbstractExternalProcess.SimpleMessageSink, AbstractExternalProcess.StandardOutputMessageLogger
 
Field Summary
protected  java.lang.String bootClasspath
           
protected  java.lang.String classname
           
protected  java.lang.String classpath
           
static java.lang.String DEFAULT_CLASSNAME
           
static java.lang.String DEFAULT_CLASSPATH
           
static java.lang.String DEFAULT_JAVAPATH
           
static java.lang.String DEFAULT_JVMPARAMETERS
           
static java.lang.String DEFAULT_LOG4J_FILE
           
static java.lang.String DEFAULT_POLICY_FILE
           
protected  java.lang.String javaPath
           
protected  java.lang.StringBuffer jvmParameters
           
protected  java.lang.String log4jFile
           
protected  java.util.ArrayList modifiedOptions
           
protected  boolean overwrite
          This attributes is used when this jvm extends another one.
protected  java.lang.StringBuffer parameters
           
protected  java.lang.String policyFile
           
 
Fields inherited from class org.objectweb.proactive.core.process.AbstractExternalProcess
clogger, closeStream, errorMessageLogger, externalProcess, FILE_TRANSFER_DEFAULT_PROTOCOL, fileTransferLogger, inputMessageLogger, IS_WINDOWS_SYSTEM, NO_COMPOSITION, outputMessageSink
 
Fields inherited from class org.objectweb.proactive.core.process.AbstractUniversalProcess
certificateLocation, command, command_path, DEFAULT_HOSTNAME, DEFAULT_USERNAME, environment, hostname, isFinished, isStarted, LOCALHOST, privateKeyLocation, securityFile, username
 
Fields inherited from interface org.objectweb.proactive.core.process.UniversalProcess
UNKNOWN_NODE_NUMBER
 
Constructor Summary
JVMProcessImpl()
          Creates a new JVMProcess Used with XML Descriptor
JVMProcessImpl(RemoteProcessMessageLogger messageLogger)
          Creates a new JVMProcess
JVMProcessImpl(RemoteProcessMessageLogger inputMessageLogger, RemoteProcessMessageLogger errorMessageLogger)
          Creates a new JVMProcess
 
Method Summary
protected  java.lang.String buildCommand()
           
protected  java.lang.String buildJavaCommand()
           
protected  void changeSettings(JVMProcess jvmProcess)
           
 java.lang.String getBootClasspath()
          Returns the boot classpath associated to this process
 java.lang.String getClassname()
          Returns the class name that this process is about to start
 java.lang.String getClasspath()
          Returns the classpath associated to this process
 UniversalProcess getFinalProcess()
          Returns the last process of the chain
 java.lang.String getJavaPath()
          Returns the java path associated to this process.
 java.lang.String getJvmOptions()
          Returns this jvm options
 java.lang.String getLog4jFile()
          Returns the location of the log4j property file.
 int getNodeNumber()
          Returns the number of nodes targeted
 java.lang.String getParameters()
          Returns parameters associated to the class that this process is going to start
 java.lang.String getPolicyFile()
          Returns the location (path) to the policy file
 java.lang.String getProcessId()
          Returns the id of the process
static void main(java.lang.String[] args)
           
 void resetParameters()
          Reset to empty value parameters associated to the class that this process is going to start
 void setBootClasspath(java.lang.String bootClasspath)
          Sets the boot classpath associated to this process
 void setClassname(java.lang.String classname)
          Sets the value of the class to start for this process
 void setClasspath(java.lang.String classpath)
          Sets the classpath for this process
 void setExtendedJVM(JVMProcessImpl jvmProcess)
          Allows this JVMProcess to extend another JVMProcessImpl.
 void setJavaPath(java.lang.String javaPath)
          Sets the java path for this process
 void setJvmOptions(java.lang.String string)
          Sets the options of the jvm to start For instance: jvmProcess.set JvmOptions("-verbose -Xms300M -Xmx300m");
 void setLog4jFile(java.lang.String log4jFile)
          Sets the location of the log4j property file.
 void setOverwrite(boolean overwrite)
          Sets the overwrite attribute with the given value
 void setParameters(java.lang.String parameters)
          Sets the parameters of the class to start with the given value
 void setPolicyFile(java.lang.String policyFile)
          Sets the location of the policy file
 
Methods inherited from class org.objectweb.proactive.core.process.AbstractExternalProcess
buildEnvironmentCommand, buildUnixEnvironmentCommand, buildWindowsEnvironmentCommand, closeStream, getCompositionType, getErrorMessageLogger, getFileTransferDefaultCopyProtocol, getFileTransferWorkShopDeploy, getFileTransferWorkShopRetrieve, getInputMessageLogger, getOutputMessageSink, handleError, handleInput, handleOutput, handleProcess, internalFileTransferDefaultProtocol, internalStartFileTransfer, internalStartProcess, internalStopProcess, internalWaitFor, setErrorMessageLogger, setInputMessageLogger, setOutputMessageSink
 
Methods inherited from class org.objectweb.proactive.core.process.AbstractUniversalProcess
checkStarted, getCommand, getCommandPath, getEnvironment, getHostname, getUsername, isFinished, isHierarchical, isStarted, pushProcessAttributes, setCommandPath, setEnvironment, setHostname, setUsername, startFileTransfer, 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.ExternalProcess
closeStream, getCompositionType, getErrorMessageLogger, getFileTransferWorkShopDeploy, getFileTransferWorkShopRetrieve, getInputMessageLogger, getOutputMessageSink, setErrorMessageLogger, setInputMessageLogger, setOutputMessageSink
 
Methods inherited from interface org.objectweb.proactive.core.process.UniversalProcess
getCommand, getCommandPath, getEnvironment, getHostname, getUsername, isFinished, isHierarchical, isStarted, setCommandPath, setEnvironment, setHostname, setUsername, startFileTransfer, startProcess, stopProcess, waitFor
 

Field Detail

DEFAULT_CLASSPATH

public static final java.lang.String DEFAULT_CLASSPATH

DEFAULT_JAVAPATH

public static final java.lang.String DEFAULT_JAVAPATH

DEFAULT_POLICY_FILE

public static java.lang.String DEFAULT_POLICY_FILE

DEFAULT_LOG4J_FILE

public static java.lang.String DEFAULT_LOG4J_FILE

DEFAULT_CLASSNAME

public static final java.lang.String DEFAULT_CLASSNAME
See Also:
Constant Field Values

DEFAULT_JVMPARAMETERS

public static final java.lang.String DEFAULT_JVMPARAMETERS
See Also:
Constant Field Values

classpath

protected java.lang.String classpath

bootClasspath

protected java.lang.String bootClasspath

javaPath

protected java.lang.String javaPath

policyFile

protected java.lang.String policyFile

log4jFile

protected java.lang.String log4jFile

classname

protected java.lang.String classname

parameters

protected java.lang.StringBuffer parameters

jvmParameters

protected java.lang.StringBuffer jvmParameters

modifiedOptions

protected java.util.ArrayList modifiedOptions

overwrite

protected boolean overwrite
This attributes is used when this jvm extends another one. If set to yes, the jvm options of the extended jvm will be ignored. If false, jvm options of this jvm will be appended to extended jvm ones. Default is false.

Constructor Detail

JVMProcessImpl

public JVMProcessImpl()
Creates a new JVMProcess Used with XML Descriptor


JVMProcessImpl

public JVMProcessImpl(RemoteProcessMessageLogger messageLogger)
Creates a new JVMProcess

Parameters:
messageLogger - The logger that handles input and error stream of this process

JVMProcessImpl

public JVMProcessImpl(RemoteProcessMessageLogger inputMessageLogger,
                      RemoteProcessMessageLogger errorMessageLogger)
Creates a new JVMProcess

Parameters:
inputMessageLogger - The logger that handles input stream of this process
errorMessageLogger - The logger that handles error stream of this process
Method Detail

main

public static void main(java.lang.String[] args)

getClasspath

public java.lang.String getClasspath()
Description copied from interface: JVMProcess
Returns the classpath associated to this process

Specified by:
getClasspath in interface JVMProcess
Returns:
String

setClasspath

public void setClasspath(java.lang.String classpath)
Description copied from interface: JVMProcess
Sets the classpath for this process

Specified by:
setClasspath in interface JVMProcess
Parameters:
classpath - The value of the classpath environment variable

setBootClasspath

public void setBootClasspath(java.lang.String bootClasspath)
Description copied from interface: JVMProcess
Sets the boot classpath associated to this process

Specified by:
setBootClasspath in interface JVMProcess
Parameters:
bootClasspath - The boot classpath of the java command

getBootClasspath

public java.lang.String getBootClasspath()
Description copied from interface: JVMProcess
Returns the boot classpath associated to this process

Specified by:
getBootClasspath in interface JVMProcess
Returns:
String the boot classpath of the java command

getJavaPath

public java.lang.String getJavaPath()
Description copied from interface: JVMProcess
Returns the java path associated to this process.

Specified by:
getJavaPath in interface JVMProcess
Returns:
String The path to the java command

setJavaPath

public void setJavaPath(java.lang.String javaPath)
Description copied from interface: JVMProcess
Sets the java path for this process

Specified by:
setJavaPath in interface JVMProcess
Parameters:
javaPath - The value of the path to execute 'java' command

getPolicyFile

public java.lang.String getPolicyFile()
Description copied from interface: JVMProcess
Returns the location (path) to the policy file

Specified by:
getPolicyFile in interface JVMProcess
Returns:
String The path to the policy file

setPolicyFile

public void setPolicyFile(java.lang.String policyFile)
Description copied from interface: JVMProcess
Sets the location of the policy file

Specified by:
setPolicyFile in interface JVMProcess
Parameters:
policyFile - The value of the path to the policy file

getLog4jFile

public java.lang.String getLog4jFile()
Description copied from interface: JVMProcess
Returns the location of the log4j property file.

Specified by:
getLog4jFile in interface JVMProcess
Returns:
String the location of the log4j property file

setLog4jFile

public void setLog4jFile(java.lang.String log4jFile)
Description copied from interface: JVMProcess
Sets the location of the log4j property file.

Specified by:
setLog4jFile in interface JVMProcess
Parameters:
log4jFile - The value of the path to the log4j property file

getClassname

public java.lang.String getClassname()
Description copied from interface: JVMProcess
Returns the class name that this process is about to start

Specified by:
getClassname in interface JVMProcess
Returns:
String The value of the class that this process is going to start

setClassname

public void setClassname(java.lang.String classname)
Description copied from interface: JVMProcess
Sets the value of the class to start for this process

Specified by:
setClassname in interface JVMProcess
Parameters:
classname - The name of the class to start

getParameters

public java.lang.String getParameters()
Description copied from interface: JVMProcess
Returns parameters associated to the class that this process is going to start

Specified by:
getParameters in interface JVMProcess
Returns:
String The value of the parameters of the class

resetParameters

public void resetParameters()
Description copied from interface: JVMProcess
Reset to empty value parameters associated to the class that this process is going to start

Specified by:
resetParameters in interface JVMProcess

setParameters

public void setParameters(java.lang.String parameters)
Description copied from interface: JVMProcess
Sets the parameters of the class to start with the given value

Specified by:
setParameters in interface JVMProcess
Parameters:
parameters - Paramaters to be given in order to start the class

setJvmOptions

public void setJvmOptions(java.lang.String string)
Description copied from interface: JVMProcess
Sets the options of the jvm to start

For instance:

 jvmProcess.set JvmOptions("-verbose -Xms300M -Xmx300m");
 

Specified by:
setJvmOptions in interface JVMProcess
Parameters:
string - Options to be given in order to start the jvm

getJvmOptions

public java.lang.String getJvmOptions()
Description copied from interface: JVMProcess
Returns this jvm options

Specified by:
getJvmOptions in interface JVMProcess
Returns:
this jvm options

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()

setOverwrite

public void setOverwrite(boolean overwrite)
Description copied from interface: JVMProcess
Sets the overwrite attribute with the given value

Specified by:
setOverwrite in interface JVMProcess
Parameters:
overwrite -

setExtendedJVM

public void setExtendedJVM(JVMProcessImpl jvmProcess)
Description copied from interface: JVMProcess
Allows this JVMProcess to extend another JVMProcessImpl. First implementation of this method. This method must be used carefully. Here is the basic behavior: If attributes are modified on this JVM using set methods, they keep the modified value, otherwise they take the value of the extended jvm. This doesn't apply for classname, and parameters. Moreover, for the jvm options, the default behavior is to append the options of this jvm to the extended jvm ones, unless the setOverwrite is called previously with true as parameters In that case the jvm options of the extended jvm are ignored. At this point this method is only used in deployment descriptors.

Specified by:
setExtendedJVM in interface JVMProcess
Parameters:
jvmProcess - the extended jvm

buildCommand

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

buildJavaCommand

protected java.lang.String buildJavaCommand()

changeSettings

protected void changeSettings(JVMProcess jvmProcess)


Copyright 2001-2005 INRIA All Rights Reserved.