public class EventHandlerRegistry extends GenericContext implements java.util.EventListener, atg.nucleus.ConfigurationListener
The handlerPath property of the registry defines the location of properties files for handlers. The registry looks through that directory for components who extend the GenericHandler class. The registry starts these components and registers them with the event distributor to listen for events on their specified default channels.
The registry is also notified of when a components configuration is deleted or updated and should act accordingly.
Since a handler need only implement the EventChannelListener interface and not extend GenericHandler, the registry also allows other components to register themselves by calling the registerHandler() and unregisterHandler() methods.
GenericContext.ConcurrencyModel
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
protected static java.lang.Class |
mBaseHandlerClass
The base class for all registered handlers must be GenericHandler.
|
protected atg.service.event.EventDistributor |
mDistributor
The event distributor.
|
protected java.lang.String |
mHandlerPath
The Nucleus (or property path) where handlers are configured.
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
EventHandlerRegistry()
Empty constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
configurationDeleted(atg.nucleus.ConfigurationEvent e)
Called whenever a Nucleus component's configuration is deleted.
|
void |
configurationUpdated(atg.nucleus.ConfigurationEvent e)
Called whenever a Nucleus component's configuration is updated.
|
void |
doStartService()
Perform any necessary initializations to startup service.
|
EventChannelListener[] |
getActiveHandlers()
Returns an array of the currently registered Handlers.
|
EventChannelListener[] |
getChannelListeners(java.lang.String pChannelString)
Returns any handlers registered to listen to the given channel.
|
java.lang.String[] |
getChannelsForHandler(EventChannelListener pHandler)
Returns a String array of the event channels currently being
listened to by the specified handler.
|
java.lang.String[] |
getChannelsForHandler(java.lang.String pHandlerName)
Returns a String array of the event channels currently being
listened to by the specified handler.
|
java.lang.String[] |
getChannelSubTopics(java.lang.String pChannelString)
Returns any sub-topics of the give channel.
|
atg.service.event.EventDistributor |
getDistributor()
The event distributor.
|
int |
getHandlerCount()
The number of unique registered handlers.
|
java.lang.String |
getHandlerPath()
The Nucleus (or property path) where handlers are configured.
|
void |
refresh()
Refreshes the list of active handlers, starts any handlers not
already started and registers them with the distributor on thier
specified default channels.
|
void |
registerHandler(java.lang.String pChannel,
EventChannelListener pHandler)
Registers an EventChannelListener to listen to events on the
specified event channel.
|
void |
setDistributor(atg.service.event.EventDistributor pValue)
The event distributor.
|
void |
setHandlerPath(java.lang.String pValue)
The Nucleus (or property path) where handlers are configured.
|
void |
unregisterHandler(java.lang.String pChannel,
EventChannelListener pHandler)
Unregisters an EventChannelListener from listening to events on
the specified event channel.
|
addNameContextBindingListener, addNameContextPreBindingListener, clearElementLock, complainIfComponentAlreadyHasParentNameContext, createChildNameContext, doStopService, getAttribute, getAttributeNames, getConfigurationLock, getContext, getContextPath, getDocumentRoot, getElement, getElementLock, getInitParameter, getInitParameterNames, getMajorVersion, getMimeType, getMimeTyper, getMinorVersion, getNameContextBindingListeners, getNameContextPreBindingListeners, getNamedDispatcher, getPendingElement, getRealPath, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, isElementBound, isOptimizedForConcurrency, listElement, listElementNames, listElements, log, log, log, notifyAddedObject, notifyRemovedObject, preNotifyAddedObject, preNotifyRemovedObject, putElement, putPendingElement, removeAttribute, removeElement, removeNameContextBindingListener, removeNameContextPreBindingListener, removePendingElement, setAttribute, setDocumentRoot, setMimeTyper, startService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getNameContext
nameContextElementBound, nameContextElementUnbound
public static java.lang.String CLASS_VERSION
protected static final java.lang.Class mBaseHandlerClass
protected atg.service.event.EventDistributor mDistributor
protected java.lang.String mHandlerPath
public void setDistributor(atg.service.event.EventDistributor pValue)
public atg.service.event.EventDistributor getDistributor()
public void setHandlerPath(java.lang.String pValue)
public java.lang.String getHandlerPath()
public int getHandlerCount()
public EventChannelListener[] getActiveHandlers()
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void refresh()
Note that these handlers must extend GenericHandler, otherwise they will not be started or registered. To register handlers that do not extend GenericHandler, see the registerHandler() and unregisterHandler() methods.
public void registerHandler(java.lang.String pChannel, EventChannelListener pHandler) throws EventException
EventException
public void unregisterHandler(java.lang.String pChannel, EventChannelListener pHandler)
public java.lang.String[] getChannelsForHandler(EventChannelListener pHandler)
public java.lang.String[] getChannelsForHandler(java.lang.String pHandlerName)
public java.lang.String[] getChannelSubTopics(java.lang.String pChannelString)
public EventChannelListener[] getChannelListeners(java.lang.String pChannelString)
public void configurationDeleted(atg.nucleus.ConfigurationEvent e)
configurationDeleted
in interface atg.nucleus.ConfigurationListener
public void configurationUpdated(atg.nucleus.ConfigurationEvent e)
configurationUpdated
in interface atg.nucleus.ConfigurationListener