|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rhq.core.system.ProcessExecution
public class ProcessExecution
Provides information on what process to execute and how to execute it.
JavaSystemInfo.executeProcess(ProcessExecution)
,
ProcessExecutionUtility
Constructor Summary | |
---|---|
ProcessExecution(String executable)
Constructor for ProcessExecution that defines the full path to the executable that will be run. |
Method Summary | |
---|---|
List<String> |
getArguments()
Obtain the optional set of arguments to the executable as List. |
String[] |
getArgumentsAsArray()
Obtain the optional set of arguments to the executable as String array |
Map<String,String> |
getEnvironmentVariables()
|
String[] |
getEnvironmentVariablesAsArray()
Returns a copy of this ProcessExecution's environment variables as an array of "name=value" Strings. |
String |
getExecutable()
|
long |
getWaitForCompletion()
|
String |
getWorkingDirectory()
|
boolean |
isCaptureOutput()
|
boolean |
isCheckExecutableExists()
If true , then the executable should first be checked for its existence. |
boolean |
isKillOnTimeout()
|
void |
setArguments(List<String> arguments)
Sets an optional set of arguments to pass to the executable. |
void |
setArguments(String[] arguments)
Sets an optional set of arguments to pass to the executable. |
void |
setCaptureOutput(boolean captureOutput)
If true , the process's output will be captured and returned in the results. |
void |
setCheckExecutableExists(boolean checkExecutableExists)
|
void |
setEnvironmentVariables(Map<String,String> environmentVariables)
Sets an optional set of environment variables to pass to the process. |
void |
setExecutable(String executable)
Sets the full path to the executable that will be run. |
void |
setKillOnTimeout(boolean killOnTimeout)
If true , then the process will be forcibly killed if it doesn't exit within the
wait time . |
void |
setWaitForCompletion(long waitForCompletion)
The time, in milliseconds, to wait for the process to exit (will not wait if 0 or less). |
void |
setWorkingDirectory(String workingDirectory)
If not null , will be the working directory of the new process (if null , the new
process's working directory will be the current working directory of caller). |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProcessExecution(String executable)
ProcessExecution
that defines the full path to the executable that will be run. See the
other setter methods in this class for the additional things you can set when executing a process.
executable
- the full path to the executable that will be runMethod Detail |
---|
@NotNull public String getExecutable()
public void setExecutable(@NotNull String executable)
executable
- the full path to the executable that will be run@Nullable public List<String> getArguments()
@Nullable public String[] getArgumentsAsArray()
public void setArguments(@Nullable List<String> arguments)
arguments
- an optional set of arguments to pass to the executablepublic void setArguments(@Nullable String[] arguments)
arguments
- an optional set of arguments to pass to the executable@Nullable public Map<String,String> getEnvironmentVariables()
@Nullable public String[] getEnvironmentVariablesAsArray()
public void setEnvironmentVariables(@Nullable Map<String,String> environmentVariables)
null
, the new process will
inherit the environment of the caller.
environmentVariables
- an optional set of environment variables to pass to the process@Nullable public String getWorkingDirectory()
public void setWorkingDirectory(@Nullable String workingDirectory)
null
, will be the working directory of the new process (if null
, the new
process's working directory will be the current working directory of caller).
workingDirectory
- The directory the process should get as working directory.public long getWaitForCompletion()
public void setWaitForCompletion(long waitForCompletion)
waitForCompletion
- The wait time in ms.public boolean isCaptureOutput()
public void setCaptureOutput(boolean captureOutput)
true
, the process's output will be captured and returned in the results. This may be ignored if
waitForCompletion
is 0 or less. Be careful setting this to true
, you must ensure that
the process will not write a lot of output - you might run out of memory if the process is a long-lived daemon
process that outputs a lot of log messages, for example. By default, output is *not* captured.
captureOutput
- whether or not this process's output (stdout+stderr) should be captured and returned in the
resultspublic boolean isKillOnTimeout()
public void setKillOnTimeout(boolean killOnTimeout)
true
, then the process will be forcibly killed if it doesn't exit within the
wait time
. If false
, the process will be allowed to continue to run
for as long as it needs - getWaitForCompletion()
will only force the caller to "wake up" and not block
waiting for the process to finish.
killOnTimeout
- Should the process be killed after the timeout timed out?public boolean isCheckExecutableExists()
true
, then the executable should first be checked for its existence.
If the executable does not exist, the execution should fail-fast. If false
,
the process will attempt to be executed no matter what. This will allow the operating
system to check its executable PATH to find the executable as necessary.
true
)public void setCheckExecutableExists(boolean checkExecutableExists)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |