public abstract class ExecutableProcessImpl extends Object implements IProcessExec, Runnable
Abstract base for all executable process implementations.
This class provides logic to run a process synchronously by simply calling
execute()
or in its own thread using start()
and stop()
.
Modifier and Type | Field and Description |
---|---|
protected static String |
execError |
protected static String |
initError |
protected List<DataConnectionList> |
inputConnections |
protected IOPropertyList |
inputData |
protected static String |
ioError |
protected boolean |
needSync |
protected List<DataConnectionList> |
outputConnections |
protected IOPropertyList |
outputData |
protected List<DataConnectionList> |
paramConnections |
protected IOPropertyList |
paramData |
protected Thread |
processThread |
protected boolean |
started |
protected boolean |
usingQueueBuffers |
protected AbstractProcess |
wrapperProcess |
Constructor and Description |
---|
ExecutableProcessImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
assignWrapperProcess(AbstractProcess wrapperProcess) |
boolean |
canRun()
Check that all needed connections are ready for the process
to run in sync mode (not threaded).
|
protected boolean |
checkAvailability(DataConnectionList connectionList,
boolean availability)
Checks that the availability flags of all connections
in the list is equal to the specified state.
|
protected boolean |
checkAvailability(List<DataConnectionList> allConnections,
boolean availability)
Checks if all connections in the list and marked as needed
have the specified availability state.
|
void |
connectInput(String inputName,
String dataPath,
DataConnection connection)
Connects one of this process inputs with the given connection
|
void |
connectOutput(String outputName,
String dataPath,
DataConnection connection)
Connects one of this process outputs with the given connection
|
void |
connectParameter(String paramName,
String dataPath,
DataConnection connection)
Connects one of this process parameters with the given connection
|
void |
createNewInputBlocks()
Creates new DataBlock for each input signal
|
void |
createNewOutputBlocks()
Creates new DataBlock for each output signal
|
void |
dispose()
Override to dispose of all resources allocated
for the process (stop threads, OS resources, etc...)
Default method does nothing.
|
abstract void |
execute()
Execute is typically called several times on a process and should
contain all the logic to transform input/parameter values to
output values.
|
protected void |
fetchData(List<DataConnectionList> allConnections)
Fetch new data from input queues in async mode (threaded)
Thread will wait until each queue needing data receives next block
|
protected void |
finalize() |
List<DataConnectionList> |
getInputConnections() |
IOPropertyList |
getInputList() |
String |
getName() |
List<DataConnectionList> |
getOutputConnections() |
IOPropertyList |
getOutputList() |
List<DataConnectionList> |
getParamConnections() |
IOPropertyList |
getParameterList() |
protected int |
getSignalIndex(OgcPropertyList<?> ioList,
String signalName) |
abstract void |
init()
Initialize the process and its internal variables (fixed parameters).
|
boolean |
isInputConnected(String inputName)
Checks if the specified input has one or more connections
|
boolean |
isOutputConnected(String outputName)
Checks if the specified output has one or more connections
|
boolean |
isParamConnected(String paramName)
Checks if the specified parameter has one or more connections
|
boolean |
isUsingQueueBuffers()
Checks if actual buffered queues are used to connect with this process
|
boolean |
needSync() |
void |
reset()
Resets the process (especially asnchronous ones) before it can be run again.
|
void |
run()
Process thread run method
|
protected void |
setAvailability(DataConnectionList connectionList,
boolean availability)
Sets the availability flags of all connections in the list
to the specified state.
|
void |
setAvailability(List<DataConnectionList> allConnections,
boolean availability)
Sets i/o availability flags in sync mode (not threaded)
This default method just sets all needed flags to the
specified state.
|
void |
setUsingQueueBuffers(boolean usingQueueBuffers) |
void |
start()
Start process thread
|
void |
stop()
Stop process thread gracefully
|
String |
toString()
Print process name and I/O info
|
void |
transferData(List<DataConnectionList> allConnections) |
protected void |
writeData(List<DataConnectionList> allConnections)
Writes new data to output queues in async mode (threaded)
|
protected static final String ioError
protected static final String initError
protected static final String execError
protected AbstractProcess wrapperProcess
protected IOPropertyList inputData
protected IOPropertyList outputData
protected IOPropertyList paramData
protected transient List<DataConnectionList> inputConnections
protected transient List<DataConnectionList> outputConnections
protected transient List<DataConnectionList> paramConnections
protected transient Thread processThread
protected transient boolean started
protected transient boolean usingQueueBuffers
protected transient boolean needSync
protected void assignWrapperProcess(AbstractProcess wrapperProcess) throws SMLException
SMLException
public abstract void init() throws SMLException
IProcessExec
init
in interface IProcessExec
SMLException
public abstract void execute() throws SMLException
IProcessExec
execute
in interface IProcessExec
SMLException
public void dispose()
IProcessExec
dispose
in interface IProcessExec
public void reset() throws SMLException
IProcessExec
reset
in interface IProcessExec
SMLException
public String getName()
getName
in interface IProcessExec
public boolean canRun()
IProcessExec
canRun
in interface IProcessExec
protected boolean checkAvailability(List<DataConnectionList> allConnections, boolean availability)
protected boolean checkAvailability(DataConnectionList connectionList, boolean availability)
connectionList
- availability
- public void setAvailability(List<DataConnectionList> allConnections, boolean availability)
setAvailability
in interface IProcessExec
allConnections
- (inputs, outputs or parameters)protected void setAvailability(DataConnectionList connectionList, boolean availability)
connectionList
- availability
- protected void fetchData(List<DataConnectionList> allConnections) throws InterruptedException
InterruptedException
protected void writeData(List<DataConnectionList> allConnections) throws InterruptedException
InterruptedException
public void transferData(List<DataConnectionList> allConnections)
transferData
in interface IProcessExec
public void createNewOutputBlocks()
IProcessExec
createNewOutputBlocks
in interface IProcessExec
public void createNewInputBlocks()
IProcessExec
createNewInputBlocks
in interface IProcessExec
public void run()
IProcessExec
run
in interface Runnable
run
in interface IProcessExec
public void start() throws SMLException
IProcessExec
start
in interface IProcessExec
SMLException
public void stop()
IProcessExec
stop
in interface IProcessExec
public String toString()
public void connectInput(String inputName, String dataPath, DataConnection connection) throws SMLException
IProcessExec
connectInput
in interface IProcessExec
inputName
- name of input to connectdataPath
- path of component to connectconnection
- connection object whose destination will be set to the specified componentSMLException
public void connectOutput(String outputName, String dataPath, DataConnection connection) throws SMLException
IProcessExec
connectOutput
in interface IProcessExec
outputName
- name of output to connectdataPath
- path of component to connectconnection
- connection object whose source will be set to the specified componentSMLException
public void connectParameter(String paramName, String dataPath, DataConnection connection) throws SMLException
IProcessExec
connectParameter
in interface IProcessExec
paramName
- name of parameter to connectdataPath
- path of component to connectconnection
- connection object whose destination will be set to the specified componentSMLException
public boolean isInputConnected(String inputName)
IProcessExec
isInputConnected
in interface IProcessExec
inputName
- name of inputpublic boolean isOutputConnected(String outputName)
IProcessExec
isOutputConnected
in interface IProcessExec
outputName
- name of outputpublic boolean isParamConnected(String paramName)
IProcessExec
isParamConnected
in interface IProcessExec
paramName
- name of parameterpublic IOPropertyList getInputList()
getInputList
in interface IProcessExec
public IOPropertyList getOutputList()
getOutputList
in interface IProcessExec
public IOPropertyList getParameterList()
getParameterList
in interface IProcessExec
public List<DataConnectionList> getInputConnections()
getInputConnections
in interface IProcessExec
public List<DataConnectionList> getParamConnections()
getParamConnections
in interface IProcessExec
public List<DataConnectionList> getOutputConnections()
getOutputConnections
in interface IProcessExec
protected int getSignalIndex(OgcPropertyList<?> ioList, String signalName)
public boolean isUsingQueueBuffers()
IProcessExec
isUsingQueueBuffers
in interface IProcessExec
public void setUsingQueueBuffers(boolean usingQueueBuffers)
setUsingQueueBuffers
in interface IProcessExec
public boolean needSync()
needSync
in interface IProcessExec
Copyright © 2016 Sensia Software LLC. All rights reserved.