net.sf.genuine.organizer
Interface Channel

All Known Implementing Classes:
DefaultChannel

public interface Channel

A channel is part of the framework's messaging system. It represents a topic to which any object may register and to which any object may send a message. All messages are forwarded to the objects that have registered to the channel.

Senders may either send a fire-and-forget message or a vetoable message. In case of the vetoable message, the message is transmitted to the message listeners only if no listeners files a veto against it.

Author:
Tim Wellhausen
See Also:
MessageBus

Method Summary
 void deregisterMessageListener(MessageListener messageListener)
          Deregisters the given message listener so that it won't receive any messages any more.
 void registerMessageListener(MessageListener messageListener)
          Registers the given message listener to retrieve all upcoming messages.
 void sendMessage(Message message)
          Sends a fire-and-forget message that is forwarded to all message listener.
 void sendVetoableMessage(Message message)
          Sends a vetoable message.
 

Method Detail

registerMessageListener

public void registerMessageListener(MessageListener messageListener)
Registers the given message listener to retrieve all upcoming messages.


deregisterMessageListener

public void deregisterMessageListener(MessageListener messageListener)
Deregisters the given message listener so that it won't receive any messages any more.


sendMessage

public void sendMessage(Message message)
Sends a fire-and-forget message that is forwarded to all message listener. The sender does not have to register themself at the channel to send a message.


sendVetoableMessage

public void sendVetoableMessage(Message message)
                         throws MessageVetoException
Sends a vetoable message. If any message listener files a veto against the message, a MessageVetoException is thrown by the listener itself. In that case, the message is not forwarded to any listeners. If no veto is filed, the message is forwarded to all listeners.

Throws:
MessageVetoException