public abstract class AbstractProcessor extends SystemComponent implements Source, Sink
SystemComponent
combining characteristics of both Source
and Sink
, for it
accepts raw data and offers refined data.Constructor and Description |
---|
AbstractProcessor(LifeCycleManager manager,
java.util.HashMap<java.lang.String,java.lang.String> configuration)
Creates a new
AbstractProcessor . |
Modifier and Type | Method and Description |
---|---|
protected DataDescription[] |
getDescriptionsForIncomingData()
Collects the
DataDescription s for all incoming data-queues. |
ConnectorSink |
getSinkConnector()
Returns the
Sink 's ConnectorSink . |
ConnectorSource |
getSourceConnector()
Returns the
Source 's ConnectorSource . |
void |
initConnector()
Initiates a
SystemComponent 's Connector s. |
protected abstract void |
processData(DataEntry data)
Passes a
DataEntry to the AbstractProcessor which needs
to be processed. |
void |
receiveData(java.util.concurrent.LinkedBlockingQueue<DataEntry> data,
DataDescription description)
Sets a
LinkedBlockingQueue of DataEntry s to receive data
with. |
boolean |
stopComponent()
Stops the component.
|
void |
stopReceiving()
Stops receiving data.
|
configure, configureComponent, disableMeasuring, enableMeasuring, getLifeCycleManager, getState, isReadyToMeasure, measure, measureComponent, stop, train, trainComponent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOutputDescription
getInputDescription
public AbstractProcessor(LifeCycleManager manager, java.util.HashMap<java.lang.String,java.lang.String> configuration) throws InstantiationException
AbstractProcessor
.LifeCycleManager
to register itself to in order to be
managed (that is controlled in its life-cycle) and a HashMap
containing information about the processor's configuration.manager
- LifeCycleManager
the processor will register itself to.configuration
- HashMap
containing information about the processor's
configuration.InstantiationException
- if given configuration or manager are not valid.public void initConnector()
SystemComponent
SystemComponent
's Connector
s.initConnector
in class SystemComponent
public ConnectorSource getSourceConnector()
Source
Source
's ConnectorSource
.getSourceConnector
in interface Source
Source
's ConnectorSource
.public ConnectorSink getSinkConnector()
Sink
Sink
's ConnectorSink
.getSinkConnector
in interface Sink
Sink
's ConnectorSink
.public boolean stopComponent()
SystemComponent
SystemComponent.stop()
is called to
allow custom stopping-tasks (e.g. releasing connections).stopComponent
in class SystemComponent
public void receiveData(java.util.concurrent.LinkedBlockingQueue<DataEntry> data, DataDescription description)
Sink
LinkedBlockingQueue
of DataEntry
s to receive data
with. Can be called multiple times if the Sink is matched with multiple
Source
s.receiveData
in interface Sink
data
- LinkedBlockingQueue
to receive DataEntry
s
with.description
- DataDescription
describing incoming data for given
queue.protected abstract void processData(DataEntry data)
DataEntry
to the AbstractProcessor
which needs
to be processed.entry
- DataEntry
to be processed.protected DataDescription[] getDescriptionsForIncomingData()
DataDescription
s for all incoming data-queues.public void stopReceiving()
ReceiverThread
.