Package org.vast.process
Class DataConnection
java.lang.Object
org.vast.process.DataConnection
- All Implemented Interfaces:
IDataConnection
- Direct Known Subclasses:
DataQueue
Implementation of data connection for the processing engine.
This class is capable of automatically converting units if source and target
are not in the same unit (units have to be physically compatible)
This class is used when running all processes of a processing chain
synchronously in a single thread
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<DataConnection.ComponentConverter>
protected boolean
protected DataChoice
protected int
protected DataComponent
protected IProcessExec
protected DataComponent
protected IProcessExec
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all remaining data on this connectiongetProperty
(String propName) protected UnitConverter
getUnitConverter
(DataComponent src, DataComponent dest) boolean
void
Publish data from source component on this connectionvoid
setDestination
(IProcessExec process, DataComponent component) void
setProperty
(String propName, Object propValue) void
setSource
(IProcessExec process, DataComponent component) protected void
boolean
transferData
(boolean block) Transfer data to destination componentstatic String
validate
(DataComponent src, DataComponent dest) Checks that source and destination components can be connected.protected static void
validateArray
(DataArray srcComp, DataArray destComp, StringBuilder msg) protected static void
validateScalar
(DataComponent srcComp, DataComponent destComp, StringBuilder msg)
-
Field Details
-
sourceProcess
-
destinationProcess
-
sourceComponent
-
destinationComponent
-
destinationChoice
-
destinationChoiceIdx
protected int destinationChoiceIdx -
dataAvailable
protected boolean dataAvailable -
componentConverters
-
properties
-
-
Constructor Details
-
DataConnection
public DataConnection()
-
-
Method Details
-
setupUnitConverters
protected void setupUnitConverters() -
getUnitConverter
-
validate
Checks that source and destination components can be connected. This validates compatibility of units and structure of aggregates.- Parameters:
src
-dest
-- Returns:
- Warning message or null if no warning
- Throws:
ProcessException
-
validateArray
protected static void validateArray(DataArray srcComp, DataArray destComp, StringBuilder msg) throws ProcessException - Throws:
ProcessException
-
validateScalar
protected static void validateScalar(DataComponent srcComp, DataComponent destComp, StringBuilder msg) throws ProcessException - Throws:
ProcessException
-
publishData
Description copied from interface:IDataConnection
Publish data from source component on this connection- Specified by:
publishData
in interfaceIDataConnection
- Throws:
InterruptedException
- if interrupted while waiting
-
transferData
Description copied from interface:IDataConnection
Transfer data to destination component- Specified by:
transferData
in interfaceIDataConnection
- Parameters:
block
- Set to true if processing should wait until data is available on this connection, false if processing should continue without it- Returns:
- True if data was actually transferred, false otherwise
- Throws:
InterruptedException
- if interrupted while waiting
-
setSource
- Specified by:
setSource
in interfaceIDataConnection
-
getSourceProcess
- Specified by:
getSourceProcess
in interfaceIDataConnection
-
getSourcePort
- Specified by:
getSourcePort
in interfaceIDataConnection
-
getSourceComponent
- Specified by:
getSourceComponent
in interfaceIDataConnection
-
setDestination
- Specified by:
setDestination
in interfaceIDataConnection
-
getDestinationProcess
- Specified by:
getDestinationProcess
in interfaceIDataConnection
-
getDestinationPort
- Specified by:
getDestinationPort
in interfaceIDataConnection
-
getDestinationComponent
- Specified by:
getDestinationComponent
in interfaceIDataConnection
-
isDataAvailable
public boolean isDataAvailable()- Specified by:
isDataAvailable
in interfaceIDataConnection
- Returns:
- true if data is available (i.e. ready to be transfered) on this connection
-
clear
public void clear()Description copied from interface:IDataConnection
Clear all remaining data on this connection- Specified by:
clear
in interfaceIDataConnection
-
getProperty
-
setProperty
-