IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.event
Class EventManager

java.lang.Object
  extended bycom.ibm.btt.event.EventManager
All Implemented Interfaces:
CSNotificationListener, java.util.EventListener

public class EventManager
extends java.lang.Object
implements CSNotificationListener

This class manages the flow of events between the notifiers (producers of the events) and the handlers (consumers of the events), both when the event is produced locally or remotelly in a server machine. To make this possible, the server and the client should have only one instance of the EventManager existing at any given moment. To make the EventManager more easily addressable, most of its interface is based on static methods.


Field Summary
protected static Hashtable bttMirrorNotifiersList
          BTT Mirror Notifier list which keep all the server side BTT Notifiers' information.
protected static boolean isCSNotificationListener
          A flag indicates whehter event manager is CSNotificationListener.
protected  JMSEvTransmit transmit
          JMSEvTransmit is for EventManager to send JMS messages to message queue.
protected static EventManager uniqueInstance
          EventManager unique instance.
 
Constructor Summary
EventManager()
           
 
Method Summary
protected static void addBTTMirrorHandlerForException(java.lang.String aSessionId)
          Registers a Handler for exceptions originating from a server or external server.
static void addBTTMirrorNotifier(MirrorNotifier aMirrorNotifier)
          Adds a BTT Mirror Notifier to BTT Mirror Notifier list.
protected static void addHandler(java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aSessionId)
          Registers the client to the Notifier aNotifierName as interested in the specified event for the duration of the session.
protected static void addMirrorHandlerToBTTMirrorNotifier(MirrorNotifier aMirrorNotifier, java.lang.String anEventname, MirrorHandler aMirrorHandler)
          Adds BTT Mirrior Handler to the BTT Mirror Notifier in which BTT Mirror Handler interests.
protected static void addNotifier(Notifier aNotifier, java.lang.String aTID)
          Adds a Notifier to the list of Notifiers.
static MirrorNotifier getBTTMirrorNotifier(java.lang.String aNotifierName)
          Gets BTT Mirror Notifier from BTT Mirror Notifier list.
static Hashtable getBTTMirrorNotifiers()
          Gets BTT Mirror Notifier list.
static CSServerService getCSServer()
          Gets CSServer instance.
protected static EventManager getUniqueInstance()
          Returns the unique instance of EventManager running on the application environment.
 void handleCSNotificationEvent(CSNotificationEvent event)
          Calls the dispatch methods of the registered Handlers based on the information included in the event CSNotificationEvent.
static void handleJMSNotificationEvent(DSEEventObject anEvent)
          When Event Manager gets singal event request from queue, it will invoke this method to get Mirror Notifier to singal event.
static void removeBTTMirrorHandler(java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aHandlerGlobalID)
          Removes a BTT Mirror Handler from the BTT Mirror Handler list of a BTT Mirror Notifier.
protected static void removeBTTMirrorHandlerForException(java.lang.String aSessionId)
          Removes BTT Mirror Handler which handles an exception event.
static java.lang.Object removeBTTMirrorNotifier(java.lang.String aNotifierName)
          Removes a BTT Mirror Notifier from BTT Mirror Notifier list.
static void reset()
          Initializes this class.
static void sendException(DSEException anException)
          Sends an exception event to client.
protected static void setUniqueInstance(EventManager anEventManager)
          Sets the uniqueInstance attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uniqueInstance

protected static EventManager uniqueInstance
EventManager unique instance.


bttMirrorNotifiersList

protected static Hashtable bttMirrorNotifiersList
BTT Mirror Notifier list which keep all the server side BTT Notifiers' information.


isCSNotificationListener

protected static boolean isCSNotificationListener
A flag indicates whehter event manager is CSNotificationListener.


transmit

protected JMSEvTransmit transmit
JMSEvTransmit is for EventManager to send JMS messages to message queue.

Constructor Detail

EventManager

public EventManager()
Method Detail

getBTTMirrorNotifier

public static MirrorNotifier getBTTMirrorNotifier(java.lang.String aNotifierName)
Gets BTT Mirror Notifier from BTT Mirror Notifier list.

Parameters:
aNotifierName - java.lang.String
Returns:
com.ibm.btt.event.MirrorHandler

addBTTMirrorNotifier

public static void addBTTMirrorNotifier(MirrorNotifier aMirrorNotifier)
Adds a BTT Mirror Notifier to BTT Mirror Notifier list.

Parameters:
aMirrorNotifier - com.ibm.btt.event.MirrorNotifier

removeBTTMirrorHandler

public static void removeBTTMirrorHandler(java.lang.String anEventName,
                                          java.lang.String aNotifierName,
                                          java.lang.String aHandlerGlobalID)
                                   throws DSEHandlerNotFoundException
Removes a BTT Mirror Handler from the BTT Mirror Handler list of a BTT Mirror Notifier.

Parameters:
anEventName - com.ibm.btt.event.DSEEventObject
aNotifierName - java.lang.String
aHandlerGlobalID - java.lang.String
Throws:
DSEHandlerNotFoundException - DSEHandlerNotFoundException

removeBTTMirrorNotifier

public static java.lang.Object removeBTTMirrorNotifier(java.lang.String aNotifierName)
Removes a BTT Mirror Notifier from BTT Mirror Notifier list.

Parameters:
aNotifierName - java.lang.String
Returns:
java.lang.Object

addMirrorHandlerToBTTMirrorNotifier

protected static void addMirrorHandlerToBTTMirrorNotifier(MirrorNotifier aMirrorNotifier,
                                                          java.lang.String anEventname,
                                                          MirrorHandler aMirrorHandler)
                                                   throws DSEInvalidArgumentException,
                                                          DSEInvalidRequestException,
                                                          DSEObjectNotFoundException
Adds BTT Mirrior Handler to the BTT Mirror Notifier in which BTT Mirror Handler interests.

Parameters:
aMirrorNotifier - com.ibm.btt.event.MirrorNotifier
anEventname - java.lang.String
aMirrorHandler - com.ibm.btt.event.MirrorHandler
Throws:
DSEInvalidArgumentException
DSEInvalidRequestException
DSEObjectNotFoundException

addHandler

protected static void addHandler(java.lang.String anEventName,
                                 java.lang.String aNotifierName,
                                 java.lang.String aSessionId)
                          throws DSEInvalidArgumentException,
                                 DSEInvalidRequestException,
                                 DSEObjectNotFoundException,
                                 DSEHandlerNotFoundException,
                                 DSEException
Registers the client to the Notifier aNotifierName as interested in the specified event for the duration of the session. This method is invoked during the execution of the EventManagerServerInvoker operation in the server.

Parameters:
anEventName - java.lang.String - The name of the event the client will be interested in
aNotifierName - java.lang.String - The name of the Notifier that will produce the event anEventName
aSessionId - java.lang.String - The identification of the session between client and server
Throws:
DSEInvalidArgumentException
DSEInvalidRequestException
DSEObjectNotFoundException
DSEHandlerNotFoundException
DSEException

addBTTMirrorHandlerForException

protected static void addBTTMirrorHandlerForException(java.lang.String aSessionId)
                                               throws DSEInvalidRequestException,
                                                      DSEObjectNotFoundException,
                                                      DSEInvalidArgumentException
Registers a Handler for exceptions originating from a server or external server.

Parameters:
aSessionId - java.lang.String - The identification of the session between the client that has the Handler and server
Throws:
DSEInvalidArgumentException
DSEInvalidRequestException
DSEObjectNotFoundException

addNotifier

protected static void addNotifier(Notifier aNotifier,
                                  java.lang.String aTID)
                           throws DSEInvalidArgumentException
Adds a Notifier to the list of Notifiers. Checks if there are handlers in the client identified by aTID already interested in events from this notifier. Each Notifier should run this method in its constructor DSENotifier(String aName, String aTID).

Parameters:
aNotifier - com.ibm.btt.event.Notifier
aTID - java.lang.String - The TID of the client, where there may be a Handler interested in an event produced by the notifier "aNotifier."
Throws:
DSEInvalidArgumentException

getUniqueInstance

protected static EventManager getUniqueInstance()
Returns the unique instance of EventManager running on the application environment.

Returns:
com.ibm.btt.event.EventManager

handleCSNotificationEvent

public void handleCSNotificationEvent(CSNotificationEvent event)
Calls the dispatch methods of the registered Handlers based on the information included in the event CSNotificationEvent. The information should contain the DSEEventObject signaled in the remote workstation. This method is called when a CSNotificationEvent is signaled by the client/server mechanism.

Specified by:
handleCSNotificationEvent in interface CSNotificationListener
Parameters:
event - com.ibm.btt.event.CSNotificationEvent

removeBTTMirrorHandlerForException

protected static void removeBTTMirrorHandlerForException(java.lang.String aSessionId)
                                                  throws DSEInvalidRequestException,
                                                         DSEObjectNotFoundException,
                                                         DSEHandlerNotFoundException
Removes BTT Mirror Handler which handles an exception event.

Parameters:
aSessionId - java.lang.String
Throws:
DSEInvalidArgumentException
DSEObjectNotFoundException
DSEHandlerNotFoundException
DSEInvalidRequestException

reset

public static void reset()
Initializes this class.


sendException

public static void sendException(DSEException anException)
Sends an exception event to client.

Parameters:
anException - com.ibm.btt.base.DSEException

setUniqueInstance

protected static void setUniqueInstance(EventManager anEventManager)
Sets the uniqueInstance attribute value. This should be the only instance of EventManager in the application environment (either in a client or in a server).

Parameters:
anEventManager - com.ibm.btt.event.EventManager.

getCSServer

public static CSServerService getCSServer()
Gets CSServer instance.

Returns:
com.ibm.btt.event.CSServerService

handleJMSNotificationEvent

public static void handleJMSNotificationEvent(DSEEventObject anEvent)
When Event Manager gets singal event request from queue, it will invoke this method to get Mirror Notifier to singal event.

Parameters:
anEvent - com.ibm.btt.event.DSEEventObject

getBTTMirrorNotifiers

public static Hashtable getBTTMirrorNotifiers()
Gets BTT Mirror Notifier list.

Returns:
com.ibm.btt.base.Hashtable

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005