ConfigType
- Type of process configurationpublic abstract class AbstractStreamProcess<ConfigType extends StreamProcessConfig> extends AbstractModule<ConfigType> implements IStreamProcessModule<ConfigType>
Class providing default implementation of common stream processing API methods.
This can be used as the base for most stream process implementations.
Concrete process implementations generally need to override either
AbstractModule.init(ModuleConfig)
or start()
in order to provide
actual process inputs, outputs and parameters.
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractStreamProcess.InputData |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ID |
protected int |
errorCount |
protected Map<String,net.opengis.swe.v20.DataComponent> |
inputs |
protected long |
lastUpdatedSensorDescription |
protected static int |
MAX_ERRORS |
protected Map<String,IStreamingDataInterface> |
outputInterfaces |
protected Map<String,net.opengis.swe.v20.DataComponent> |
outputs |
protected Map<String,net.opengis.swe.v20.DataComponent> |
parameters |
protected boolean |
paused |
protected net.opengis.sensorml.v20.AbstractProcess |
processDescription |
protected Map<IStreamingDataInterface,AbstractStreamProcess.InputData> |
streamSources |
config, eventHandler
Constructor and Description |
---|
AbstractStreamProcess() |
Modifier and Type | Method and Description |
---|---|
protected void |
addOutput(IStreamingDataInterface outputInterface)
Helper method to make sure derived classes add outputs consistently in the different maps
|
void |
cleanup()
Cleans up all ressources used by the module when deleted
All persistent resources created by the module should be cleaned
when this is called
|
protected void |
connectInput(String inputName,
String dataPath,
org.vast.process.DataQueue inputQueue) |
Map<String,IStreamingDataInterface> |
getAllOutputs()
Retrieves the list of data outputs
|
net.opengis.sensorml.v20.AbstractProcess |
getCurrentDescription()
Retrieves most current SensorML description of the entity whose data
is provided by this module.
|
net.opengis.gml.v32.AbstractFeature |
getCurrentFeatureOfInterest()
Retrieves the feature of interest for which this producer is
currently generating data.
In the case of a module generating data from multiple entities (e.g. |
Map<String,net.opengis.swe.v20.DataComponent> |
getInputDescriptors()
Gets the list of inputs needed by this process.
Note that input data may contain more than the needed input. |
long |
getLastDescriptionUpdate()
Used to check when SensorML description was last updated.
|
Map<String,net.opengis.swe.v20.DataComponent> |
getOutputDescriptors() |
Map<String,net.opengis.swe.v20.DataComponent> |
getParameters()
Gets the list of parameters for this process.
Values should be changed directly inside the objects returned in the map. Parameters that can be changed during processing must be marked as 'updatable' and the new set values are taken into account ASAP by the running process. Changing the value during processing of parameters that are not updatable is either silently ignored or can result in a processing exception. |
void |
handleEvent(Event<?> e) |
void |
pause()
Pauses processing of the event stream.
Incoming events are simply discarded and won't be processed when the process is resumed. |
protected abstract void |
process(DataEvent lastEvent)
Method called everytime a new data event has been received on any input.
Concrete implementation must override this method to launch processing when appropriate (e.g. |
void |
resume()
Resumes normal processing of the event stream.
Processing may actually resume only when the next event is received. |
void |
start()
Starts the module with the current configuration.
init() should always be called before start(). |
void |
stop()
Stops the module.
All temporary resources created by the module should be cleaned when this is called (ex: memory, files, connections, etc.) stop() can be called right after init() even if start() hasn't been called. |
getConfiguration, getLocalID, getName, init, isEnabled, loadState, registerListener, saveState, unregisterListener, updateConfig
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isPauseSupported
isCompatibleDataSource
getConfiguration, getLocalID, getName, init, isEnabled, loadState, registerListener, saveState, unregisterListener, updateConfig
public static final String DEFAULT_ID
protected static final int MAX_ERRORS
protected Map<String,IStreamingDataInterface> outputInterfaces
protected Map<IStreamingDataInterface,AbstractStreamProcess.InputData> streamSources
protected net.opengis.sensorml.v20.AbstractProcess processDescription
protected long lastUpdatedSensorDescription
protected boolean paused
protected int errorCount
protected abstract void process(DataEvent lastEvent) throws ProcessException
lastEvent
- data event triggering this callProcessException
protected void addOutput(IStreamingDataInterface outputInterface)
outputInterface
- public Map<String,net.opengis.swe.v20.DataComponent> getInputDescriptors()
IProcessModule
IProcessModule.isCompatibleDataSource(DataSourceConfig)
getInputDescriptors
in interface IProcessModule<ConfigType extends StreamProcessConfig>
public Map<String,net.opengis.swe.v20.DataComponent> getOutputDescriptors()
getOutputDescriptors
in interface IProcessModule<ConfigType extends StreamProcessConfig>
public Map<String,net.opengis.swe.v20.DataComponent> getParameters()
IStreamProcessModule
getParameters
in interface IStreamProcessModule<ConfigType extends StreamProcessConfig>
public Map<String,IStreamingDataInterface> getAllOutputs()
IDataProducerModule
getAllOutputs
in interface IDataProducerModule<ConfigType extends StreamProcessConfig>
public net.opengis.gml.v32.AbstractFeature getCurrentFeatureOfInterest()
IDataProducerModule
IMultiSourceDataProducer.getCurrentFeatureOfInterest(String)
getCurrentFeatureOfInterest
in interface IDataProducerModule<ConfigType extends StreamProcessConfig>
public net.opengis.sensorml.v20.AbstractProcess getCurrentDescription()
IModuleWithDescription
IMultiSourceDataProducer.getCurrentDescription(String)
getCurrentDescription
in interface IModuleWithDescription
public long getLastDescriptionUpdate()
IModuleWithDescription
getLastDescriptionUpdate
in interface IModuleWithDescription
Long.MIN_VALUE
if description was never updated.protected void connectInput(String inputName, String dataPath, org.vast.process.DataQueue inputQueue) throws Exception
Exception
public void start() throws SensorHubException
IModule
start
in interface IModule<ConfigType extends StreamProcessConfig>
SensorHubException
public void stop()
IModule
stop
in interface IModule<ConfigType extends StreamProcessConfig>
public void cleanup()
IModule
cleanup
in interface IModule<ConfigType extends StreamProcessConfig>
public void pause()
IStreamProcessModule
pause
in interface IStreamProcessModule<ConfigType extends StreamProcessConfig>
public void resume()
IStreamProcessModule
resume
in interface IStreamProcessModule<ConfigType extends StreamProcessConfig>
public void handleEvent(Event<?> e)
handleEvent
in interface IEventListener
Copyright © 2015 Sensia Software LLC. All rights reserved.