|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ws4d.java.dispatch.MessageInformer
public class MessageInformer
This class is the place to register listeners
for
messages crossing the DPWS framework. This is especially useful for clients
interested in receiving specific types of messages or for traffic analyzers
willing to get notified about each DPWS message sent or received.
When registering, a listener can declare its interest for certain messages by
passing a MessageSelector
to the method
addMessageListener(MessageListener, MessageSelector)
. The
MessageSelector
's MessageSelector.matches(Message)
method is used to determine whether a given message matches this interest or
not. The DPWS framework provides two standard implementations of
MessageSelector
: AllMessageSelector
, which simply marks
every message as interesting, and DefaultMessageSelector
allowing
discrimination based on a message's type and/or its target endpoint address
(i.e. the WS-Addressing [destination] property of the message).
Method Summary | |
---|---|
void |
addMessageListener(MessageListener listener,
MessageSelector sel)
Adds the specified message listener to this message informer. |
void |
forwardMessage(Message msg,
ProtocolData protocolData)
Forwards a single message to all registered listeners. |
static MessageInformer |
getInstance()
Returns the singleton instance of this class. |
MessageListener[] |
getMessageListeners()
Returns an array containing all currently registered message listeners. |
void |
removeMessageListener(MessageListener listener)
Removes the specified message listener, if it was previously registered within this message informer. |
void |
start()
Starts the message delivery loop of this message informer instance. |
void |
stop()
Stops the message informer, i.e. terminates the message delivery loop. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MessageInformer getInstance()
public void start()
public void stop()
public void addMessageListener(MessageListener listener, MessageSelector sel)
sel
is null
, the listener will be registered
with an AllMessageSelector
associated to it and thus will receive
notifications about every message.
listener
- the listener to registersel
- the selector determining which messages to deliver to the
newly registered listenerpublic void removeMessageListener(MessageListener listener)
listener
- the listener to removepublic MessageListener[] getMessageListeners()
public void forwardMessage(Message msg, ProtocolData protocolData)
msg
- the message to forwardprotocolData
- transport-specific addressing information attached to
the message
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |