eu.semaine.jms.sender
Class XMLSender

java.lang.Object
  extended by eu.semaine.jms.IOBase
      extended by eu.semaine.jms.sender.Sender
          extended by eu.semaine.jms.sender.XMLSender
Direct Known Subclasses:
BMLSender, EmmaSender, FMLSender, StateSender

public class XMLSender
extends Sender

An abstraction of Sender for feature vectors.

Author:
marc

Nested Class Summary
 
Nested classes/interfaces inherited from class eu.semaine.jms.IOBase
IOBase.ConnectionStatus, IOBase.Event
 
Field Summary
 
Fields inherited from class eu.semaine.jms.sender.Sender
datatype, period, producer, source
 
Fields inherited from class eu.semaine.jms.IOBase
connection, exception, isConnectionStarted, jmsPassword, jmsUrl, jmsUser, session, topic, topicName
 
Constructor Summary
XMLSender(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.
XMLSender(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.
 void sendXML(org.w3c.dom.Document document, long usertime)
          Send an XML document as a "single" event.
 void sendXML(org.w3c.dom.Document document, long usertime, IOBase.Event event)
          Send an XML document with the given event tag.
 void sendXML(org.w3c.dom.Document document, long usertime, IOBase.Event event, java.lang.String contentID, long contentCreationTime)
          Send an XML document with the given event tag.
 void sendXML(org.w3c.dom.Document document, long usertime, IOBase.Event event, java.lang.String contentID, long contentCreationTime, java.lang.String contentType)
          Send an XML document with the given event tag.
 void sendXML(org.w3c.dom.Document document, long usertime, java.lang.String contentID, long contentCreationTime)
          Send an XML document as a "single" event.
 void sendXML(org.w3c.dom.Document document, long usertime, java.lang.String contentID, long contentCreationTime, java.lang.String contentType)
          Send an XML document as a "single" event.
 
Methods inherited from class eu.semaine.jms.sender.Sender
fillMessageProperties, fillMessageProperties, getDatatype, getPeriod, getSource, getTimeToLive, initialise, isEventBased, isPeriodic, main, sendTextMessage, sendTextMessage, sendTextMessage, sendTextMessage, sendTextMessage, sendTextMessage, setEventBased, setPeriodic, setTimeToLive
 
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
 

Constructor Detail

XMLSender

public XMLSender(java.lang.String topicName,
                 java.lang.String datatype,
                 java.lang.String source)
          throws JMSException,
                 SystemConfigurationException
Create a new Sender to the given topic on the default JMS server. The default JMS server is determined as follows: 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.
Throws:
java.lang.NullPointerException - if any of the parameters topicName, datatype, or source are null.
java.lang.IllegalArgumentException - if period is <= 0.
JMSException
SystemConfigurationException

XMLSender

public XMLSender(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
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 server
jmsUser - 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.
Throws:
JMSException
java.lang.NullPointerException - if any of the parameters jmsUrl, topicName, datatype, or source are null.
java.lang.IllegalArgumentException - if period is <= 0.
Method Detail

sendXML

public void sendXML(org.w3c.dom.Document document,
                    long usertime)
             throws JMSException
Send an XML document as a "single" event.

Parameters:
document - the document to send.
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
Throws:
JMSException

sendXML

public void sendXML(org.w3c.dom.Document document,
                    long usertime,
                    java.lang.String contentID,
                    long contentCreationTime)
             throws JMSException
Send an XML document as a "single" event.

Parameters:
document - the document to send.
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
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.
Throws:
JMSException

sendXML

public void sendXML(org.w3c.dom.Document document,
                    long usertime,
                    java.lang.String contentID,
                    long contentCreationTime,
                    java.lang.String contentType)
             throws JMSException
Send an XML document as a "single" event.

Parameters:
document - the document to send.
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
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.
Throws:
JMSException

sendXML

public void sendXML(org.w3c.dom.Document document,
                    long usertime,
                    IOBase.Event event)
             throws JMSException
Send an XML document with the given event tag.

Parameters:
document - the document to send.
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
event - the kind of event represented by this message
Throws:
JMSException
java.lang.NullPointerException - if document or event is null
java.lang.IllegalStateException - if the sender is set to periodic mode.

sendXML

public void sendXML(org.w3c.dom.Document document,
                    long usertime,
                    IOBase.Event event,
                    java.lang.String contentID,
                    long contentCreationTime)
             throws JMSException
Send an XML document with the given event tag.

Parameters:
document - the document to send.
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
event - the kind 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.
Throws:
JMSException
java.lang.NullPointerException - if document or event is null
java.lang.IllegalStateException - if the sender is set to periodic mode.

sendXML

public void sendXML(org.w3c.dom.Document document,
                    long usertime,
                    IOBase.Event event,
                    java.lang.String contentID,
                    long contentCreationTime,
                    java.lang.String contentType)
             throws JMSException
Send an XML document with the given event tag.

Parameters:
document - the document to send.
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
event - the kind 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.
Throws:
JMSException
java.lang.NullPointerException - if document or event is null
java.lang.IllegalStateException - if the sender is set to periodic mode.

fillMessageProperties

protected void fillMessageProperties(Message message,
                                     long usertime)
                              throws JMSException
Description copied from class: Sender
Fill in the usual message properties as far as possible. Subclasses are encouraged to override this method, but should normally call this method as well (as super.fillMessageProperties(message, usertime)).

Overrides:
fillMessageProperties in class Sender
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
Throws:
JMSException