public interface SpincastProcessUtils
| Modifier and Type | Method and Description |
|---|---|
void |
executeAsync(ProcessExecutionHandler handler,
List<String> cmdArgs)
Execute an external program asynchronously.
|
void |
executeAsync(ProcessExecutionHandler handler,
long timeoutAmount,
TimeUnit timeoutUnit,
List<String> cmdArgs)
Execute an external program asynchronously.
|
void |
executeAsync(ProcessExecutionHandler handler,
long timeoutAmount,
TimeUnit timeoutUnit,
String... cmdArgs)
Execute an external program asynchronously.
|
void |
executeAsync(ProcessExecutionHandler handler,
String... cmdArgs)
Execute an external program asynchronously.
|
File |
executeGoalOnExternalMavenProject(ResourceInfo projectRootInfo,
MavenProjectGoal mavenGoal)
Execute the specified
goal on an external
Maven project. |
File |
executeGoalOnExternalMavenProject(ResourceInfo projectRootInfo,
MavenProjectGoal mavenGoal,
Map<String,Object> pomParams)
Execute the specified
goal on an external
Maven project. |
SyncExecutionResult |
executeSync(long timeoutAmount,
TimeUnit timeoutUnit,
ExecutionOutputStrategy executionOutputStrategy,
List<String> cmdArgs)
Execute an external program synchronously.
|
SyncExecutionResult |
executeSync(long timeoutAmount,
TimeUnit timeoutUnit,
ExecutionOutputStrategy executionOutputStrategy,
String... cmdArgs)
Execute an external program synchronously.
|
SyncExecutionResult |
executeSync(long timeoutAmount,
TimeUnit timeoutUnit,
List<String> cmdArgs)
Execute an external program synchronously.
|
SyncExecutionResult |
executeSync(long timeoutAmount,
TimeUnit timeoutUnit,
String... cmdArgs)
Execute an external program synchronously.
|
File executeGoalOnExternalMavenProject(ResourceInfo projectRootInfo, MavenProjectGoal mavenGoal)
goal on an external
Maven project.
If the project is located on the classpath, it first copies it to the file system (in a temp folder).
File executeGoalOnExternalMavenProject(ResourceInfo projectRootInfo, MavenProjectGoal mavenGoal, Map<String,Object> pomParams)
goal on an external
Maven project.
If the project is located on the classpath, it first copies it to the file system (in a temp folder).
pomParams - Before executing the goal, those parameters
are used to replace placeholders in the project's pom.xml
using Spincast's TemplatingEngine.void executeAsync(ProcessExecutionHandler handler, String... cmdArgs)
The method will only return when the process is actually created or if an exception occured when trying to do so.
If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:
ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
{
// override some methods...
};
getSpincastProcessUtils().executeAsync(handler,
"java",
"-jar",
jarFile.getAbsolutePath());
try {
//...
} finally {
handler.killProcess();
}
handler - to get information from the created process
and to be able to kill it.void executeAsync(ProcessExecutionHandler handler, long timeoutAmount, TimeUnit timeoutUnit, String... cmdArgs)
The method will only return when the process is actually created or if an exception occured when trying to do so.
If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:
ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
{
// override some methods...
};();
getSpincastProcessUtils().executeAsync(handler,
"java",
"-jar",
jarFile.getAbsolutePath());
try {
//...
} finally {
handler.killProcess();
}
handler - to get information from the created process
and to be able to kill it.timeoutAmount - the amount of time the external program
is allowed to run before a timeout occurs. When the timeout occurs:
onTimeoutException() is called
onExit() will not be called
if a timeout occurs!timeoutUnit - the timeout unit.void executeAsync(ProcessExecutionHandler handler, List<String> cmdArgs)
The method will only return when the process is actually created or if an exception occured when trying to do so.
If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:
ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
{
// override some methods...
};
getSpincastProcessUtils().executeAsync(handler,
"java",
"-jar",
jarFile.getAbsolutePath());
try {
//...
} finally {
handler.killProcess();
}
handler - to get information from the created process
and to be able to kill it.void executeAsync(ProcessExecutionHandler handler, long timeoutAmount, TimeUnit timeoutUnit, List<String> cmdArgs)
The method will only return when the process is actually created or if an exception occured when trying to do so.
If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:
ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
{
// override some methods...
};
getSpincastProcessUtils().executeAsync(handler,
"java",
"-jar",
jarFile.getAbsolutePath());
try {
//...
} finally {
handler.killProcess();
}
handler - to get information from the created process
and to be able to kill it.timeoutAmount - the amount of time the external program
is allowed to run before a timeout occurs. When the timeout occurs:
onTimeoutException() is called
onExit() will not be called
if a timeout occurs!timeoutUnit - the timeout unit.SyncExecutionResult executeSync(long timeoutAmount, TimeUnit timeoutUnit, String... cmdArgs) throws LaunchException, TimeoutException
By default SYSTEM is
used as the output strategy so it is printed to
System.out and System.err.
timeoutAmount - the amount of time the external program
is allowed to run before a timeout occurs. When the timeout occurs:
TimeoutException exception is thrown.
timeoutUnit - the timeout unit.TimeoutException - if the specified timeout is
exceeded.LaunchException - if the program can't be launched properly.SyncExecutionResult executeSync(long timeoutAmount, TimeUnit timeoutUnit, List<String> cmdArgs) throws LaunchException, TimeoutException
By default SYSTEM is
used as the output strategy so it is printed to
System.out and System.err.
timeoutAmount - the amount of time the external program
is allowed to run before a timeout occurs. When the timeout occurs:
TimeoutException exception is thrown.
timeoutUnit - the timeout unit.TimeoutException - if the specified timeout is
exceeded.LaunchException - if the program can't be launched properly.SyncExecutionResult executeSync(long timeoutAmount, TimeUnit timeoutUnit, ExecutionOutputStrategy executionOutputStrategy, String... cmdArgs) throws LaunchException, TimeoutException
By default SYSTEM is
used as the output strategy so it is printed to
System.out and System.err.
timeoutAmount - the amount of time the external program
is allowed to run before a timeout occurs. When the timeout occurs:
TimeoutException exception is thrown.
timeoutUnit - the timeout unit.executionOutputStrategy - what should be done with the
output of the executed program?TimeoutException - if the specified timeout is
exceeded.LaunchException - if the program can't be launched properly.SyncExecutionResult executeSync(long timeoutAmount, TimeUnit timeoutUnit, ExecutionOutputStrategy executionOutputStrategy, List<String> cmdArgs) throws LaunchException, TimeoutException
By default SYSTEM is
used as the output strategy so it is printed to
System.out and System.err.
timeoutAmount - the amount of time the external program
is allowed to run before a timeout occurs. When the timeout occurs:
TimeoutException exception is thrown.
timeoutUnit - the timeout unit.executionOutputStrategy - what should be done with the
output of the executed program?TimeoutException - if the specified timeout is
exceeded.LaunchException - if the program can't be launched properly.Copyright © 2019. All rights reserved.