|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.event.GenericHandler atg.service.event.ConfigurableActionHandler
public class ConfigurableActionHandler
This handler takes an array of ConfigurableActions as a property. As each event comes into the handler, the actions are performed on the event. With the proper setup, actions can be queued for later execution. Setting the 'queueActions' property to true will will put each incoming event into a QueuedAction along with the ConfigurableActions of this handler. These QueuedActions are then passed to the QueuedActionQueue set as the 'queue' property of this handler. The QueuedActionQueue later passes each QueuedAction to a single listener of the queue, a QueuedActionHandler. The QueuedActionHandler pulls out the actions and performs them on the original event.
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
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.service.event.GenericHandler |
---|
mChannels, mEventCount |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
ConfigurableActionHandler()
Empty constructor. |
Method Summary | |
---|---|
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. |
Methods inherited from class atg.service.event.GenericHandler |
---|
getChannels, getEventCount, getHandlerName, isRegisterAtStartup, setChannels, setRegisterAtStartup |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public ConfigurableActionHandler()
Method Detail |
---|
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |