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 Details

    • DEFAULT_JAVA_TOOL

      public static final String DEFAULT_JAVA_TOOL
      See Also:
    • workDirectory_

      protected File workDirectory_
    • javaTool_

      protected String javaTool_
    • javaOptions_

      protected final JavaOptions javaOptions_
    • classpath_

      protected final List<String> classpath_
    • mainClass_

      protected String mainClass_
    • outputProcessor_

      protected Function<String,Boolean> outputProcessor_
    • errorProcessor_

      protected Function<String,Boolean> errorProcessor_
    • process_

      protected Process process_
    • successful_

      protected boolean successful_
    • outputProcessorThread_

      protected Thread outputProcessorThread_
    • errorProcessorThread_

      protected Thread errorProcessorThread_
  • Constructor Details

    • AbstractProcessOperation

      public AbstractProcessOperation()
  • Method Details

    • execute

      Performs the operation.
      Specified by:
      execute in class AbstractOperation<T extends AbstractProcessOperation<T>>
      Throws:
      InterruptedException - when the operation was interrupted
      IOException - when an exception occurred during the execution of the process
      FileUtilsErrorException - when an exception occurred during the retrieval of the operation output
      ExitStatusException - when the exit status was changed during the operation
      Since:
      1.5
    • executeConstructProcessCommandList

      protected abstract List<String> executeConstructProcessCommandList()
      Part of the execute() operation, constructs the command list to use for building the process.
      Since:
      1.5
    • executeStartProcess

      protected Process executeStartProcess() throws IOException
      Part of the execute() operation, starts the process.
      Throws:
      IOException
      Since:
      1.5
    • fromProject

      public abstract T fromProject(BaseProject project)
      Configures the operation from a BaseProject.
      Parameters:
      project - the project to configure the operation from
      Since:
      1.5
    • workDirectory

      public T workDirectory(File directory)
      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
    • javaTool

      public T javaTool(String tool)
      Provides the name of the tool to use for java 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

      public T javaOptions(List<String> options)
      Provides the options to provide to the java tool.
      Parameters:
      options - the java tool's options
      Returns:
      this operation instance
      Since:
      1.5
    • classpath

      public T classpath(String... 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

      public T classpath(List<String> 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
    • mainClass

      public T mainClass(String name)
      Provides the main class to launch with the java tool.
      Parameters:
      name - the main class to launch
      Returns:
      this operation instance
      Since:
      1.5
    • outputProcessor

      public T outputProcessor(Function<String,Boolean> processor)
      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

      public T errorProcessor(Function<String,Boolean> processor)
      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

      public File workDirectory()
      Retrieves the work directory in which the operation will be performed.
      Returns:
      the directory to use as a work directory
      Since:
      1.5
    • javaTool

      public String javaTool()
      retrieves the name of the tool to use for java execution.
      Returns:
      the name of the java tool
      Since:
      1.5
    • javaOptions

      public JavaOptions 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

      public List<String> 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
    • mainClass

      public String mainClass()
      Retrieves the main class to launch with the java tool.
      Returns:
      the main class to launch
      Since:
      1.5
    • outputProcessor

      public Function<String,Boolean> outputProcessor()
      Retrieves the processor that is used to handle the process output.
      Returns:
      the output processor
      Since:
      1.5.1
    • errorProcessor

      public Function<String,Boolean> errorProcessor()
      Retrieves the processor that is used to handle the process errors.
      Returns:
      the error processor
      Since:
      1.5.1
    • process

      public Process process()
      Retrieves the process that was used for the execution.
      Returns:
      the process that was executed
      Since:
      1.5