ie.omk.smpp.event
Interface EventDispatcher

All Known Implementing Classes:
SimpleEventDispatcher, ThreadedEventDispatcher

public interface EventDispatcher

This interface defines the observable side of the observer pattern for asynchronous SMPP event notification. Each Connection object will have an implementation of the EventDispatcher interface which it uses to deliver events to interested listeners. By removing the actual dispatching of events from the internals of the Connection, applications may provide their own event dispatch implementations for their Connection objects which better suit how those applications work.

Version:
$Id: EventDispatcher.java 255 2006-03-09 09:34:37Z orank $
Author:
Oran Kelly
See Also:
SimpleEventDispatcher

Method Summary
 void addObserver(ConnectionObserver observer)
          Add an observer to this event dispatcher.
 void destroy()
          Event dispatcher clean up.
 void init()
          Initialise the event dispatcher.
 void notifyObservers(Connection conn, SMPPEvent event)
          Notify all registered observers of an SMPP event.
 void notifyObservers(Connection conn, SMPPPacket packet)
          Notify all registered observers of a received SMPP packet.
 Iterator observerIterator()
          Get an iterator over the currently registered observers.
 void removeObserver(ConnectionObserver observer)
          Remove an observer from this event dispatcher.
 

Method Detail

init

void init()
Initialise the event dispatcher. The init method will be called by the Connection before it makes any attempt to add any observers or deliver any events via the dispatcher.


destroy

void destroy()
Event dispatcher clean up. The destroy method will be called by the Connection when it is finished delivering events to it and the receiver daemon thread is exiting. Any initialising done in the init method can be cleaned up here.

The destroy method must not interfere with the delivery of any events notified to the event dispatcher before the call to this method.


addObserver

void addObserver(ConnectionObserver observer)
Add an observer to this event dispatcher.

Parameters:
observer - the observer object to add.

removeObserver

void removeObserver(ConnectionObserver observer)
Remove an observer from this event dispatcher.

Parameters:
observer - the observer object to remove from the registered observers.

observerIterator

Iterator observerIterator()
Get an iterator over the currently registered observers.

Returns:
an iterator object which iterates over all registered observers.

notifyObservers

void notifyObservers(Connection conn,
                     SMPPEvent event)
Notify all registered observers of an SMPP event.

Parameters:
event - the SMPP event to notify observers of.

notifyObservers

void notifyObservers(Connection conn,
                     SMPPPacket packet)
Notify all registered observers of a received SMPP packet.

Parameters:
packet - the SMPP packet to notify observers of.


Copyright © 2011 smppapi at Sourceforge. All Rights Reserved.