Package rife.bld.operations
Class AbstractProcessOperation<T extends AbstractProcessOperation<T>>
java.lang.Object
rife.bld.operations.AbstractOperation<T>
rife.bld.operations.AbstractProcessOperation<T>
- Direct Known Subclasses:
RunOperation
,TestOperation
public abstract class AbstractProcessOperation<T extends AbstractProcessOperation<T>>
extends AbstractOperation<T>
Abstract operation that starts a Java application as a separate process.
- Since:
- 1.5.18
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the classpath to use for the operation.Provides classpath entries to use for the operation.Provides a list of classpath entries to use for the operation.Retrieves the environment to use for the operation.environment
(String name, String value) Provides an environment variable to use for the operation.environment
(Map<String, String> environment) Provides environment variable entries to use for the operation.Retrieves the processor that is used to handle the process errors.errorProcessor
(Function<String, Boolean> processor) Provides the processor that will be used to handle the process errors.void
execute()
Performs the operation.Part of theexecute()
operation, constructs the command list to use for building the process.protected Process
Part of theexecute()
operation, starts the process.abstract T
fromProject
(BaseProject project) Configures the operation from aBaseProject
.Retrieves the options to provide to the java tool.javaOptions
(List<String> options) Provides the options to provide to the java tool.javaTool()
retrieves the name of the tool to use forjava
execution.Provides the name of the tool to use forjava
execution.Retrieves the main class to launch with the java tool.Provides the main class to launch with the java tool.module()
Retrieves the module to launch with the java tool.Provides the module to launch with the java tool.Retrieves the module path to use for the operation.modulePath
(String... modulePath) Provides module path entries to use for the operation.modulePath
(List<String> modulePath) Provides a list of module path entries to use for the operation.Retrieves the processor that is used to handle the process output.outputProcessor
(Function<String, Boolean> processor) Provides the processor that will be used to handle the process output.process()
Retrieves the process that was used for the execution.Retrieves the work directory in which the operation will be performed.workDirectory
(File directory) Provides the work directory in which the operation will be performed.Methods inherited from class rife.bld.operations.AbstractOperation
executeOnce, executeOnce, silent, silent
-
Field Details
-
DEFAULT_JAVA_TOOL
- See Also:
-
workDirectory_
-
environment_
-
javaTool_
-
javaOptions_
-
classpath_
-
modulePath_
-
mainClass_
-
module_
-
outputProcessor_
-
errorProcessor_
-
process_
-
successful_
protected boolean successful_ -
outputProcessorThread_
-
errorProcessorThread_
-
-
Constructor Details
-
AbstractProcessOperation
public AbstractProcessOperation()
-
-
Method Details
-
execute
public void execute() throws IOException, FileUtilsErrorException, InterruptedException, ExitStatusExceptionPerforms the operation.- Specified by:
execute
in classAbstractOperation<T extends AbstractProcessOperation<T>>
- Throws:
InterruptedException
- when the operation was interruptedIOException
- when an exception occurred during the execution of the processFileUtilsErrorException
- when an exception occurred during the retrieval of the operation outputExitStatusException
- when the exit status was changed during the operation- Since:
- 1.5
-
executeConstructProcessCommandList
Part of theexecute()
operation, constructs the command list to use for building the process.- Since:
- 1.5
-
executeStartProcess
Part of theexecute()
operation, starts the process.- Throws:
IOException
- Since:
- 1.5
-
fromProject
Configures the operation from aBaseProject
.- Parameters:
project
- the project to configure the operation from- Since:
- 1.5
-
workDirectory
Provides the work directory in which the operation will be performed.If no work directory is provided, the JVM working directory will be used.
- Parameters:
directory
- the directory to use as a work directory- Returns:
- this operation instance
- Since:
- 1.5
-
environment
Provides an environment variable to use for the operation.- Parameters:
name
- the name of the environment variablevalue
- the value of the environment variable- Returns:
- this operation instance
- Since:
- 2.2.1
-
environment
Provides environment variable entries to use for the operation.- Parameters:
environment
- environment entries for the operation- Returns:
- this operation instance
- Since:
- 2.2.1
-
javaTool
Provides the name of the tool to use forjava
execution.If no java tool is provided
java
will be used.- Parameters:
tool
- the name of the java tool- Returns:
- this operation instance
- Since:
- 1.5
-
javaOptions
Provides the options to provide to the java tool.- Parameters:
options
- the java tool's options- Returns:
- this operation instance
- Since:
- 1.5
-
classpath
Provides classpath entries to use for the operation.- Parameters:
classpath
- classpath entries for the operation- Returns:
- this operation instance
- Since:
- 1.5.18
-
classpath
Provides a list of classpath entries to use for the operation.A copy will be created to allow this list to be independently modifiable.
- Parameters:
classpath
- a list of classpath entries for the operation- Returns:
- this operation instance
- Since:
- 1.5
-
modulePath
Provides module path entries to use for the operation.- Parameters:
modulePath
- module path entries for the operation- Returns:
- this operation instance
- Since:
- 2.1
-
modulePath
Provides a list of module path entries to use for the operation.A copy will be created to allow this list to be independently modifiable.
- Parameters:
modulePath
- a list of module path entries for the operation- Returns:
- this operation instance
- Since:
- 2.1
-
mainClass
Provides the main class to launch with the java tool.- Parameters:
name
- the main class to launch- Returns:
- this operation instance
- Since:
- 1.5
-
module
Provides the module to launch with the java tool.- Parameters:
name
- the module to launch- Returns:
- this operation instance
- Since:
- 2.1
-
outputProcessor
Provides the processor that will be used to handle the process output.It will be called for each line in the output.
- Parameters:
processor
- the output processor- Returns:
- this operation instance
- Since:
- 1.5.1
-
errorProcessor
Provides the processor that will be used to handle the process errors.It will be called for each line in the error output.
- Parameters:
processor
- the error processor- Returns:
- this operation instance
- Since:
- 1.5.1
-
workDirectory
Retrieves the work directory in which the operation will be performed.- Returns:
- the directory to use as a work directory
- Since:
- 1.5
-
environment
Retrieves the environment to use for the operation.This is a modifiable map that can be retrieved and changed.
- Returns:
- the operation's environment
- Since:
- 2.2.1
-
javaTool
retrieves the name of the tool to use forjava
execution.- Returns:
- the name of the java tool
- Since:
- 1.5
-
javaOptions
Retrieves the options to provide to the java tool.This is a modifiable list that can be retrieved and changed.
- Returns:
- the java tool's options
- Since:
- 1.5
-
classpath
Retrieves the classpath to use for the operation.This is a modifiable list that can be retrieved and changed.
- Returns:
- the operation's classpath
- Since:
- 1.5
-
modulePath
Retrieves the module path to use for the operation.This is a modifiable list that can be retrieved and changed.
- Returns:
- the operation's module path
- Since:
- 2.1
-
mainClass
Retrieves the main class to launch with the java tool.- Returns:
- the main class to launch
- Since:
- 1.5
-
module
Retrieves the module to launch with the java tool.- Returns:
- the module to launch
- Since:
- 2.1
-
outputProcessor
Retrieves the processor that is used to handle the process output.- Returns:
- the output processor
- Since:
- 1.5.1
-
errorProcessor
Retrieves the processor that is used to handle the process errors.- Returns:
- the error processor
- Since:
- 1.5.1
-
process
Retrieves the process that was used for the execution.- Returns:
- the process that was executed
- Since:
- 1.5
-