eu.semaine.jms.sender
Class FeatureSender
java.lang.Object
eu.semaine.jms.IOBase
eu.semaine.jms.sender.Sender
eu.semaine.jms.sender.FeatureSender
public class FeatureSender
- extends Sender
An abstraction of Sender for feature vectors.
- Author:
- marc
Constructor Summary |
FeatureSender(java.lang.String topicName,
java.lang.String datatype,
java.lang.String source,
int period)
Create a new Sender to the given topic on the default JMS server. |
FeatureSender(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String datatype,
java.lang.String source,
int period)
Create a new Sender to the given topic on the given JMS server. |
Method Summary |
java.lang.String[] |
getFeatureNames()
Provides access to the array of feature names. |
protected void |
sendBinaryFeatureVector(float[] features,
long usertime)
|
void |
sendFeatureVector(float[] features,
long usertime)
Send a vector of float features as a text message. |
void |
sendFeatureVector(float[] features,
long usertime,
boolean sendBinary)
Send a vector of float features. |
protected void |
sendTextFeatureVector(float[] features,
long usertime)
|
void |
setFeatureNames(java.lang.String[] aFeatureNames)
Initiate the list of feature names to use. |
Methods inherited from class eu.semaine.jms.sender.Sender |
fillMessageProperties, getDatatype, getPeriod, getSource, getTimeToLive, initialise, isEventBased, isPeriodic, main, sendTextMessage, sendTextMessage, setEventBased, setPeriodic, setTimeToLive |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
featureNames
protected java.lang.String[] featureNames
FeatureSender
public FeatureSender(java.lang.String topicName,
java.lang.String datatype,
java.lang.String source,
int period)
throws javax.jms.JMSException
- Create a new Sender to the given topic on the default JMS server.
The default JMS server is determined as follows:
- jms URL: read from system property
jms.url
, default value tcp://localhost:61616
;
- jms User: read from system property
jms.user
, default value null
;
- jms Password: read from system property
jms.password
, default value null
.
Datatype and source will be sent with every message.
- Parameters:
topic
- the name of the topic to send to.datatype
- the name of the type of data being sent.source
- the name of the component sending the data.the
- period in which we intend to send data, in milliseconds
- Throws:
java.lang.NullPointerException
- if any of the parameters topicName, datatype, or source are null.
java.lang.IllegalArgumentException
- if period is <= 0.
javax.jms.JMSException
FeatureSender
public FeatureSender(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String datatype,
java.lang.String source,
int period)
throws javax.jms.JMSException
- Create a new Sender to the given topic on the given JMS server.
Datatype and source will be sent with every message.
- Parameters:
jmsUrl
- the url where to contact the JMS serverjmsUser
- the username to use (can be null)jmsPassword
- the password to use (can be null)topic
- the name of the topic to send to.datatype
- the name of the type of data being sent.source
- the name of the component sending the data.the
- period in which we intend to send data, in milliseconds
- Throws:
javax.jms.JMSException
java.lang.NullPointerException
- if any of the parameters jmsUrl, topicName, datatype, or source are null.
java.lang.IllegalArgumentException
- if period is <= 0.
setFeatureNames
public void setFeatureNames(java.lang.String[] aFeatureNames)
- Initiate the list of feature names to use. This method must be called
exactly once, after the creation of the object and before the first
send operation.
- Parameters:
aFeatureNames
- the feature names, in exactly the same order
as the features that will be sent.
- Throws:
java.lang.IllegalStateException
- if feature names have been set before.
java.lang.NullPointerException
- if aFeatureNames is null.
getFeatureNames
public java.lang.String[] getFeatureNames()
- Provides access to the array of feature names. May be useful for debugging.
- Returns:
- the internal feature names array.
sendFeatureVector
public void sendFeatureVector(float[] features,
long usertime)
throws javax.jms.JMSException
- Send a vector of float features as a text message.
Before sending features,
{@link #setFeatureNames(String[]) must be called, and the
names must correspond to the features passed in the argument.
- Parameters:
features
- the features to send.usertime
- the time in "user" space that these features
refer to, in milliseconds since 1970.
- Throws:
javax.jms.JMSException
sendFeatureVector
public void sendFeatureVector(float[] features,
long usertime,
boolean sendBinary)
throws javax.jms.JMSException
- Send a vector of float features. Before sending features,
{@link #setFeatureNames(String[]) must be called, and the
names must correspond to the features passed in the argument.
- Parameters:
features
- the features to send.usertime
- the time in "user" space that these features
refer to, in milliseconds since 1970.
- Throws:
javax.jms.JMSException
sendBinaryFeatureVector
protected void sendBinaryFeatureVector(float[] features,
long usertime)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
sendTextFeatureVector
protected void sendTextFeatureVector(float[] features,
long usertime)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException