eu.semaine.jms.sender
Class StateSender

java.lang.Object
  extended by eu.semaine.jms.IOBase
      extended by eu.semaine.jms.sender.Sender
          extended by eu.semaine.jms.sender.XMLSender
              extended by eu.semaine.jms.sender.StateSender

public class StateSender
extends XMLSender

An abstraction of Sender for state data.

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, topicName
 
Constructor Summary
StateSender(java.lang.String topicName, StateInfo.Type datatype, java.lang.String source)
          Create a new Sender to the given topic on the default JMS server.
StateSender(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
 void sendStateInfo(StateInfo s, long usertime)
          Send the given state information.
 void sendStateInfo(StateInfo s, long usertime, java.lang.String contentID, long contentCreationTime)
          Send the given state information.
 
Methods inherited from class eu.semaine.jms.sender.XMLSender
fillMessageProperties, sendXML, sendXML, sendXML, sendXML
 
Methods inherited from class eu.semaine.jms.sender.Sender
fillMessageProperties, getDatatype, getPeriod, getSource, getTimeToLive, initialise, isEventBased, isPeriodic, main, sendTextMessage, sendTextMessage, 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

StateSender

public StateSender(java.lang.String topicName,
                   StateInfo.Type datatype,
                   java.lang.String source)
            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: 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.
javax.jms.JMSException

StateSender

public StateSender(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.
Method Detail

sendStateInfo

public void sendStateInfo(StateInfo s,
                          long usertime)
                   throws javax.jms.JMSException
Send the given state information.

Parameters:
s - a state information
usertime - the "user" time at which this message is being sent, in milliseconds since system startup.
Throws:
java.lang.IllegalStateException - if the connection is not started or the sender is in periodic mode.
javax.jms.JMSException

sendStateInfo

public void sendStateInfo(StateInfo s,
                          long usertime,
                          java.lang.String contentID,
                          long contentCreationTime)
                   throws javax.jms.JMSException
Send the given state information.

Parameters:
s - a state information
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:
java.lang.IllegalStateException - if the connection is not started or the sender is in periodic mode.
javax.jms.JMSException