eu.semaine.jms.receiver
Class StateReceiver

java.lang.Object
  extended by eu.semaine.jms.IOBase
      extended by eu.semaine.jms.receiver.Receiver
          extended by eu.semaine.jms.receiver.XMLReceiver
              extended by eu.semaine.jms.receiver.StateReceiver
All Implemented Interfaces:
javax.jms.MessageListener

public class StateReceiver
extends XMLReceiver


Nested Class Summary
 
Nested classes/interfaces inherited from class eu.semaine.jms.IOBase
IOBase.Event
 
Field Summary
 
Fields inherited from class eu.semaine.jms.receiver.Receiver
consumer, listener, log, message
 
Fields inherited from class eu.semaine.jms.IOBase
connection, isConnectionStarted, jmsPassword, jmsUrl, jmsUser, session, topic
 
Constructor Summary
StateReceiver(java.lang.String topicName, StateInfo.Type stateInfoType)
          Create a receiver that will listen for all messages in the given Topic.
StateReceiver(java.lang.String topicName, java.lang.String messageSelector, StateInfo.Type stateInfoType)
          Create a receiver that will listen only to the messages in the given Topic that will pass the given messageSelector.
 
Method Summary
protected  SEMAINEMessage createSEMAINEMessage(javax.jms.Message m)
          Create a SEMAINE message from the given JMS message.
 java.lang.String getCurrentBestGuess(java.lang.String infoItem)
          Provide the current best guess for the given info item.
 void onMessage(javax.jms.Message m)
           
 
Methods inherited from class eu.semaine.jms.receiver.Receiver
getMessage, getMessageListener, getMessageSelector, main, notPickedUp, receive, receive, receiveNoWait, setMessageListener
 
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

StateReceiver

public StateReceiver(java.lang.String topicName,
                     StateInfo.Type stateInfoType)
              throws javax.jms.JMSException
Create a receiver that will listen for all messages in the given Topic.

Parameters:
topic - the name of the JMS Topic to listen to.
Throws:
javax.jms.JMSException

StateReceiver

public StateReceiver(java.lang.String topicName,
                     java.lang.String messageSelector,
                     StateInfo.Type stateInfoType)
              throws javax.jms.JMSException
Create a receiver that will listen only to the messages in the given Topic that will pass the given messageSelector.

Parameters:
topicName - the name of the JMS Topic to listen to.
messageSelector - a message selector expression, see e.g. http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html for the detailed description.
Throws:
javax.jms.JMSException
Method Detail

onMessage

public void onMessage(javax.jms.Message m)
Specified by:
onMessage in interface javax.jms.MessageListener
Overrides:
onMessage in class Receiver

createSEMAINEMessage

protected SEMAINEMessage createSEMAINEMessage(javax.jms.Message m)
                                       throws MessageFormatException
Description copied from class: Receiver
Create a SEMAINE message from the given JMS message. Subclasses may want to override this in order to provide subclasses of SEMAINEMessage for their data.

Overrides:
createSEMAINEMessage in class XMLReceiver
Parameters:
m - the JMS method to convert into a SEMAINE message.
Throws:
MessageFormatException - if the message format is problematic

getCurrentBestGuess

public java.lang.String getCurrentBestGuess(java.lang.String infoItem)
Provide the current best guess for the given info item.

Parameters:
infoItem -
Returns: