edu.rice.cs.util
Class ProcessCreator

java.lang.Object
  extended by edu.rice.cs.util.ProcessCreator
Direct Known Subclasses:
GeneralProcessCreator

public class ProcessCreator
extends Object

This class abstracts out process creation, similar to ProcessCreator, which is only available in Java 1.5. This ProcessCreator cannot deal with process sequences and chains. It can only create one processes.


Field Summary
protected  String _cachedCmdLine
          Cached copy of the reconstructed command line.
protected  String[] _cmdarray
           
protected  String _cmdline
           
protected  Map<String,String> _env
           
protected  String _evaluatedCmdLine
           
protected  String _evaluatedWorkDir
           
protected  PropertyMaps _props
           
protected  String _workdir
           
 
Constructor Summary
protected ProcessCreator()
          Degenerate constructor, only for subclasses that completely override this class.
  ProcessCreator(String[] cmdarray, String workdir)
          Constructor for a process creator with the given command line already split up, and map of properties.
  ProcessCreator(String cmdline, String workdir, PropertyMaps pm)
          Constructor for a process creator with the given command line and map of properties.
 
Method Summary
 String cmdline()
          Get the command line.
 Map<String,String> environment()
          Returns a map of this process creator's environment.
 String evaluatedCommandLine()
          Return the command line after evaluation, or null if it hasn't been replaced yet.
 String evaluatedWorkDir()
          Return the work directory after evaluation, or null if it hasn't been replaced yet.
 PropertyMaps getPropertyMaps()
          Return the PropertyMaps object used for substitution.
 Process start()
          Starts a new process using the attributes of this process creator.
 String workDir()
          Returns this process creator's working directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_cmdline

protected String _cmdline

_evaluatedCmdLine

protected String _evaluatedCmdLine

_workdir

protected String _workdir

_evaluatedWorkDir

protected String _evaluatedWorkDir

_cmdarray

protected String[] _cmdarray

_env

protected Map<String,String> _env

_props

protected PropertyMaps _props

_cachedCmdLine

protected String _cachedCmdLine
Cached copy of the reconstructed command line.

Constructor Detail

ProcessCreator

protected ProcessCreator()
Degenerate constructor, only for subclasses that completely override this class.


ProcessCreator

public ProcessCreator(String cmdline,
                      String workdir,
                      PropertyMaps pm)
Constructor for a process creator with the given command line and map of properties.

Parameters:
cmdline - command line
workdir - working directory
pm - PropertyMaps used for substitution when replacing variables

ProcessCreator

public ProcessCreator(String[] cmdarray,
                      String workdir)
Constructor for a process creator with the given command line already split up, and map of properties.

Parameters:
cmdarray - array of command line arguments
workdir - working directory
Method Detail

cmdline

public String cmdline()
Get the command line.

Returns:
command line

environment

public Map<String,String> environment()
Returns a map of this process creator's environment.

Returns:
environment map

workDir

public String workDir()
Returns this process creator's working directory.

Returns:
working directory

evaluatedCommandLine

public String evaluatedCommandLine()
Return the command line after evaluation, or null if it hasn't been replaced yet.


evaluatedWorkDir

public String evaluatedWorkDir()
Return the work directory after evaluation, or null if it hasn't been replaced yet.


getPropertyMaps

public PropertyMaps getPropertyMaps()
Return the PropertyMaps object used for substitution.


start

public Process start()
              throws IOException
Starts a new process using the attributes of this process creator.

Throws:
IOException