public abstract class AbstractSampleConsumer extends AbstractSampleProcessor implements SampleConsumer, SampleProducer
Constructor and Description |
---|
AbstractSampleConsumer() |
Modifier and Type | Method and Description |
---|---|
void |
addSampleConsumer(SampleConsumer consumer) |
int |
getConsumedChannelCount() |
SampleMetadata |
getConsumedMetadata(int channel) |
protected SampleConsumer |
getConsumer(int i) |
protected Object |
getDataFromContext(String key)
Gets the data identified by the specified key from the current sample
context
|
String |
getName()
Gets the name of the consumer.
|
File |
getWorkingDirectory() |
void |
produce(Sample s,
int channel)
Produce a single sample on the specified channel
|
void |
removeSampleConsumer(SampleConsumer consumer) |
void |
setChannelAttribute(int channel,
String key,
Object value)
Associate an attribute to the specified channel for this sample processor
If the attribute already exist, it is replaced. |
void |
setConsumedMetadata(SampleMetadata sampleMetadata,
int channel)
Set the metadata of samples that will be consumed on the specified
channel.
|
protected void |
setDataToContext(String key,
Object value)
Store data in the current sample context with the specified key
identifier.
|
void |
setName(String name)
Sets the name of the consumer.
|
void |
setProducedMetadata(SampleMetadata metadata,
int channel)
Set the metadata associated woth the specified channel
|
void |
setSampleConsumer(SampleConsumer consumer) |
void |
setSampleConsumers(List<SampleConsumer> consumers)
Sets the consumers
|
void |
setSampleContext(SampleContext sampleContext)
Set sample context that this consumer should rely on.
|
void |
startProducing()
Start producing samples, must be invoked before any call to
produce() |
void |
stopProducing()
Stop producing samples, no
produce() call should occur after
this service has been called. |
getChannelAttribute, getSampleContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
consume, startConsuming, stopConsuming
getChannelAttribute, getSampleContext
protected final Object getDataFromContext(String key)
key
- the keyprotected final void setDataToContext(String key, Object value)
key
- the keyvalue
- the valuepublic String getName()
public void setName(String name)
name
- the new namepublic final File getWorkingDirectory()
public void setSampleContext(SampleContext sampleContext)
SampleProcessor
setSampleContext
in interface SampleProcessor
setSampleContext
in class AbstractSampleProcessor
sampleContext
- the new sample contextpublic void setSampleConsumers(List<SampleConsumer> consumers)
consumers
- for the samples (must not be null
)public void addSampleConsumer(SampleConsumer consumer)
public void setSampleConsumer(SampleConsumer consumer)
public void removeSampleConsumer(SampleConsumer consumer)
public void setConsumedMetadata(SampleMetadata sampleMetadata, int channel)
SampleConsumer
setConsumedMetadata
in interface SampleConsumer
sampleMetadata
- The sample metadata that are beeing consumed for the
associated channelchannel
- The channel whose sample metadata are beeing definedpublic SampleMetadata getConsumedMetadata(int channel)
public int getConsumedChannelCount()
public void setChannelAttribute(int channel, String key, Object value)
SampleProcessor
setChannelAttribute
in interface SampleProcessor
setChannelAttribute
in class AbstractSampleProcessor
channel
- The channel number to associate the attribute onkey
- The attribute keyvalue
- The attribute value to be setpublic void setProducedMetadata(SampleMetadata metadata, int channel)
SampleProducer
setProducedMetadata
in interface SampleProducer
metadata
- The metadata to be associated to the specified channelchannel
- The channel whoses metadata are beeing associated wihprotected SampleConsumer getConsumer(int i)
public void startProducing()
SampleProducer
produce()
startProducing
in interface SampleProducer
public void produce(Sample s, int channel)
SampleProducer
produce
in interface SampleProducer
s
- The sample producedchannel
- The channel on which is produced the samplepublic void stopProducing()
SampleProducer
produce()
call should occur after
this service has been called.stopProducing
in interface SampleProducer
Copyright © 1998-2016 Apache Software Foundation. All Rights Reserved.