|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object za.org.coefficient.events.EventHandlerRegistry
public class EventHandlerRegistry
Class: EventHandlerRegistry Description: EventHandlerRegistry maintains a registry of event handlers. It is used to determine which handlers should receive event notifications. NOTE: This class is implemented using the singleton patttern, which doesn't really work too well in a distributed EJB environment. It is assumed, therefore, that the app is not running in a clustered environment - i.e. this is a singleton for the entire app. Alternative approaches include storing this stuff in the database, and reading from there, or using an external RMI interface via JNDI.
Field Summary | |
---|---|
private static EventHandlerRegistry |
instance
Singleton instance |
private static org.apache.log4j.Logger |
log
Logger |
private java.util.Map |
registry
Map to hold the registry data |
Constructor Summary | |
---|---|
private |
EventHandlerRegistry()
Private constructor to prevent instantiation. |
Method Summary | |
---|---|
CoefficientEventHandler[] |
getHandlers(java.lang.Class eventType)
Get the handlers for the spercified event type |
CoefficientEventHandler[] |
getHandlers(java.lang.String eventType)
Get the handlers for the spercified event type |
static EventHandlerRegistry |
getInstance()
Get the singleton instance |
void |
registerEventHandler(java.lang.Class eventType,
CoefficientEventHandler handler)
Register a handler with the registry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.log4j.Logger log
private static EventHandlerRegistry instance
private java.util.Map registry
Constructor Detail |
---|
private EventHandlerRegistry()
Method Detail |
---|
public static EventHandlerRegistry getInstance()
public CoefficientEventHandler[] getHandlers(java.lang.String eventType)
eventType
- The event type
public CoefficientEventHandler[] getHandlers(java.lang.Class eventType)
eventType
- The event type
public void registerEventHandler(java.lang.Class eventType, CoefficientEventHandler handler)
eventType
- The base event type(class) to receive notifications abouthandler
- The handler which will be notified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |