IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.event
Class EventManager

java.lang.Object
  extended by com.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
           
static java.lang.String COPYRIGHT
           
protected  Vector exceptionHandlerList
           
protected  Hashtable handlersList
          Keeps the component identification that will be used by the traces tool.
protected static boolean isCSNotificationListener
           
protected static Hashtable mirrorNotifiers
           
protected static Vector notifierList
           
protected static Hashtable notifiers
           
protected  Hashtable remoteHandlersList
           
protected  JMSEvTransmit transmit
           
protected static EventManager uniqueInstance
           
protected static Hashtable workstationList
           
 
Constructor Summary
EventManager()
           
 
Method Summary
protected static void addBTTMirrorHandlerForException(java.lang.String aSessionId)
          Registers a Handler for exceptions originating from a server.
static void addBTTMirrorNotifier(MirrorNotifier aMirrorNotifier)
          Adds a BTT Mirror Notifier to BTT Mirror Notifier list.
protected static void addHandler(Handler aHandler, java.lang.String anEventName, java.lang.String aNotifierName)
          Registers the event Handler to the Notifier, whether the notifier exists on this machine or not.
protected static void addHandler(Handler aHandler, java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aServerName)
          Registers the event Handler to the Notifier if the notifier exists on the specified server.
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 addHandlerForException(Handler aHandler)
          Registers the specified Handler for exceptions.
protected static void addHandlerForException(Handler aHandler, java.lang.String aServerTID)
          Registers the specified Handler for exceptions originating from the server identified by aServerTID.
protected static void addMirrorHandlerToBTTMirrorNotifer(MirrorNotifier aMirrorNotifier, java.lang.String anEventname, MirrorHandler aMirrorHandler)
           
protected static void addMirrorNotifier(MirrorNotifier aNotifier, java.lang.String aServerName)
          Returns the MirrorNotifier named aNotifierName.
protected static void addNotifier(Notifier aNotifier)
          Adds a Notifier to the list of Notifiers.
protected static void addNotifier(Notifier aNotifier, java.lang.String aTID)
          Adds a Notifier to the list of Notifiers.
protected static void addNotifier(Notifier aNotifier, java.lang.String aNotifierName, java.lang.String aNotifierType)
           
protected static void addWorkstation(java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aWorkstationTID)
          Adds the specified workstation to the workstationList.
static MirrorNotifier getBTTMirrorNotifier(java.lang.String aNotifierName)
          Gets BTT Mirror Notifier from BTT Mirror Notifier list.
static Hashtable getBTTMirrorNotifiers()
          Get BTT Mirror Notifier List
static CSServerService getCSServer()
          Get CSServer instance
protected static MirrorNotifier getMirrorNotifier(java.lang.String aNotifierName)
          Returns the MirrorNotifier named aNotifierName.
protected static MirrorNotifier getMirrorNotifier(java.lang.String aNotifierName, java.lang.String aServerName)
          Returns the MirrorNotifier named aNotifierName.
protected static Hashtable getMirrorNotifiers()
          Returns the mirrorNotifiers attribute value.
protected static Notifier getNotifier(java.lang.String aNotifierName)
           
protected static Vector getNotifierList()
          Returns the notifierList attribute value.
protected static Hashtable getNotifiers()
           
protected static EventManager getUniqueInstance()
          Returns the unique instance of EventManager running on the application environment.
protected static Hashtable getWorkstationList()
          Returns the workstationList attribute value.
 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 get singal event request from queue, it will invoke this method to get Mirror Notifier to singal event.
protected static boolean hasHandlersInterestedIn(java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aTID)
          Returns true if the EventManager has a Handler registered for the specified remote 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)
           
static java.lang.Object removeBTTMirrorNotifier(java.lang.String aNotifierName)
          Removes a BTT Mirror Notifier from BTT Mirror Notifier list.
protected static void removeHandler(Handler aHandler, java.lang.String anEventName, java.lang.String aNotifierName)
          Removes a handler for the specified event signaled by a notifier coming from any of the workstations the machines have sessions with.
protected static void removeHandler(Handler aHandler, java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aServerName)
          Removes a handler for the specified event signaled by the specified notifier coming from the specified workstation.
protected static void removeHandler(java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aSessionId)
          Deregisters the client to the Notifier "aNotifierName" as interested in the specified event for the duration of the session.
protected static void removeHandlerForException(Handler aHandler)
          Deregisters the specified Handler for exceptions.
protected static void removeHandlerForException(java.lang.String aSessionId)
          Deregisters the specified Handler for exceptions originating from the server.
protected static void removeNotifier(java.lang.String aNotifierName)
           
protected static void removesHandlerForException(Handler aHandler, java.lang.String aServerTID)
          Deregisters the specified Handler for exceptions originating from the server identified by aServerTID.
protected static void removeWorkstation(java.lang.String anEventName, java.lang.String aNotifierName, java.lang.String aClientWorkstation)
          Removes the specifed workstation from the workstationList.
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.
protected static void stopNotifiers()
           
