OMS (v3.0.25)

oms3.util
Class Processes

java.lang.Object
  extended by oms3.util.Processes

public class Processes
extends java.lang.Object

ProcessExcecution. Helper class to execute external programs.

Author:
Olaf David, (Ant)

Field Summary
static int INVALID_EXIT
           
 
Constructor Summary
Processes(java.io.File executable)
          Create a new ProcessExecution.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> environment()
          get the execution environment.
 int exec()
          Process execution.
 int getExitValue()
          Get the exit value of the process.
static void main(java.lang.String[] args)
           
 void redirectError(java.io.OutputStream err)
          Redirect the error stream.
 void redirectInput(java.io.InputStream inp)
          Redirect the input.
 void redirectOutput(java.io.OutputStream out)
          Redirect the output.
 void setArguments(java.lang.Object... args)
           
 void setVerbose(boolean verbose)
           
 void setWorkingDirectory(java.io.File dir)
          Set the working directory where the process get executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_EXIT

public static final int INVALID_EXIT
See Also:
Constant Field Values
Constructor Detail

Processes

public Processes(java.io.File executable)
Create a new ProcessExecution.

Parameters:
executable - the executable file.
Method Detail

setArguments

public void setArguments(java.lang.Object... args)
Parameters:
args -

setWorkingDirectory

public void setWorkingDirectory(java.io.File dir)
Set the working directory where the process get executed.

Parameters:
dir - the directory in which the executable will be started

environment

public java.util.Map<java.lang.String,java.lang.String> environment()
get the execution environment. Use the returned map to customize the environment variables.

Returns:
the process environment.

redirectOutput

public void redirectOutput(java.io.OutputStream out)
Redirect the output.

Parameters:
out - the new output stream

redirectError

public void redirectError(java.io.OutputStream err)
Redirect the error stream.

Parameters:
err - the new error stream

redirectInput

public void redirectInput(java.io.InputStream inp)
Redirect the input.

Parameters:
inp - the new input stream

getExitValue

public int getExitValue()
Get the exit value of the process.

Returns:
the exit value or INVALID_EXITVALUE if no exit value has been received.

setVerbose

public void setVerbose(boolean verbose)

exec

public int exec()
         throws java.lang.Exception
Process execution. This call blocks until the process is done.

Returns:
the exit status of the process.
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

OMS (v3.0.25)

Generated 2010-08-11 08:44:20 MDT, USDA-ARS-ASRU/CSU, 2150 Center Ave, Fort Collins, CO 80526, U.S.A.