net.sf.bus.spi
Class MessageBusImpl
java.lang.Object
|
+--net.sf.bus.MessageBus
|
+--net.sf.bus.spi.MessageBusImpl
- public class MessageBusImpl
- extends MessageBus
MessageBus implementation
Created: Sun Jul 14 21:51:37 2002
- Version:
- $Revision: 1.4 $
- Author:
- James Higginbotham
|
Field Summary |
protected static org.apache.commons.logging.Log |
log
|
|
Constructor Summary |
MessageBusImpl()
Creates a new MessageBusImpl instance and initializes itself using the default
initialization rules as defined in MessageBus |
|
Method Summary |
protected ChannelConfig |
getChannelConfig(java.lang.String channel)
|
protected java.util.List |
getChannels()
|
protected Dispatcher |
getDispatcher(ChannelConfig channelConfig)
|
protected java.util.List |
getSubscribersForChannel(java.lang.String channel)
|
void |
publish(java.lang.String channel,
java.lang.Object message)
Publishes a message to The Message Bus that will be distributed to all subscribers that meet
the following requirements:
They are subscribed to the same channel
They are subscribed to messages of the same type
They didn't supply a filter during the subscription process, or the filter they supplied
determines that the message should be passed to the subscriber. |
protected void |
reset()
|
void |
subscribe(MessageBusSubscriber subscriber,
java.lang.String channel,
java.lang.Class messageType)
Enables a component to subscribe to the given channel and message type. |
void |
subscribe(MessageBusSubscriber subscriber,
java.lang.String channel,
java.lang.Class messageType,
Filter filter)
Enables a component to subscribe to the given channel, message type, and add an additional
filter. |
void |
unsubscribe(MessageBusSubscriber subscriber,
java.lang.String channel,
java.lang.Class messageType)
Removes a component from an existing subscription |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
MessageBusImpl
public MessageBusImpl()
- Creates a new
MessageBusImpl instance and initializes itself using the default
initialization rules as defined in MessageBus
subscribe
public void subscribe(MessageBusSubscriber subscriber,
java.lang.String channel,
java.lang.Class messageType)
- Description copied from class:
MessageBus
- Enables a component to subscribe to the given channel and message type. A unique subscriber is
a combination of the subscriber, channel, and message. This
distinction enables a component to register multiple times to a channel but with different
message types.
- Overrides:
subscribe in class MessageBus
- Following copied from class:
net.sf.bus.MessageBus
- Parameters:
subscriber - the MessageBusSubscriber that will receive the callbackchannel - the Channel to subscribe tomessageType - the Message Class type to listen for
subscribe
public void subscribe(MessageBusSubscriber subscriber,
java.lang.String channel,
java.lang.Class messageType,
Filter filter)
- Description copied from class:
MessageBus
- Enables a component to subscribe to the given channel, message type, and add an additional
filter. A unique subscriber is a combination of the subscriber, channel, and message. This
distinction enables a component to register multiple times to a channel but with different
message types.
- Overrides:
subscribe in class MessageBus
- Following copied from class:
net.sf.bus.MessageBus
- Parameters:
subscriber - the MessageBusSubscriber that will receive the callbackchannel - the Channel to subscribe tomessageType - the Message Class type to listen forfilter - an Filter to assist in further filtering the messages received
unsubscribe
public void unsubscribe(MessageBusSubscriber subscriber,
java.lang.String channel,
java.lang.Class messageType)
- Description copied from class:
MessageBus
- Removes a component from an existing subscription
- Overrides:
unsubscribe in class MessageBus
- Following copied from class:
net.sf.bus.MessageBus
- Parameters:
subscriber - the MessageBusSubscriber that will receive the callbackchannel - the Channel to unsubscribe frommessageType - the Message Class type to stop listening for
publish
public void publish(java.lang.String channel,
java.lang.Object message)
- Description copied from class:
MessageBus
- Publishes a message to The Message Bus that will be distributed to all subscribers that meet
the following requirements:
- They are subscribed to the same channel
- They are subscribed to messages of the same type
- They didn't supply a filter during the subscription process, or the filter they supplied
determines that the message should be passed to the subscriber.
- Overrides:
publish in class MessageBus
- Following copied from class:
net.sf.bus.MessageBus
- Parameters:
channel - the Channel to broadcast the message onmessage - an EventObject to broadcast
getChannelConfig
protected ChannelConfig getChannelConfig(java.lang.String channel)
getDispatcher
protected Dispatcher getDispatcher(ChannelConfig channelConfig)
getChannels
protected java.util.List getChannels()
getSubscribersForChannel
protected java.util.List getSubscribersForChannel(java.lang.String channel)
reset
protected void reset()
This code may be freely distributed and modified under the terms of the GNU Lesser General Public Licence..