Package com.powsybl.computation
Class AbstractExecutionHandler<R>
- java.lang.Object
-
- com.powsybl.computation.AbstractExecutionHandler<R>
-
- Type Parameters:
R
-
- All Implemented Interfaces:
ExecutionHandler<R>
- Direct Known Subclasses:
SecurityAnalysisExecutionHandler
public abstract class AbstractExecutionHandler<R> extends Object implements ExecutionHandler<R>
Provides some default method implementations forExecutionHandler
s implementations.- Author:
- Geoffroy Jamgotchian
, Teofil Calin BANC
-
-
Constructor Summary
Constructors Constructor Description AbstractExecutionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description R
after(Path workingDir, ExecutionReport report)
Method called by theComputationManager
with the working directory and an execution report as parameters, after the commands defined by theExecutionHandler.before(java.nio.file.Path)
method have been executed: it is in charge of any postprocessing and of providing the actual computation result.void
onExecutionCompletion(CommandExecution execution, int executionIndex)
Empty implementation.void
onExecutionStart(CommandExecution execution, int executionIndex)
Empty implementation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.powsybl.computation.ExecutionHandler
before
-
-
-
-
Method Detail
-
onExecutionStart
public void onExecutionStart(CommandExecution execution, int executionIndex)
Empty implementation.- Specified by:
onExecutionStart
in interfaceExecutionHandler<R>
-
onExecutionCompletion
public void onExecutionCompletion(CommandExecution execution, int executionIndex)
Empty implementation.- Specified by:
onExecutionCompletion
in interfaceExecutionHandler<R>
-
after
public R after(Path workingDir, ExecutionReport report) throws IOException
Method called by theComputationManager
with the working directory and an execution report as parameters, after the commands defined by theExecutionHandler.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 theExecutionReport
for errors, and throws aPowsyblException
in that case. May be called by actual implementations.- Specified by:
after
in interfaceExecutionHandler<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.
-
-