eu.semaine.components.meta
Class MetaMessenger

java.lang.Object
  extended by eu.semaine.jms.IOBase
      extended by eu.semaine.components.meta.MetaMessenger

public class MetaMessenger
extends IOBase

Communication between a component and the system manager, transporting meta messages about the state of the component and of the system.

Author:
marc

Nested Class Summary
static class MetaMessenger.Statistics
           
 
Nested classes/interfaces inherited from class eu.semaine.jms.IOBase
IOBase.ConnectionStatus, IOBase.Event
 
Field Summary
static java.lang.String AVERAGE_ACT_TIME
           
static java.lang.String AVERAGE_REACT_TIME
           
static java.lang.String AVERAGE_TRANSMIT_TIME
           
static java.lang.String COMPONENT_NAME
           
static java.lang.String COMPONENT_STATE
           
static java.lang.String COMPONENT_STATE_DETAILS
           
static java.lang.String IS_INPUT
           
static java.lang.String IS_OUTPUT
           
static java.lang.String LAST_SEEN_ALIVE
           
static java.lang.String PING
           
static java.lang.String RECEIVE_TOPICS
           
static java.lang.String REPORT_TOPICS
           
static java.lang.String SEND_TOPICS
           
static java.lang.String SYSTEM_READY
           
static java.lang.String SYSTEM_READY_TIME
           
static long TIMEOUT_PERIOD
           
static java.lang.String TOTAL_MESSAGES_RECEIVED
           
 
Fields inherited from class eu.semaine.jms.IOBase
connection, exception, isConnectionStarted, jmsPassword, jmsUrl, jmsUser, session, topic, topicName
 
Constructor Summary
MetaMessenger(java.lang.String componentName)
          Create a meta messenger for the component with the given name, which is to communicate with the global default JMS server.
MetaMessenger(java.lang.String jmsUrl, java.lang.String jmsUser, java.lang.String jmsPassword, java.lang.String componentName)
          Create a meta messenger for the component with the given name, which is to communicate with the JMS server given in the arguments.
 
Method Summary
 long getTime()
          Get the current time in common, normalised time space.
 void IamAlive()
           
 boolean isSystemReady()
           
 void onMessage(Message m)
           
 void reportState(Component.State state)
           
 void reportState(Component.State state, java.lang.Object... details)
           
 void reportTopics(java.util.List<Receiver> receivers, java.util.List<Sender> senders, boolean isInput, boolean isOutput)
           
 MetaMessenger.Statistics statistics()
           
 
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

COMPONENT_NAME

public static final java.lang.String COMPONENT_NAME
See Also:
Constant Field Values

COMPONENT_STATE

public static final java.lang.String COMPONENT_STATE
See Also:
Constant Field Values

COMPONENT_STATE_DETAILS

public static final java.lang.String COMPONENT_STATE_DETAILS
See Also:
Constant Field Values

RECEIVE_TOPICS

public static final java.lang.String RECEIVE_TOPICS
See Also:
Constant Field Values

SEND_TOPICS

public static final java.lang.String SEND_TOPICS
See Also:
Constant Field Values

IS_INPUT

public static final java.lang.String IS_INPUT
See Also:
Constant Field Values

IS_OUTPUT

public static final java.lang.String IS_OUTPUT
See Also:
Constant Field Values

LAST_SEEN_ALIVE

public static final java.lang.String LAST_SEEN_ALIVE
See Also:
Constant Field Values

AVERAGE_ACT_TIME

public static final java.lang.String AVERAGE_ACT_TIME
See Also:
Constant Field Values

AVERAGE_REACT_TIME

public static final java.lang.String AVERAGE_REACT_TIME
See Also:
Constant Field Values

AVERAGE_TRANSMIT_TIME

public static final java.lang.String AVERAGE_TRANSMIT_TIME
See Also:
Constant Field Values

TOTAL_MESSAGES_RECEIVED

public static final java.lang.String TOTAL_MESSAGES_RECEIVED
See Also:
Constant Field Values

SYSTEM_READY

public static final java.lang.String SYSTEM_READY
See Also:
Constant Field Values

SYSTEM_READY_TIME

public static final java.lang.String SYSTEM_READY_TIME
See Also:
Constant Field Values

PING

public static final java.lang.String PING
See Also:
Constant Field Values

REPORT_TOPICS

public static final java.lang.String REPORT_TOPICS
See Also:
Constant Field Values

TIMEOUT_PERIOD

public static final long TIMEOUT_PERIOD
See Also:
Constant Field Values
Constructor Detail

MetaMessenger

public MetaMessenger(java.lang.String componentName)
              throws JMSException
Create a meta messenger for the component with the given name, which is to communicate with the global default JMS server.

Parameters:
componentName - the name of the component that this meta messenger belongs to.
Throws:
JMSException - if the communication with the middleware cannot be established

MetaMessenger

public MetaMessenger(java.lang.String jmsUrl,
                     java.lang.String jmsUser,
                     java.lang.String jmsPassword,
                     java.lang.String componentName)
              throws JMSException
Create a meta messenger for the component with the given name, which is to communicate with the JMS server given in the arguments.

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)
componentName - the name of the component that this meta messenger belongs to.
Throws:
JMSException - if the communication with the middleware cannot be established
Method Detail

IamAlive

public void IamAlive()

reportTopics

public void reportTopics(java.util.List<Receiver> receivers,
                         java.util.List<Sender> senders,
                         boolean isInput,
                         boolean isOutput)
                  throws JMSException
Throws:
JMSException

reportState

public void reportState(Component.State state)
                 throws JMSException
Throws:
JMSException

reportState

public void reportState(Component.State state,
                        java.lang.Object... details)
                 throws JMSException
Throws:
JMSException

onMessage

public void onMessage(Message m)

isSystemReady

public boolean isSystemReady()

getTime

public long getTime()
Get the current time in common, normalised time space. Processes should use only this method for determining the time. The value is counting milliseconds since some arbitrary point in time; therefore, the absolute time is not informative, but differences of time values are.

Returns:

statistics

public MetaMessenger.Statistics statistics()