|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.semaine.jms.IOBase
eu.semaine.jms.sender.Sender
public class Sender
This class handles the common part to all message senders in the SEMAINE system.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class eu.semaine.jms.IOBase |
---|
IOBase.ConnectionStatus, IOBase.Event |
Field Summary | |
---|---|
protected java.lang.String |
datatype
The name of the data type being sent. |
protected int |
period
If data is periodic, the period in which data is sent, in milliseconds. |
protected MessageProducer |
producer
|
protected java.lang.String |
source
The name of the source component from where the data originated. |
Fields inherited from class eu.semaine.jms.IOBase |
---|
connection, exception, isConnectionStarted, jmsPassword, jmsUrl, jmsUser, session, topic, topicName |
Constructor Summary | |
---|---|
Sender(java.lang.String topicName,
java.lang.String datatype,
java.lang.String source)
Create a new Sender to the given topic on the default JMS server. |
|
Sender(java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword,
java.lang.String topicName,
java.lang.String datatype,
java.lang.String source)
Create a new Sender to the given topic on the given JMS server. |
Method Summary | |
---|---|
protected void |
fillMessageProperties(Message message,
long usertime)
Fill in the usual message properties as far as possible. |
protected void |
fillMessageProperties(Message message,
long usertime,
java.lang.String contentID,
long contentCreationTime)
|
protected void |
fillMessageProperties(Message message,
long usertime,
java.lang.String contentID,
long contentCreationTime,
java.lang.String contentType)
|
java.lang.String |
getDatatype()
The name of the data type sent. |
int |
getPeriod()
For periodic senders, get the period of sending. |
java.lang.String |
getSource()
The name of the source component sending the data. |
long |
getTimeToLive()
Get the time to live for all messages sent by this sender, i.e. the number of milliseconds before the message is considered obsolete by the JMS system. |
protected void |
initialise(java.lang.String datatype,
java.lang.String source)
|
boolean |
isEventBased()
Test whether this sender is set to send messages in an event-based way. |
boolean |
isPeriodic()
Test whether this sender is set to send messages periodically. |
static void |
main(java.lang.String[] args)
|
void |
sendTextMessage(java.lang.String text,
long usertime)
Send a text message via this sender. |
void |
sendTextMessage(java.lang.String text,
long usertime,
IOBase.Event eventType)
Send a text message via this sender, for event-based messages. |
void |
sendTextMessage(java.lang.String text,
long usertime,
IOBase.Event eventType,
java.lang.String contentID,
long contentCreationTime)
Send a text message via this sender, for event-based messages. |
void |
sendTextMessage(java.lang.String text,
long usertime,
IOBase.Event eventType,
java.lang.String contentID,
long contentCreationTime,
java.lang.String contentType)
Send a text message via this sender, for event-based messages. |
void |
sendTextMessage(java.lang.String text,
long usertime,
java.lang.String contentID,
long contentCreationTime)
Send a text message via this sender. |
void |
sendTextMessage(java.lang.String text,
long usertime,
java.lang.String contentID,
long contentCreationTime,
java.lang.String contentType)
Send a text message via this sender. |
void |
setEventBased()
Determine that the data is event-based, not periodic. |
void |
setPeriodic(int aPeriod)
Determine that the data is periodic, and set the period in which data is (intended to be) sent, in milliseconds. |
void |
setTimeToLive(long aTimeToLive)
Deprecated. |
Methods inherited from class eu.semaine.jms.IOBase |
---|
createConnection, getConnection, getConnection, getConnectionStatus, getJMSPassword, getJMSUrl, getJMSUser, getSession, getTopic, getTopicName, isEmbeddedBroker, startConnection, useEmbeddedBroker |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MessageProducer producer
protected java.lang.String datatype
protected java.lang.String source
protected int period
Constructor Detail |
---|
public Sender(java.lang.String topicName, java.lang.String datatype, java.lang.String source) throws JMSException
jms.url
, default value tcp://localhost:61616
;jms.user
, default value null
;jms.password
, default value 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.
JMSException
java.lang.NullPointerException
- if any of the parameters topicName, datatype, or source are null.public Sender(java.lang.String jmsUrl, java.lang.String jmsUser, java.lang.String jmsPassword, java.lang.String topicName, java.lang.String datatype, java.lang.String source) throws JMSException
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.
JMSException
java.lang.NullPointerException
- if any of the parameters jmsUrl, topicName, datatype, or source are null.Method Detail |
---|
protected void initialise(java.lang.String datatype, java.lang.String source) throws JMSException
JMSException
public java.lang.String getDatatype()
public java.lang.String getSource()
public void setPeriodic(int aPeriod)
aPeriod
- the period in which data is to be sent.
java.lang.IllegalArgumentException
- if aPeriod is <= 0.public void setEventBased()
#sendTextMessage(String, long, eu.semaine.jms.IOBase.Event)}.
public boolean isPeriodic()
public boolean isEventBased()
public int getPeriod()
@Deprecated public void setTimeToLive(long aTimeToLive) throws JMSException
aTimeToLive
- time to live, in milliseconds.
A value of 0 means unlimited time, i.e. the messages will not expire.
JMSException
public long getTimeToLive() throws JMSException
JMSException
public void sendTextMessage(java.lang.String text, long usertime) throws JMSException
datatype
is a String property containing the value produced by getDatatype()
;source
is a String property containing the value produced by getSource()
;usertime
is a long property containing the value of parameter usertime
;isPeriodic()
returns true
),
period
is an int property containing the value returned by getPeriod()
;event
is a String property; as
this method does not specify an event type, the default value single
is assumed.getTimeToLive()
returns a non-zero value, the message will
contain a header field JMSExpiration
containing the time when the message
will expire.
text
- the message text.usertime
- the "user" time at which this message is being sent,
in milliseconds since the system started.
java.lang.IllegalStateException
- if the connection is not started or the sender is in event-based mode.
JMSException
- if there was a problem on the connection such as a broker run out of memorypublic void sendTextMessage(java.lang.String text, long usertime, java.lang.String contentID, long contentCreationTime) throws JMSException
datatype
is a String property containing the value produced by getDatatype()
;source
is a String property containing the value produced by getSource()
;usertime
is a long property containing the value of parameter usertime
;isPeriodic()
returns true
),
period
is an int property containing the value returned by getPeriod()
;event
is a String property; as
this method does not specify an event type, the default value single
is assumed.getTimeToLive()
returns a non-zero value, the message will
contain a header field JMSExpiration
containing the time when the message
will expire.
text
- the message text.usertime
- the "user" time at which this message is being sent,
in milliseconds since the system started.contentID
- a unique identifier for the message's content.
If this is not null, it will cause the addition of the String property content-id
in the message.contentCreationTime
- the time when the content in this message was created.
If this is not negative, it will cause the addition of the Long property content-creation-time
in the message.
java.lang.IllegalStateException
- if the connection is not started or the sender is in event-based mode.
JMSException
- if there was a problem on the connection such as a broker run out of memorypublic void sendTextMessage(java.lang.String text, long usertime, java.lang.String contentID, long contentCreationTime, java.lang.String contentType) throws JMSException
datatype
is a String property containing the value produced by getDatatype()
;source
is a String property containing the value produced by getSource()
;usertime
is a long property containing the value of parameter usertime
;isPeriodic()
returns true
),
period
is an int property containing the value returned by getPeriod()
;event
is a String property; as
this method does not specify an event type, the default value single
is assumed.getTimeToLive()
returns a non-zero value, the message will
contain a header field JMSExpiration
containing the time when the message
will expire.
text
- the message text.usertime
- the "user" time at which this message is being sent,
in milliseconds since the system started.contentID
- a unique identifier for the message's content.
If this is not null, it will cause the addition of the String property content-id
in the message.contentCreationTime
- the time when the content in this message was created.
If this is not negative, it will cause the addition of the Long property content-creation-time
in the message.contentType
- an optional content type for the message's content;
The value may be one of SEMAINEMessage.CONTENT_TYPE_UTTERANCE, SEMAINEMessage.CONTENT_TYPE_LISTENERVOCALISATION,
SEMAINEMessage.CONTENT_TYPE_VISUALONLY, or any other string. Can be null, in which case no content type will be sent.
java.lang.IllegalStateException
- if the connection is not started or the sender is in event-based mode.
JMSException
- if there was a problem on the connection such as a broker run out of memorypublic void sendTextMessage(java.lang.String text, long usertime, IOBase.Event eventType) throws JMSException
datatype
is a String property containing the value produced by getDatatype()
;source
is a String property containing the value produced by getSource()
;usertime
is a long property containing the value of parameter usertime
;event
is a String property containing
the String representation of the event parameter to this method.getTimeToLive()
returns a non-zero value, the message will
contain a header field JMSExpiration
containing the time when the message
will expire.
text
- the message text.usertime
- the "user" time at which this message is being sent,
in milliseconds since system startup.event
- the type of event represented by this message.
java.lang.IllegalStateException
- if the connection is not started or the sender is in periodic mode.
JMSException
- if there was a problem on the connection such as a broker run out of memorypublic void sendTextMessage(java.lang.String text, long usertime, IOBase.Event eventType, java.lang.String contentID, long contentCreationTime, java.lang.String contentType) throws JMSException
datatype
is a String property containing the value produced by getDatatype()
;source
is a String property containing the value produced by getSource()
;usertime
is a long property containing the value of parameter usertime
;event
is a String property containing
the String representation of the event parameter to this method.getTimeToLive()
returns a non-zero value, the message will
contain a header field JMSExpiration
containing the time when the message
will expire.
text
- the message text.usertime
- the "user" time at which this message is being sent,
in milliseconds since system startup.event
- the type of event represented by this message.contentID
- a unique identifier for the message's content.
If this is not null, it will cause the addition of the String property content-id
in the message.contentCreationTime
- the time when the content in this message was created.
If this is not negative, it will cause the addition of the Long property content-creation-time
in the message.contentType
- an optional content type for the message's content;
The value may be one of SEMAINEMessage.CONTENT_TYPE_UTTERANCE, SEMAINEMessage.CONTENT_TYPE_LISTENERVOCALISATION,
SEMAINEMessage.CONTENT_TYPE_VISUALONLY, or any other string. Can be null, in which case no content type will be sent.
java.lang.IllegalStateException
- if the connection is not started or the sender is in periodic mode.
JMSException
- if there was a problem on the connection such as a broker run out of memorypublic void sendTextMessage(java.lang.String text, long usertime, IOBase.Event eventType, java.lang.String contentID, long contentCreationTime) throws JMSException
datatype
is a String property containing the value produced by getDatatype()
;source
is a String property containing the value produced by getSource()
;usertime
is a long property containing the value of parameter usertime
;event
is a String property containing
the String representation of the event parameter to this method.getTimeToLive()
returns a non-zero value, the message will
contain a header field JMSExpiration
containing the time when the message
will expire.
text
- the message text.usertime
- the "user" time at which this message is being sent,
in milliseconds since system startup.event
- the type of event represented by this message.contentID
- a unique identifier for the message's content.
If this is not null, it will cause the addition of the String property content-id
in the message.contentCreationTime
- the time when the content in this message was created.
If this is not negative, it will cause the addition of the Long property content-creation-time
in the message.
java.lang.IllegalStateException
- if the connection is not started or the sender is in periodic mode.
JMSException
- if there was a problem on the connection such as a broker run out of memoryprotected void fillMessageProperties(Message message, long usertime) throws JMSException
super.fillMessageProperties(message, usertime)
).
a
- message object in preparation for sending.usertime
- the "user" time at which this message is being sent,
in milliseconds since system startup.
JMSException
protected void fillMessageProperties(Message message, long usertime, java.lang.String contentID, long contentCreationTime) throws JMSException
JMSException
protected void fillMessageProperties(Message message, long usertime, java.lang.String contentID, long contentCreationTime, java.lang.String contentType) throws JMSException
JMSException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |