Class AbstractExecutionHandler<R>

java.lang.Object
com.powsybl.computation.AbstractExecutionHandler<R>
Type Parameters:
R -
All Implemented Interfaces:
ExecutionHandler<R>
Direct Known Subclasses:
AmplModelExecutionHandler, SecurityAnalysisExecutionHandler

public abstract class AbstractExecutionHandler<R> extends Object implements ExecutionHandler<R>
Provides some default method implementations for ExecutionHandlers implementations.
Author:
Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>, Teofil Calin BANC <teofil-calin.banc at rte-france.com>
  • Constructor Details

    • AbstractExecutionHandler

      public AbstractExecutionHandler()
  • Method Details

    • onExecutionStart

      public void onExecutionStart(CommandExecution execution, int executionIndex)
      Empty implementation.
      Specified by:
      onExecutionStart in interface ExecutionHandler<R>
    • onExecutionCompletion

      public void onExecutionCompletion(CommandExecution execution, int executionIndex)
      Empty implementation.
      Specified by:
      onExecutionCompletion in interface ExecutionHandler<R>
    • after

      public R after(Path workingDir, ExecutionReport report) throws IOException
      Method called by the ComputationManager with the working directory and an execution report as parameters, after the commands defined by the ExecutionHandler.before(java.nio.file.Path) method have been executed: it is in charge of any postprocessing and of providing the actual computation result. Typically, it will check that the execution was correctly performed, then read command results from the specified working directory and translate it to a business object.

      That method will not be called in case the call to ExecutionHandler.before(java.nio.file.Path) throws an exception, or if the execution is cancelled. That implementation checks the ExecutionReport for errors, and throws a PowsyblException in that case. May be called by actual implementations.

      Specified by:
      after in interface ExecutionHandler<R>
      Parameters:
      workingDir - the working directory used for this computation. Results may be read from it.
      report - the execution report, in particular reporting command execution errors.
      Returns:
      the actual result of the processing.
      Throws:
      IOException - if and error occurs while reading results from the working directory.