com.phoenix_int.aserver.util
Class PHXRuntime

java.lang.Object
  extended by com.phoenix_int.aserver.util.PHXRuntime

public class PHXRuntime
extends java.lang.Object

this is a utility class for running processes. The class wraps the users desired process in a script that first switches to the desired directory.


Field Summary
static java.lang.String DEFAULT_SHELL
           
 
Constructor Summary
PHXRuntime()
           
 
Method Summary
 java.lang.Process exec(java.lang.String cmd, java.lang.String baseDir)
          runs the specified command.
 PHXProcess exec2(java.lang.String cmd, java.lang.String baseDir)
          runs the specified command.
 com.phoenix_int.aserver.util.IPHXProcessJobInfoListener getJobListener()
           
 java.lang.String getShell()
          returns the shell used to run programs
static void main(java.lang.String[] args)
           
 PHXRuntime setJobListener(com.phoenix_int.aserver.util.IPHXProcessJobInfoListener jobListener)
           
 void setShell(java.lang.String shell)
          sets the shell to use when running commands (applies to UNIX only)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SHELL

public static final java.lang.String DEFAULT_SHELL
See Also:
Constant Field Values
Constructor Detail

PHXRuntime

public PHXRuntime()
Method Detail

setShell

public void setShell(java.lang.String shell)
sets the shell to use when running commands (applies to UNIX only)

Parameters:
shell - the shell to use. E.g. "csh". If null is specified, then the command is issued directly without a shell

getShell

public java.lang.String getShell()
returns the shell used to run programs


setJobListener

public PHXRuntime setJobListener(com.phoenix_int.aserver.util.IPHXProcessJobInfoListener jobListener)

getJobListener

public com.phoenix_int.aserver.util.IPHXProcessJobInfoListener getJobListener()

exec

public java.lang.Process exec(java.lang.String cmd,
                              java.lang.String baseDir)
                       throws java.io.IOException
runs the specified command. The function first switches to the proper directory.

Parameters:
cmd - the command to run
baseDir - the directory to run it in.
Throws:
java.io.IOException - thrown if the command cannot be executed

exec2

public PHXProcess exec2(java.lang.String cmd,
                        java.lang.String baseDir)
                 throws java.io.IOException
runs the specified command. The function first switches to the proper directory. The PHXProcess which is returned has the ability to track the process and sub-processes in a somewhat platform independent way.

Parameters:
cmd - the command to run
baseDir - the directory to run it in.
Throws:
java.io.IOException - thrown if the command cannot be executed

main

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