Package org.vast.process
Interface IProcessExec
- All Known Subinterfaces:
IProcessChainExec
- All Known Implementing Classes:
AbstractProcessImpl,AggregateProcessImpl,ExecutableChainImpl,ExecutableProcessImpl,PhysicalComponentImpl,PhysicalSystemImpl,SimpleProcessImpl
public interface IProcessExec
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRun()Check that all needed connections are ready for the process to runvoidconnect(DataComponent component, IDataConnection connection) Connects one of this process ports with the given connectionvoiddisconnect(IDataConnection connection) Detach connection from this process input, output or parametervoiddispose()Override to dispose of all resources allocated for the process (stop threads, OS resources, etc...)voidexecute()Execute contains the logic to transform input/parameter values into output values.voidinit()Initialize the process and its internal variables (fixed parameters).booleanneedSync()voidNotifies the process that one or more parameter values have changed before or during executionvoidrun()Runs the process which includes fetching input data, calling execute and producing output datavoidsetInstanceName(String name) Sets the name of this process instancevoidsetParentLogger(org.slf4j.Logger log) Set the parent logger for this process.
The parent logger is used to group log events occuring in all processes that are part of the same processing component (e.g.voidstart(ExecutorService threadPool, Consumer<Throwable> onError) Start process using threads from the given thread poolvoidStart process in its own threadvoidstop()Stop process thread gracefully
-
Method Details
-
getProcessInfo
ProcessInfo getProcessInfo()- Returns:
- all process information (name, UID, etc.)
-
setInstanceName
Sets the name of this process instance- Parameters:
name-
-
getInstanceName
String getInstanceName()- Returns:
- name of this process instance
-
init
Initialize the process and its internal variables (fixed parameters). This is called only once before the process is executed.- Throws:
ProcessException
-
canRun
boolean canRun()Check that all needed connections are ready for the process to run- Returns:
- true if so and false if at least one connection is not ready.
-
run
Runs the process which includes fetching input data, calling execute and producing output data- Throws:
ProcessException
-
execute
Execute contains the logic to transform input/parameter values into output values. This method should be optimized as much as possible.- Throws:
ProcessException
-
start
Start process in its own thread- Parameters:
onError- Called when the process ends with an unrecoverable error- Throws:
ProcessException
-
start
Start process using threads from the given thread pool- Parameters:
threadPool-onError- Called when the process ends with an unrecoverable error- Throws:
ProcessException
-
stop
void stop()Stop process thread gracefully -
dispose
void dispose()Override to dispose of all resources allocated for the process (stop threads, OS resources, etc...) -
getInputList
IOPropertyList getInputList()- Returns:
- List of inputs
-
getOutputList
IOPropertyList getOutputList()- Returns:
- List of outputs
-
getParameterList
IOPropertyList getParameterList()- Returns:
- List of parameters
-
getInputConnections
Map<String,DataConnectionList> getInputConnections()- Returns:
- Read-only list of connections input ports
-
getOutputConnections
Map<String,DataConnectionList> getOutputConnections()- Returns:
- Read-only list of connections output ports
-
getParamConnections
Map<String,DataConnectionList> getParamConnections()- Returns:
- Read-only list of connections parameter ports
-
connect
Connects one of this process ports with the given connection- Parameters:
component- input, parameter or output component to connectconnection- connection object to use- Throws:
IllegalArgumentException- if component is not part on this process portsProcessException- if connection cannot be validated (this usually happens because source and destination components are not compatible)
-
disconnect
Detach connection from this process input, output or parameter- Parameters:
connection-- Throws:
IllegalArgumentException- if connection is not attached to any of this process ports
-
needSync
boolean needSync()- Returns:
- True if this process is asynchronous (i.e. outputs are not generated everytime inputs are read) and thus need synchronization with other processes in the chain
-
notifyParamChange
void notifyParamChange()Notifies the process that one or more parameter values have changed before or during execution -
setParentLogger
void setParentLogger(org.slf4j.Logger log) Set the parent logger for this process.
The parent logger is used to group log events occuring in all processes that are part of the same processing component (e.g. a process chain for instance) while still allowing to differentiate the actual process instance that issued the log.- Parameters:
log-
-