public class ConfigurableActionHandler extends GenericHandler
A simple filtering of incoming events is done inside the doesEventQualify() method. Each incoming event is compared to the eventClass and eventType (if the event extends GenericEvent) properties. If they match up, the event is handled. If not, the event is ignored. The doesEventQualify() method can be overridden to follow a different policy.
GenericEvent
,
ConfigurableAction
,
QueuedActionQueue
,
QueuedActionHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
mChannels, mEventCount
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 |
---|
ConfigurableActionHandler()
Empty constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doActions(java.lang.Object pEvent)
Peforms the configured actions on the event now.
|
boolean |
doesEventQualify(java.lang.Object pEvent)
Checks to see if the incoming object qualifies to be handled.
|
atg.service.event.QueuedActionListener |
getActionQueue()
The event queue to pass actions into.
|
atg.service.event.ConfigurableAction[] |
getActions()
The set of actions to perform on an event.
|
java.lang.Class |
getEventClass()
The event class that this handler should listen for.
|
int |
getEventType()
The type of the event class that this handler should listen for.
|
boolean |
getQueueActions()
Whether or not to queue event actions or do them immediately.
|
protected void |
queueActions(java.lang.Object pEvent)
Queues the configured actions to be performed later.
|
void |
sendEvent(java.lang.Object pEvent)
Submits an event for handling.
|
void |
setActionQueue(atg.service.event.QueuedActionListener pValue)
The event queue to pass actions into.
|
void |
setActions(atg.service.event.ConfigurableAction[] pValue)
The set of actions to perform on an event.
|
void |
setEventClass(java.lang.Class pValue)
The event class that this handler should listen for.
|
void |
setEventType(int pValue)
The type of the event class that this handler should listen for.
|
void |
setQueueActions(boolean pValue)
Whether or not to queue event actions or do them immediately.
|
getChannels, getEventCount, getHandlerName, isRegisterAtStartup, setChannels, setRegisterAtStartup
addLogListener, createAdminServlet, doStartService, doStopService, 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, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public void setQueueActions(boolean pValue)
public boolean getQueueActions()
public void setActionQueue(atg.service.event.QueuedActionListener pValue)
public atg.service.event.QueuedActionListener getActionQueue()
public void setActions(atg.service.event.ConfigurableAction[] pValue)
public atg.service.event.ConfigurableAction[] getActions()
public void setEventClass(java.lang.Class pValue)
public java.lang.Class getEventClass()
public void setEventType(int pValue)
public int getEventType()
public boolean doesEventQualify(java.lang.Object pEvent)
Currently, this class only takes in one event class and one event class type to qualify for handling. Properties can be added and this method can be overloaded so that an array of Classes and respective types can be be accepted for handling. That is left as an exercise for the reader.
pEvent
- the event to check.public void sendEvent(java.lang.Object pEvent)
sendEvent
in interface EventChannelListener
sendEvent
in class GenericHandler
pEvent
- the event to send for handling.protected void doActions(java.lang.Object pEvent)
protected void queueActions(java.lang.Object pEvent)