Package org.vast.sensorML
Class AbstractProcessImpl
java.lang.Object
net.opengis.gml.v32.impl.AbstractGMLImpl
net.opengis.gml.v32.impl.AbstractFeatureImpl
net.opengis.sensorml.v20.impl.DescribedObjectImpl
org.vast.sensorML.AbstractProcessImpl
- All Implemented Interfaces:
Serializable
,AbstractFeature
,AbstractGML
,AbstractProcess
,DescribedObject
,IFeature
,IProcedure
,IProcessExec
,IResource
- Direct Known Subclasses:
AggregateProcessImpl
,PhysicalComponentImpl
,SimpleProcessImpl
public abstract class AbstractProcessImpl
extends DescribedObjectImpl
implements AbstractProcess, IProcessExec
This class implements both AbstractProcess from SensorML v2.0 bindings
and IProcessExec to allow execution if an executable implementation is
provided.
In order to provide execution capabilitiy, this class can wrap an
implementation of IProcessExec corresponding to a particular algorithm.
- Since:
- Feb 28, 2015
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Settings
protected String
protected IProcessExec
protected FeatureList
protected IOPropertyList
protected ArrayList<AbstractModes>
protected IOPropertyList
protected IOPropertyList
protected Reference
Fields inherited from class net.opengis.sensorml.v20.impl.DescribedObjectImpl
capabilitiesList, characteristicsList, classificationList, contactsList, documentationList, extensionList, historyList, identificationList, keywordsList, lang, legalConstraintsList, securityConstraintsList, validTimeList
Fields inherited from class net.opengis.gml.v32.impl.AbstractFeatureImpl
boundedBy, location
Fields inherited from class net.opengis.gml.v32.impl.AbstractGMLImpl
description, descriptionReference, id, identifier, metaDataPropertyList, nameList, UUID_CODE
Fields inherited from interface net.opengis.sensorml.v20.DescribedObject
DEFAULT_NS_URI
Fields inherited from interface org.vast.ogc.gml.IFeature
DEFAULT_QNAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addInput
(String name, DataInterface input) Adds a new inputAsDataInterface propertyvoid
addInput
(String name, ObservableProperty input) Adds a new inputAsObservableProperty propertyvoid
addInput
(String name, DataComponent input) Adds a new inputAsAbstractDataComponent propertyvoid
addInput
(String name, DataStream input) Adds a new inputAsDataStream propertyvoid
addModes
(AbstractModes modes) Adds a new modes propertyvoid
addOutput
(String name, DataInterface output) Adds a new outputAsDataInterface propertyvoid
addOutput
(String name, ObservableProperty output) Adds a new outputAsObservableProperty propertyvoid
addOutput
(String name, DataComponent output) Adds a new outputAsAbstractDataComponent propertyvoid
addOutput
(String name, DataStream output) Adds a new outputAsDataStream propertyvoid
addParameter
(String name, DataInterface parameter) Adds a new parameterAsDataInterface propertyvoid
addParameter
(String name, ObservableProperty parameter) Adds a new parameterAsObservableProperty propertyvoid
addParameter
(String name, DataComponent parameter) Adds a new parameterAsAbstractDataComponent propertyvoid
addParameter
(String name, DataStream parameter) Adds a new parameterAsDataStream propertyboolean
canRun()
Check that all needed connections are ready for the process to runprotected void
void
connect
(DataComponent component, IDataConnection connection) Connects one of this process ports with the given connectionvoid
disconnect
(IDataConnection connection) Detach connection from this process input, output or parametervoid
dispose()
Override to dispose of all resources allocated for the process (stop threads, OS resources, etc...)void
execute()
Execute contains the logic to transform input/parameter values into output values.Gets the configuration propertyGets the definition propertyGets the description propertyGets the featuresOfInterest propertyGets the input property with the given namegetInputComponent
(String name) Gets the data structure of the input with the given nameGets the list of input propertiesGets the list of modes propertiesgetName()
int
Returns number of input propertiesint
Returns number of modes propertiesint
Returns number of output propertiesint
Returns number of parameter propertiesGets the output property with the given namegetOutputComponent
(String name) Gets the data structure of the output with the given nameGets the list of output propertiesgetParameter
(String name) Gets the parameter property with the given namegetParameterComponent
(String name) Gets the data structure of the parameter with the given nameGets the list of parameter propertiesGets the typeOf propertyvoid
init()
Initialize the process and its internal variables (fixed parameters).boolean
boolean
Checks if configuration is setboolean
Checks if definition is setboolean
Checks if featuresOfInterest is setboolean
Checks if typeOf is setprotected void
mergePort
(DataComponent smlPort, DataComponent execPort) protected IOPropertyList
mergePortDescriptors
(IOPropertyList smlPorts, IOPropertyList execPorts) boolean
needSync()
void
Notifies the process that one or more parameter values have changed before or during executionvoid
run()
Runs the process which includes fetching input data, calling execute and producing output datavoid
setConfiguration
(Settings configuration) Sets the configuration propertyvoid
setDefinition
(String definition) Sets the definition propertyvoid
setExecutableImpl
(IProcessExec processExec) void
setFeaturesOfInterest
(FeatureList featuresOfInterest) Sets the featuresOfInterest propertyvoid
setInstanceName
(String name) Sets the name of this process instancevoid
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.void
Sets the typeOf propertyvoid
start
(ExecutorService threadPool, Consumer<Throwable> onError) Start process using threads from the given thread poolvoid
Start process in its own threadvoid
stop()
Stop process thread gracefullytoString()
Methods inherited from class net.opengis.sensorml.v20.impl.DescribedObjectImpl
addCapabilities, addCharacteristics, addClassification, addContacts, addDocumentation, addExtension, addHistory, addIdentification, addKeywords, addLegalConstraints, addSecurityConstraints, addValidTimeAsTimeInstant, addValidTimeAsTimePeriod, getCapabilities, getCapabilitiesList, getCharacteristics, getCharacteristicsList, getClassificationList, getContactsList, getDocumentationList, getExtensionList, getHistoryList, getIdentificationList, getKeywordsList, getLang, getLegalConstraintsList, getNumCapabilities, getNumCharacteristics, getNumClassifications, getNumContacts, getNumDocumentations, getNumExtensions, getNumHistorys, getNumIdentifications, getNumKeywords, getNumLegalConstraints, getNumSecurityConstraints, getNumValidTimes, getSecurityConstraintsList, getValidTime, getValidTimeList, isSetLang, setLang
Methods inherited from class net.opengis.gml.v32.impl.AbstractFeatureImpl
equals, getBoundedBy, getGeometry, getGeometryProperty, hashCode, isSetBoundedBy, isSetGeometry, setBoundedByAsEnvelope, setGeometry
Methods inherited from class net.opengis.gml.v32.impl.AbstractGMLImpl
addName, getDescriptionReference, getId, getIdentifier, getMetaDataPropertyList, getNameList, getNumNames, getUniqueIdentifier, isSetDescription, isSetDescriptionReference, isSetIdentifier, setDescription, setDescriptionReference, setId, setIdentifier, setName, setUniqueIdentifier
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.opengis.gml.v32.AbstractFeature
getBoundedBy, getGeometryProperty, isSetBoundedBy, isSetGeometry, setBoundedByAsEnvelope, setGeometry
Methods inherited from interface net.opengis.gml.v32.AbstractGML
addName, getDescriptionReference, getId, getIdentifier, getMetaDataPropertyList, getNameList, getNumNames, getUniqueIdentifier, isSetDescription, isSetDescriptionReference, isSetIdentifier, setDescription, setDescriptionReference, setId, setIdentifier, setName, setUniqueIdentifier
Methods inherited from interface net.opengis.sensorml.v20.AbstractProcess
getLocation, getType, isSetLocation, setLocation
Methods inherited from interface net.opengis.sensorml.v20.DescribedObject
addCapabilities, addCharacteristics, addClassification, addContacts, addDocumentation, addExtension, addHistory, addIdentification, addKeywords, addLegalConstraints, addSecurityConstraints, addValidTimeAsTimeInstant, addValidTimeAsTimePeriod, getCapabilities, getCapabilitiesList, getCharacteristics, getCharacteristicsList, getClassificationList, getContactsList, getDocumentationList, getExtensionList, getHistoryList, getIdentificationList, getKeywordsList, getLang, getLegalConstraintsList, getNumCapabilities, getNumCharacteristics, getNumClassifications, getNumContacts, getNumDocumentations, getNumExtensions, getNumHistorys, getNumIdentifications, getNumKeywords, getNumLegalConstraints, getNumSecurityConstraints, getNumValidTimes, getSecurityConstraintsList, getValidTimeList, isSetLang, setLang
Methods inherited from interface org.vast.ogc.gml.IFeature
getGeometry, getId, getProperties, getQName, getUniqueIdentifier, getValidTime, hasCustomGeomProperty, hasCustomTimeProperty
-
Field Details
-
definition
-
typeOf
-
configuration
-
featuresOfInterest
-
inputData
-
outputData
-
paramData
-
modesList
-
executableProcess
-
-
Constructor Details
-
AbstractProcessImpl
public AbstractProcessImpl()
-
-
Method Details
-
getDefinition
Gets the definition property- Specified by:
getDefinition
in interfaceAbstractProcess
-
isSetDefinition
public boolean isSetDefinition()Checks if definition is set- Specified by:
isSetDefinition
in interfaceAbstractProcess
-
setDefinition
Sets the definition property- Specified by:
setDefinition
in interfaceAbstractProcess
-
getName
- Specified by:
getName
in interfaceAbstractGML
- Specified by:
getName
in interfaceIResource
- Overrides:
getName
in classAbstractGMLImpl
- Returns:
- the default name
-
getDescription
Description copied from class:AbstractGMLImpl
Gets the description property- Specified by:
getDescription
in interfaceAbstractGML
- Specified by:
getDescription
in interfaceIResource
- Overrides:
getDescription
in classAbstractGMLImpl
- Returns:
- A short description of the resource
-
setExecutableImpl
- Throws:
ProcessException
-
mergePortDescriptors
protected IOPropertyList mergePortDescriptors(IOPropertyList smlPorts, IOPropertyList execPorts) throws ProcessException - Throws:
ProcessException
-
mergePort
- Throws:
ProcessException
-
isExecutable
public boolean isExecutable() -
getProcessInfo
- Specified by:
getProcessInfo
in interfaceIProcessExec
- Returns:
- all process information (name, UID, etc.)
-
init
Description copied from interface:IProcessExec
Initialize the process and its internal variables (fixed parameters). This is called only once before the process is executed.- Specified by:
init
in interfaceIProcessExec
- Throws:
ProcessException
-
canRun
public boolean canRun()Description copied from interface:IProcessExec
Check that all needed connections are ready for the process to run- Specified by:
canRun
in interfaceIProcessExec
- Returns:
- true if so and false if at least one connection is not ready.
-
run
Description copied from interface:IProcessExec
Runs the process which includes fetching input data, calling execute and producing output data- Specified by:
run
in interfaceIProcessExec
- Throws:
ProcessException
-
execute
Description copied from interface:IProcessExec
Execute contains the logic to transform input/parameter values into output values. This method should be optimized as much as possible.- Specified by:
execute
in interfaceIProcessExec
- Throws:
ProcessException
-
start
Description copied from interface:IProcessExec
Start process in its own thread- Specified by:
start
in interfaceIProcessExec
- Parameters:
onError
- Called when the process ends with an unrecoverable error- Throws:
ProcessException
-
start
Description copied from interface:IProcessExec
Start process using threads from the given thread pool- Specified by:
start
in interfaceIProcessExec
onError
- Called when the process ends with an unrecoverable error- Throws:
ProcessException
-
stop
public void stop()Description copied from interface:IProcessExec
Stop process thread gracefully- Specified by:
stop
in interfaceIProcessExec
-
notifyParamChange
public void notifyParamChange()Description copied from interface:IProcessExec
Notifies the process that one or more parameter values have changed before or during execution- Specified by:
notifyParamChange
in interfaceIProcessExec
-
dispose
public void dispose()Description copied from interface:IProcessExec
Override to dispose of all resources allocated for the process (stop threads, OS resources, etc...)- Specified by:
dispose
in interfaceIProcessExec
-
getInputConnections
- Specified by:
getInputConnections
in interfaceIProcessExec
- Returns:
- Read-only list of connections input ports
-
getParamConnections
- Specified by:
getParamConnections
in interfaceIProcessExec
- Returns:
- Read-only list of connections parameter ports
-
getOutputConnections
- Specified by:
getOutputConnections
in interfaceIProcessExec
- Returns:
- Read-only list of connections output ports
-
connect
Description copied from interface:IProcessExec
Connects one of this process ports with the given connection- Specified by:
connect
in interfaceIProcessExec
- Parameters:
component
- input, parameter or output component to connectconnection
- connection object to use- Throws:
ProcessException
- if connection cannot be validated (this usually happens because source and destination components are not compatible)
-
setInstanceName
Description copied from interface:IProcessExec
Sets the name of this process instance- Specified by:
setInstanceName
in interfaceIProcessExec
-
getInstanceName
- Specified by:
getInstanceName
in interfaceIProcessExec
- Returns:
- name of this process instance
-
disconnect
Description copied from interface:IProcessExec
Detach connection from this process input, output or parameter- Specified by:
disconnect
in interfaceIProcessExec
-
setParentLogger
public void setParentLogger(org.slf4j.Logger log) Description copied from interface:IProcessExec
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.- Specified by:
setParentLogger
in interfaceIProcessExec
-
needSync
public boolean needSync()- Specified by:
needSync
in interfaceIProcessExec
- 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
-
checkExecutable
protected void checkExecutable() -
toString
-
getTypeOf
Gets the typeOf property- Specified by:
getTypeOf
in interfaceAbstractProcess
-
isSetTypeOf
public boolean isSetTypeOf()Checks if typeOf is set- Specified by:
isSetTypeOf
in interfaceAbstractProcess
-
setTypeOf
Sets the typeOf property- Specified by:
setTypeOf
in interfaceAbstractProcess
-
getConfiguration
Gets the configuration property- Specified by:
getConfiguration
in interfaceAbstractProcess
-
isSetConfiguration
public boolean isSetConfiguration()Checks if configuration is set- Specified by:
isSetConfiguration
in interfaceAbstractProcess
-
setConfiguration
Sets the configuration property- Specified by:
setConfiguration
in interfaceAbstractProcess
-
getFeaturesOfInterest
Gets the featuresOfInterest property- Specified by:
getFeaturesOfInterest
in interfaceAbstractProcess
-
isSetFeaturesOfInterest
public boolean isSetFeaturesOfInterest()Checks if featuresOfInterest is set- Specified by:
isSetFeaturesOfInterest
in interfaceAbstractProcess
-
setFeaturesOfInterest
Sets the featuresOfInterest property- Specified by:
setFeaturesOfInterest
in interfaceAbstractProcess
-
getInputList
Description copied from interface:AbstractProcess
Gets the list of input properties- Specified by:
getInputList
in interfaceAbstractProcess
- Specified by:
getInputList
in interfaceIProcessExec
- Returns:
- List of inputs
-
getNumInputs
public int getNumInputs()Description copied from interface:AbstractProcess
Returns number of input properties- Specified by:
getNumInputs
in interfaceAbstractProcess
-
getInput
Description copied from interface:AbstractProcess
Gets the input property with the given name- Specified by:
getInput
in interfaceAbstractProcess
-
getInputComponent
Description copied from interface:AbstractProcess
Gets the data structure of the input with the given name- Specified by:
getInputComponent
in interfaceAbstractProcess
-
addInput
Description copied from interface:AbstractProcess
Adds a new inputAsAbstractDataComponent property- Specified by:
addInput
in interfaceAbstractProcess
-
addInput
Description copied from interface:AbstractProcess
Adds a new inputAsObservableProperty property- Specified by:
addInput
in interfaceAbstractProcess
-
addInput
Description copied from interface:AbstractProcess
Adds a new inputAsDataStream property- Specified by:
addInput
in interfaceAbstractProcess
-
addInput
Description copied from interface:AbstractProcess
Adds a new inputAsDataInterface property- Specified by:
addInput
in interfaceAbstractProcess
-
getOutputList
Description copied from interface:AbstractProcess
Gets the list of output properties- Specified by:
getOutputList
in interfaceAbstractProcess
- Specified by:
getOutputList
in interfaceIProcessExec
- Returns:
- List of outputs
-
getNumOutputs
public int getNumOutputs()Description copied from interface:AbstractProcess
Returns number of output properties- Specified by:
getNumOutputs
in interfaceAbstractProcess
-
getOutput
Description copied from interface:AbstractProcess
Gets the output property with the given name- Specified by:
getOutput
in interfaceAbstractProcess
-
getOutputComponent
Description copied from interface:AbstractProcess
Gets the data structure of the output with the given name- Specified by:
getOutputComponent
in interfaceAbstractProcess
-
addOutput
Description copied from interface:AbstractProcess
Adds a new outputAsAbstractDataComponent property- Specified by:
addOutput
in interfaceAbstractProcess
-
addOutput
Description copied from interface:AbstractProcess
Adds a new outputAsObservableProperty property- Specified by:
addOutput
in interfaceAbstractProcess
-
addOutput
Description copied from interface:AbstractProcess
Adds a new outputAsDataStream property- Specified by:
addOutput
in interfaceAbstractProcess
-
addOutput
Description copied from interface:AbstractProcess
Adds a new outputAsDataInterface property- Specified by:
addOutput
in interfaceAbstractProcess
-
getNumParameters
public int getNumParameters()Description copied from interface:AbstractProcess
Returns number of parameter properties- Specified by:
getNumParameters
in interfaceAbstractProcess
-
getParameter
Description copied from interface:AbstractProcess
Gets the parameter property with the given name- Specified by:
getParameter
in interfaceAbstractProcess
-
getParameterComponent
Description copied from interface:AbstractProcess
Gets the data structure of the parameter with the given name- Specified by:
getParameterComponent
in interfaceAbstractProcess
-
addParameter
Description copied from interface:AbstractProcess
Adds a new parameterAsAbstractDataComponent property- Specified by:
addParameter
in interfaceAbstractProcess
-
addParameter
Description copied from interface:AbstractProcess
Adds a new parameterAsObservableProperty property- Specified by:
addParameter
in interfaceAbstractProcess
-
addParameter
Description copied from interface:AbstractProcess
Adds a new parameterAsDataStream property- Specified by:
addParameter
in interfaceAbstractProcess
-
addParameter
Description copied from interface:AbstractProcess
Adds a new parameterAsDataInterface property- Specified by:
addParameter
in interfaceAbstractProcess
-
getParameterList
Description copied from interface:AbstractProcess
Gets the list of parameter properties- Specified by:
getParameterList
in interfaceAbstractProcess
- Specified by:
getParameterList
in interfaceIProcessExec
- Returns:
- List of parameters
-
getModesList
Gets the list of modes properties- Specified by:
getModesList
in interfaceAbstractProcess
-
getNumModes
public int getNumModes()Returns number of modes properties- Specified by:
getNumModes
in interfaceAbstractProcess
-
addModes
Adds a new modes property- Specified by:
addModes
in interfaceAbstractProcess
-