protected static Notifier tryGetNotifier(java.lang.String aNotifierName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

handlersList

protected Hashtable handlersList
Keeps the component identification that will be used by the traces tool.


remoteHandlersList

protected Hashtable remoteHandlersList

exceptionHandlerList

protected Vector exceptionHandlerList

notifierList

protected static Vector notifierList

uniqueInstance

protected static EventManager uniqueInstance

workstationList

protected static Hashtable workstationList

mirrorNotifiers

protected static Hashtable mirrorNotifiers

bttMirrorNotifiersList

protected static Hashtable bttMirrorNotifiersList

isCSNotificationListener

protected static boolean isCSNotificationListener

notifiers

protected static Hashtable notifiers

transmit

protected JMSEvTransmit transmit
Constructor Detail

EventManager

public EventManager()
Method Detail

addHandler

protected static void addHandler(Handler aHandler,
                                 java.lang.String anEventName,
                                 java.lang.String aNotifierName)
                          throws DSEInvalidArgumentException
Registers the event Handler to the Notifier, whether the notifier exists on this machine or not.

Parameters:
aHandler - com.ibm.btt.event.Handler - The Handler that wants to register for an event
anEventName - java.lang.String - The name of the event the Handler is interested in
aNotifierName - java.lang.String - The name of the Notifier that will signal the event identified as anEventName
Throws:
DSEInvalidArgumentException

addHandler

protected static void addHandler(Handler aHandler,
                                 java.lang.String anEventName,
                                 java.lang.String aNotifierName,
                                 java.lang.String aServerName)
                          throws DSEInvalidArgumentException
Registers the event Handler to the Notifier if the notifier exists on the specified server.

Parameters:
aHandler - com.ibm.btt.event.Handler - The Handler that wants to register for an event
anEventName - java.lang.String - The name of the event the Handler is interested in
aNotifierName - java.lang.String - The name of the Notifier that will signal the event identified as anEventName
Throws:
DSEInvalidArgumentException

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

addMirrorHandlerToBTTMirrorNotifer

protected static void addMirrorHandlerToBTTMirrorNotifer(MirrorNotifier aMirrorNotifier,
                                                         java.lang.String anEventname,
                                                         MirrorHandler aMirrorHandler)
                                                  throws DSEInvalidArgumentException,
                                                         DSEInvalidRequestException,
                                                         DSEObjectNotFoundException
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 EventManagerServerOperation 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

addHandlerForException

protected static void addHandlerForException(Handler aHandler)
                                      throws DSEInvalidArgumentException
Registers the specified Handler for exceptions.

Parameters:
aHandler - com.ibm.btt.event.Handler
Throws:
DSEInvalidArgumentException

addHandlerForException

protected static void addHandlerForException(Handler aHandler,
                                             java.lang.String aServerTID)
                                      throws DSEInvalidArgumentException
Registers the specified Handler for exceptions originating from the server identified by aServerTID.

Parameters:
aHandler - com.ibm.btt.event.Handler
aServerTID - java.lang.String - The TID of the server where the exception will be originated
Throws:
DSEInvalidArgumentException

addBTTMirrorHandlerForException

protected static void addBTTMirrorHandlerForException(java.lang.String aSessionId)
                                               throws DSEInvalidRequestException,
                                                      DSEObjectNotFoundException,
                                                      DSEInvalidArgumentException
Registers a Handler for exceptions originating from a server. This method is invoked during the execution of the EventManagerServerOperation operation in the server.

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

addNotifier

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

Parameters:
aNotifier - com.ibm.btt.event.Notifier
Throws:
DSEInvalidArgumentException

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

addWorkstation

protected static void addWorkstation(java.lang.String anEventName,
                                     java.lang.String aNotifierName,
                                     java.lang.String aWorkstationTID)
Adds the specified workstation to the workstationList.

Parameters:
anEventName - java.lang.String
aNotifierName - java.lang.String
aWorkstationTID - java.lang.String

getMirrorNotifier

protected static MirrorNotifier getMirrorNotifier(java.lang.String aNotifierName)
Returns the MirrorNotifier named aNotifierName.

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

getMirrorNotifier

protected static MirrorNotifier getMirrorNotifier(java.lang.String aNotifierName,
                                                  java.lang.String aServerName)
                                           throws DSEObjectNotFoundException
Returns the MirrorNotifier named aNotifierName.

Parameters:
aNotifierName - java.lang.String
aServerName - java.lang.String
Returns:
com.ibm.btt.event.MirrorNotifier
Throws:
DSEObjectNotFoundException

addMirrorNotifier

protected static void addMirrorNotifier(MirrorNotifier aNotifier,
                                        java.lang.String aServerName)
Returns the MirrorNotifier named aNotifierName.

Parameters:
aServerName - java.lang.String

getMirrorNotifiers

protected static Hashtable getMirrorNotifiers()
Returns the mirrorNotifiers attribute value.

Returns:
com.ibm.btt.base.Hashtable

getNotifier

protected static Notifier getNotifier(java.lang.String aNotifierName)
                               throws DSEObjectNotFoundException
Throws:
DSEObjectNotFoundException

getNotifierList

protected static Vector getNotifierList()
Returns the notifierList attribute value.

Returns:
com.ibm.btt.base.Vector

getUniqueInstance

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

Returns:
com.ibm.btt.event.EventManager

getWorkstationList

protected static Hashtable getWorkstationList()
Returns the workstationList attribute value.

Returns:
com.ibm.btt.base.Hashtable

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

hasHandlersInterestedIn

protected static boolean hasHandlersInterestedIn(java.lang.String anEventName,
                                                 java.lang.String aNotifierName,
                                                 java.lang.String aTID)
Returns true if the EventManager has a Handler registered for the specified remote event.

Parameters:
anEventName - java.lang.String
aNotifierName - java.lang.String
aTID - java.lang.String
Returns:
boolean

removeHandler

protected static void removeHandler(Handler aHandler,
                                    java.lang.String anEventName,
                                    java.lang.String aNotifierName)
                             throws DSEInvalidArgumentException,
                                    DSEHandlerNotFoundException
Removes a handler for the specified event signaled by a notifier coming from any of the workstations the machines have sessions with.

Parameters:
aHandler - com.ibm.btt.event.Handler
anEventName - java.lang.String
aNotifierName - java.lang.String
Throws:
DSEInvalidArgumentException
DSEHandlerNotFoundException

removeHandler

protected static void removeHandler(Handler aHandler,
                                    java.lang.String anEventName,
                                    java.lang.String aNotifierName,
                                    java.lang.String aServerName)
                             throws DSEInvalidArgumentException,
                                    DSEHandlerNotFoundException
Removes a handler for the specified event signaled by the specified notifier coming from the specified workstation.

Parameters:
aHandler - com.ibm.btt.event.Handler
anEventName - java.lang.String
aNotifierName - java.lang.String
aServerName - java.lang.String - The terminal identification of the workstation that is going to signal the event the application was interested in
Throws:
DSEInvalidArgumentException
DSEHandlerNotFoundException

removeHandler

protected static void removeHandler(java.lang.String anEventName,
                                    java.lang.String aNotifierName,
                                    java.lang.String aSessionId)
                             throws DSEHandlerNotFoundException,
                                    DSEInvalidArgumentException,
                                    DSEInvalidRequestException,
                                    DSEObjectNotFoundException
Deregisters 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 EventManagerServerOperation operation in the server.

Parameters:
anEventName - java.lang.String - The name of the event the client is no longer 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:
DSEHandlerNotFoundException
DSEInvalidArgumentException
DSEInvalidRequestException
DSEObjectNotFoundException

removeHandlerForException

protected static void removeHandlerForException(Handler aHandler)
                                         throws DSEInvalidArgumentException,
                                                DSEHandlerNotFoundException
Deregisters the specified Handler for exceptions.

Parameters:
aHandler - com.ibm.btt.event.Handler
Throws:
DSEInvalidArgumentException
DSEHandlerNotFoundException

removeHandlerForException

protected static void removeHandlerForException(java.lang.String aSessionId)
                                         throws DSEInvalidRequestException,
                                                DSEObjectNotFoundException
Deregisters the specified Handler for exceptions originating from the server. This method is invoked during the execution of the "EventManagerServerInvoker" in the server.

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

removeBTTMirrorHandlerForException

protected static void removeBTTMirrorHandlerForException(java.lang.String aSessionId)
                                                  throws DSEInvalidRequestException,
                                                         DSEObjectNotFoundException,
                                                         DSEHandlerNotFoundException
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException
DSEHandlerNotFoundException

removesHandlerForException

protected static void removesHandlerForException(Handler aHandler,
                                                 java.lang.String aServerTID)
                                          throws DSEInvalidArgumentException,
                                                 DSEHandlerNotFoundException
Deregisters the specified Handler for exceptions originating from the server identified by aServerTID.

Parameters:
aHandler - com.ibm.btt.event.Handler
aServerTID - java.lang.String - The TID of the server where the exception will be originated
Throws:
DSEInvalidArgumentException
DSEHandlerNotFoundException

removeWorkstation

protected static void removeWorkstation(java.lang.String anEventName,
                                        java.lang.String aNotifierName,
                                        java.lang.String aClientWorkstation)
Removes the specifed workstation from the workstationList.

Parameters:
anEventName - java.lang.String
aNotifierName - java.lang.String
aClientWorkstation - java.lang.String

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

tryGetNotifier

protected static Notifier tryGetNotifier(java.lang.String aNotifierName)

addNotifier

protected static void addNotifier(Notifier aNotifier,
                                  java.lang.String aNotifierName,
                                  java.lang.String aNotifierType)

removeNotifier

protected static void removeNotifier(java.lang.String aNotifierName)

stopNotifiers

protected static void stopNotifiers()

getCSServer

public static CSServerService getCSServer()
Get CSServer instance

Returns:
com.ibm.btt.event.CSServerService

getNotifiers

protected static Hashtable getNotifiers()

handleJMSNotificationEvent

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


getBTTMirrorNotifiers

public static Hashtable getBTTMirrorNotifiers()
Get BTT Mirror Notifier List

Returns:
com.ibm.btt.base.Hashtable

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009