|
org.netbeans.modules.extexecution/2 1.31 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.api.extexecution.ProcessBuilder
public final class ProcessBuilder
Abstraction of process builders. You can freely configure the parameters
and then create a process by calling the call() method. You can
also (re)configure the builder and spawn a different process.
Note the API does not prescribe the actual meaning of Process.
It may be local process, remote process or some other implementation.
You can use the default implementation returned by getLocal()
for creating the local machine OS processes.
Thread safety of this class depends on thread safety of
the ProcessBuilderImplementation the class is using. If it is thread
safe (if possible the implementation should be even stateless) this class
is thread safe as well.
| Method Summary | |
|---|---|
Process |
call()
Creates the new Process based on the properties configured
in this builder. |
String |
getDescription()
Returns the human readable description of this builder. |
static ProcessBuilder |
getLocal()
Returns the ProcessBuilder creating the OS process on local
machine. |
void |
setArguments(List<String> arguments)
Sets the arguments passed to the process created by subsequent call of call(). |
void |
setEnvironmentVariables(Map<String,String> envVariables)
Sets the environment variables for the process created by subsequent call of call(). |
void |
setExecutable(String executable)
Sets the executable to run. |
void |
setPaths(List<String> paths)
Sets the additional paths to be included in PATH environment
variable for the process. |
void |
setRedirectErrorStream(boolean redirectErrorStream)
Configures the error stream redirection. |
void |
setWorkingDirectory(String workingDirectory)
Sets the working directory for the process created by subsequent call of call(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static ProcessBuilder getLocal()
ProcessBuilder creating the OS process on local
machine. Returned implementation is thread safe.
ProcessBuilder creating the OS process on local
machine@NonNull public String getDescription()
public void setExecutable(@NonNull
String executable)
call()
methods throws IllegalStateException when there is no executable
configured.
executable - the executable to run
public void setWorkingDirectory(@NullAllowed
String workingDirectory)
call(). The default value is implementation specific.
workingDirectory - the working directory of the process
public void setArguments(@NonNull
List<String> arguments)
call(). By default there are no arguments.
arguments - the arguments passed to the process
public void setEnvironmentVariables(@NonNull
Map<String,String> envVariables)
call(). By default there are no environment variables with
exception of PATH possibly configured by setPaths(java.util.List).
envVariables - the environment variables for the process
public void setPaths(@NonNull
List<String> paths)
PATH environment
variable for the process.
paths - the additional paths to be included in PATH
environment variablepublic void setRedirectErrorStream(boolean redirectErrorStream)
true the error
stream of process created by subsequent call of call() method
will be redirected to standard output stream.
redirectErrorStream - the error stream redirection
@NonNull
public Process call()
throws IOException
Process based on the properties configured
in this builder.
Actual behavior depends on the builder implementation, but it should respect all the properties configured on this builder.
call in interface Callable<Process>Process based on the properties configured
in this builder
IOException - if the process could not be created
IllegalStateException - if there is no executable configured
by setExecutable(java.lang.String)ProcessBuilderImplementation
|
org.netbeans.modules.extexecution/2 1.31 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||