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.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, isConnectionStarted, jmsPassword, jmsUrl, jmsUser, session, topic
 
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(javax.jms.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.
 
Methods inherited from class eu.semaine.jms.sender.Sender
getDatatype, getPeriod, getSource, getTimeToLive, initialise, isEventBased, isPeriodic, main, sendTextMessage, sendTextMessage, setEventBased, setPeriodic, setTimeToLive
 
Methods inherited from class eu.semaine.jms.IOBase
getConnection, getJMSUrl, getSession, getTopic, getTopicName, startConnection
 
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 javax.jms.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.
javax.jms.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 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 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:
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.
Method Detail

sendXML

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

Parameters:
document - the document to send.
usertime - the time in "user" space that these features refer to, in milliseconds since 1970.
Throws:
javax.jms.JMSException

sendXML

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

Parameters:
document - the document to send.
usertime - the time in "user" space that these features refer to, in milliseconds since 1970.
event - the kind of event represented by this message
Throws:
javax.jms.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(javax.jms.Message message,
                                     long usertime)
                              throws javax.jms.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 that this message refers to, in milliseconds since 1970.
Throws:
javax.jms.JMSException