edu.rice.cs.util
Class GeneralProcessCreator

java.lang.Object
  extended by edu.rice.cs.util.ProcessCreator
      extended by edu.rice.cs.util.GeneralProcessCreator

public class GeneralProcessCreator
extends ProcessCreator

This class abstracts out process creation, similar to ProcessCreator, which is only available in Java 1.5. Additionally, it transparently creates process sequences and process chains, including piping.


Field Summary
protected  List<List<List<String>>> _seqs
           
static Log LOG
           
 
Fields inherited from class edu.rice.cs.util.ProcessCreator
_cachedCmdLine, _cmdarray, _cmdline, _env, _evaluatedCmdLine, _evaluatedWorkDir, _props, _workdir
 
Constructor Summary
GeneralProcessCreator(List<List<List<String>>> seqs, String workdir, PropertyMaps pm)
          Constructor for a process creator with the given command line already split up, and the work directory.
GeneralProcessCreator(String cmdline, String workdir, PropertyMaps pm)
          Constructor for a process creator with the given command line and the work directory.
 
Method Summary
 String cmdline()
          Get the command line.
 Map<String,String> environment()
          Returns a map of this process creator's environment.
protected static String getProcessChainCmdLine(List<List<String>> pipe)
          Reconstructs the command line for a process chain.
protected static String getProcessCmdLine(List<String> cmds)
          Reconstructs the command line for a simple process.
protected static String getProcessSequenceCmdLine(List<List<List<String>>> seqs)
          Reconstructs the command line for a process sequence.
 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 edu.rice.cs.util.ProcessCreator
evaluatedCommandLine, evaluatedWorkDir, getPropertyMaps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_seqs

protected volatile List<List<List<String>>> _seqs

LOG

public static final Log LOG
Constructor Detail

GeneralProcessCreator

public GeneralProcessCreator(String cmdline,
                             String workdir,
                             PropertyMaps pm)
Constructor for a process creator with the given command line and the work directory.

Parameters:
cmdline - command line
workdir - working directory
pm - PropertyMaps object used for substitution

GeneralProcessCreator

public GeneralProcessCreator(List<List<List<String>>> seqs,
                             String workdir,
                             PropertyMaps pm)
Constructor for a process creator with the given command line already split up, and the work directory.

Parameters:
seqs - a sequence of commands to pipe
workdir - working directory
pm - PropertyMaps object used for substitution
Method Detail

getProcessCmdLine

protected static String getProcessCmdLine(List<String> cmds)
Reconstructs the command line for a simple process.


getProcessChainCmdLine

protected static String getProcessChainCmdLine(List<List<String>> pipe)
Reconstructs the command line for a process chain.


getProcessSequenceCmdLine

protected static String getProcessSequenceCmdLine(List<List<List<String>>> seqs)
Reconstructs the command line for a process sequence.


cmdline

public String cmdline()
Get the command line.

Overrides:
cmdline in class ProcessCreator
Returns:
command line

environment

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

Overrides:
environment in class ProcessCreator
Returns:
environment map

workDir

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

Overrides:
workDir in class ProcessCreator
Returns:
working directory

start

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

Overrides:
start in class ProcessCreator
Throws:
IOException