2ronwalf/*
2ronwalf * Created on Jun 27, 2005
2ronwalf */
2ronwalfpackage org.mindswap.owls.process.execution;
2ronwalf
2ronwalfimport org.mindswap.exceptions.ExecutionException;
2ronwalfimport org.mindswap.query.ValueMap;
4daenzeroramaimport org.mindswap.owls.process.AtomicProcess;
2ronwalfimport org.mindswap.owls.process.Process;
2ronwalf
2ronwalf/**
2ronwalf * An interface that descriubes functions to monitor process execution
2ronwalf *
2ronwalf * @author Evren Sirin
2ronwalf *
2ronwalf */
2ronwalfpublic interface ProcessMonitor {
2ronwalf /**
2ronwalf * Called only once when the execution of the top-most process starts
2ronwalf */
2ronwalf public void executionStarted();
2ronwalf
2ronwalf /**
2ronwalf * Called only once when the execution of the top-most process finishes. Note that
2ronwalf * if execution fails for any reason this function will not be called. Instead
2ronwalf * executionFailed() will be called.
2ronwalf */
2ronwalf public void executionFinished();
2ronwalf
2ronwalf /**
2ronwalf * Called before the execution of a process starts. The user has the option to
2ronwalf * modify the contents of the inputs. setMonitorFilter function can be used to
2ronwalf * control if this function will be called for all the processes or only for
2ronwalf * a specific type of processes (e.g. only atomic processes).
2ronwalf *
2ronwalf * @param process
2ronwalf * @param inputs
2ronwalf */
2ronwalf public void executionStarted(Process process, ValueMap inputs);
2ronwalf
2ronwalf /**
2ronwalf * Called after the execution of a process finishes. The user has the option to
2ronwalf * modify the contents of outputs. setMonitorFilter function can be used to
2ronwalf * control if this function will be called for all the processes or only for
2ronwalf * a specific type of processes (e.g. only atomic processes).
2ronwalf *
2ronwalf * @param process
2ronwalf * @param inputs
2ronwalf * @param outputs
2ronwalf */
2ronwalf public void executionFinished(Process process, ValueMap inputs, ValueMap outputs);
2ronwalf
2ronwalf /**
2ronwalf * Called when the execution fails due to an execption. This function is intended
2ronwalf * to be hook where the user can do something to fix the problem, i.e. ask for
2ronwalf * additional inputs. There is no such support at the moment. The execution engine
2ronwalf * will throw the exception right after this function returns.
2ronwalf *
2ronwalf * @param e
2ronwalf */
2ronwalf public void executionFailed(ExecutionException e);
2ronwalf
2ronwalf /**
2ronwalf * Control if executionStarted and executionFinished will be called for all the
2ronwalf * processes or only for a specific type of processes. The constant values are
2ronwalf * defined in Process interface:
2ronwalf * <p>
2ronwalf * <ul>
2ronwalf * <li><code>Process.ANY</code></li>
2ronwalf * <li><code>Process.ATOMIC</code></li>
2ronwalf * <li><code>Process.COMPOSITE</code></li>
2ronwalf * <li><code>Process.SIMPLE</code></li>
2ronwalf * </ul>
2ronwalf * </p>
2ronwalf * Bitwise combinations (<code>bitwise or</code>) of these values are also valid.
2ronwalf *
2ronwalf * @param processType
2ronwalf */
2ronwalf public void setMonitorFilter(int processType);
2ronwalf
2ronwalf public int getMonitorFilter();
3daenzerorama
3daenzerorama /**
3daenzerorama * Called after the execution of a process interrupts. <code>setMonitorFilter</code> function can be used to
3daenzerorama * control if this function will be called for all the processes or only for
3daenzerorama * a specific type of processes (e.g. only atomic processes).
3daenzerorama *
3daenzerorama * @param process the process whose execution was interrupted
3daenzerorama */
4daenzerorama public void executionInterrupted(Process process, AtomicProcess lastProcess);
3daenzerorama
3daenzerorama /**
3daenzerorama * Called after the interrupted execution of a process has been continued.
3daenzerorama * <code>setMonitorFilter</code> function can be used to control if this function
3daenzerorama * will be called for all the processes or only for a specific type of processes
3daenzerorama * (e.g. only atomic processes).
3daenzerorama *
3daenzerorama * @param process the process whose execution has been interrupted
3daenzerorama */
3daenzerorama public void executionContinued(Process process);
3daenzerorama
3daenzerorama /**
3daenzerorama * Called after the perform of a process to return the outputs of the process.
3daenzerorama * Therefore, value changes for intermediate results can be monitored.
3daenzerorama * <code>setMonitorFilter</code> function can be used to control if this function
3daenzerorama * will be called for all the processes or only for a specific type of processes
3daenzerorama * (e.g. only atomic processes).
3daenzerorama *
3daenzerorama * @param values
3daenzerorama */
3daenzerorama public void intermediateResultsReceived(ValueMap values);
2ronwalf}