com.orderlysoftware.orderlycalls.asterisk.manager.event
Class ManagerEventDispatcher

java.lang.Object
  extended by com.orderlysoftware.orderlycalls.asterisk.manager.event.ManagerEventDispatcher
All Implemented Interfaces:
java.lang.Runnable

public class ManagerEventDispatcher
extends java.lang.Object
implements java.lang.Runnable

Used by ManagerClientto dispatch ManagerEventobjects to registered listeners.

Author:
Matt King, M.A. Oxon.

Constructor Summary
ManagerEventDispatcher(ManagerClient client)
          Creates a new ManagerEventDispatcher
 
Method Summary
 void dispatch(ManagerEvent event)
          Sends an event to all registered ManagerEventListenerinstances.
static void freeDispatcher(ManagerEventDispatcher med)
          Returns this dispatcher to the ObjectPool.
 ManagerClient getClient()
          Gets the ManagerClient client associated with this ManagerEventDispatcher.
static ManagerEventDispatcher getDispatcher(ManagerClient client)
          Gets the dispatcher associated with a particular ManagerClient.
 void run()
          Launches threads to handle the event.
 void setClient(ManagerClient client)
          Gets the ManagerClient associated with this ManagerEventDispatcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagerEventDispatcher

public ManagerEventDispatcher(ManagerClient client)
Creates a new ManagerEventDispatcher

Parameters:
client - The ManagerClient to which it is attached.
Method Detail

getDispatcher

public static ManagerEventDispatcher getDispatcher(ManagerClient client)
Gets the dispatcher associated with a particular ManagerClient.

Parameters:
client - The ManagerClient containing the dispatcher.
Returns:
The dispatcher.

freeDispatcher

public static void freeDispatcher(ManagerEventDispatcher med)
Returns this dispatcher to the ObjectPool.

Parameters:
med - the ManagerEventDispatcher to free.

dispatch

public void dispatch(ManagerEvent event)
Sends an event to all registered ManagerEventListenerinstances.

Parameters:
event - The event to send.

run

public void run()
Launches threads to handle the event.

Specified by:
run in interface java.lang.Runnable

getClient

public ManagerClient getClient()
Gets the ManagerClient client associated with this ManagerEventDispatcher.

Returns:
Returns the client.

setClient

public void setClient(ManagerClient client)
Gets the ManagerClient associated with this ManagerEventDispatcher.

Parameters:
client - The client to set.