org.schmant.support.io
Class ProcessSettings

java.lang.Object
  extended by org.schmant.support.io.ProcessSettings

public class ProcessSettings
extends Object

Configuration settings for running an external process.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
ProcessSettings()
           
 
Method Summary
 ArgumentList getArgumentList()
          Get the command and its arguments.
 List<String> getEnvironmentVariables()
          Get the list of environment variables to set for the process.
 ProcessOutputStrategy getStderrStrategy()
          Get the strategy to use for collecting the process' stderr output.
 ProcessOutputStrategy getStdoutStrategy()
          Get the strategy to use for collecting the process' stdout output.
 File getWorkingDirectory()
          Get the working directory for the process.
 boolean isInheritEnvironmentVariables()
          Should environment variables be inherited from the current process?
 ProcessSettings setArgumentList(ArgumentList al)
          Set the command to use for running the process and the arguments to the process.
 ProcessSettings setEnvironmentVariables(List<String> l)
          Set a list of environment variables to set for the process.
 ProcessSettings setInheritEnvironmentVariables(boolean b)
          Should environment variables be inherited from this process? The default value of this is true.
 ProcessSettings setStderrStrategy(ProcessOutputStrategy pos)
          Set the strategy to use for collecting the process' stderr output.
 ProcessSettings setStdoutStrategy(ProcessOutputStrategy pos)
          Set the strategy to use for collecting the process' stdout output.
 ProcessSettings setWorkingDirectory(File d)
          Set the working directory for the process.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessSettings

public ProcessSettings()
Method Detail

setStdoutStrategy

public ProcessSettings setStdoutStrategy(ProcessOutputStrategy pos)
Set the strategy to use for collecting the process' stdout output.

Parameters:
pos - The strategy.
Returns:
this.

getStdoutStrategy

public ProcessOutputStrategy getStdoutStrategy()
Get the strategy to use for collecting the process' stdout output.

Returns:
The strategy.

setStderrStrategy

public ProcessSettings setStderrStrategy(ProcessOutputStrategy pos)
Set the strategy to use for collecting the process' stderr output.

Parameters:
pos - The strategy.
Returns:
this.

getStderrStrategy

public ProcessOutputStrategy getStderrStrategy()
Get the strategy to use for collecting the process' stderr output.

Returns:
The strategy.

setArgumentList

public ProcessSettings setArgumentList(ArgumentList al)
Set the command to use for running the process and the arguments to the process. See ProcessBuilder.

Parameters:
al - The argument list.
Returns:
this

getArgumentList

public ArgumentList getArgumentList()
Get the command and its arguments.

Returns:
The command and its arguments.

setEnvironmentVariables

public ProcessSettings setEnvironmentVariables(List<String> l)
Set a list of environment variables to set for the process. Each entry in the list has the format name=value.

Parameters:
l - A list of environment variables.
Returns:
this.
See Also:
setInheritEnvironmentVariables(boolean)

getEnvironmentVariables

public List<String> getEnvironmentVariables()
Get the list of environment variables to set for the process. Each entry in the list has the format name=value.

Returns:
The list of environment variables.
See Also:
isInheritEnvironmentVariables()

setInheritEnvironmentVariables

public ProcessSettings setInheritEnvironmentVariables(boolean b)
Should environment variables be inherited from this process? The default value of this is true.

If this is set to false, the launched process will only see the environment variables set to setEnvironmentVariables(List).

Parameters:
b - Should environment variables be inherited?
Returns:
this
See Also:
setEnvironmentVariables(List)

isInheritEnvironmentVariables

public boolean isInheritEnvironmentVariables()
Should environment variables be inherited from the current process?

Returns:
true if environment variables should be inherited.

setWorkingDirectory

public ProcessSettings setWorkingDirectory(File d)
Set the working directory for the process. The default value of this is the current process' working directory.

Parameters:
d - A working directory.
Returns:
this

getWorkingDirectory

public File getWorkingDirectory()
Get the working directory for the process.

Returns:
The working directory for the process.

toString

public String toString()
Overrides:
toString in class Object