public class ResourceEventProcessor extends java.lang.Object implements ResourceListener
ResourceListener that can be used
to process ResourceEvent notifications. A ResourceEvent is processed
whenever the Notification() method is called by a Resource which has
registered this ResourceEventProcessor.
ResourceEvents are processed by calling a ResourceEventHandler using
the information contained in the ResourceEvent. Events can be processed using
one of the following user defined modes which are set using method setProcessingMode(int).
Resource should be used.ResourceOutputHandler handler should be used.Resource,
ResourceListener,
ResourceEvent| Modifier and Type | Field and Description |
|---|---|
static int |
ALL_EVENT_HANDLERS
Mode used to specify that all event handlers should be used.
|
static int |
GENERIC_HANDLER
Mode used to specify that only the generic
ResourceOutputHandler handler should be used. |
static int |
LOCAL_HANDLER_ONLY
Mode used to specify that only the handler specified in this class should be used.
|
ResourceEventHandler |
m_handler
The Event Handler which can be used for all Resources that are using this Listener.
|
static int |
NO_HANDLER
Mode used to specify that no handler should be used.
|
static int |
RESOURCE_HANDLERS_ONLY
Mode use to specify that only events contained in the
Resource should be used. |
| Constructor and Description |
|---|
ResourceEventProcessor() |
| Modifier and Type | Method and Description |
|---|---|
ResourceEventHandler |
getEventHandler()
Get the ResourceEventHandler which has been locally configured using
setEventHandler(ResourceEventHandler) to handle
Event Notification for a Resource. |
int |
getProcessingMode()
Return the processing mode set by this ResourceEventProcessor
|
void |
Notification(ResourceEvent event)
This method is called by a
Resource when it is determined that an
event notification should be triggered. |
void |
removeEventHandler()
Remove the local
ResourceEventHandler specified by this ResourceEventProcessor. |
void |
setEventHandler(ResourceEventHandler handler)
A local ResourceEventHandler can be specified by this ResourceEventProcessor.
|
void |
setProcessingMode(int Mode)
Sets the processing mode.
|
public static final int ALL_EVENT_HANDLERS
ResourceOutputHandler
will be used to handle the event. In this case, the event messages will be
sent to System.outNote: If both the Resource handlers and the handler specified by this class contain the same ResourceEventHandler, the same event will be handled twice.
public static final int RESOURCE_HANDLERS_ONLY
Resource should be used.
Events will be processed as follows:
ResourceOutputHandler
will be used to handle the event. In this case, the event messages will be
sent to System.outpublic static final int LOCAL_HANDLER_ONLY
ResourceOutputHandler
will be used to handle the event. In this case, the event messages will be
sent to System.outpublic static final int GENERIC_HANDLER
ResourceOutputHandler handler should be used.
Events will be processed as follows:
ResourceOutputHandler will be used to handle
the event. In this case, the event messages will be sent to System.outpublic static final int NO_HANDLER
public ResourceEventHandler m_handler
public void Notification(ResourceEvent event) throws ResourceEventException
Resource when it is determined that an
event notification should be triggered. The purpose of this method is to
process the ResourceEvent which is used to convey the Notification information.
The Processing of events is determined by setting the processing mode using the
setProcessingMode(int) to one of the following modes:
Resource should be used.ResourceOutputHandlert handler should be used.Notification in interface ResourceListenerResourceEventExceptionResourcepublic void setEventHandler(ResourceEventHandler handler)
handler - the ResourceEventHandler which will be used to handle a ResourceEventALL_EVENT_HANDLERS,
LOCAL_HANDLER_ONLYpublic void removeEventHandler()
ResourceEventHandler specified by this ResourceEventProcessor.
Note: If the processing mode is set to LOCAL_HANDLER_ONLY, then
the default ResourceOutputHandler will be used to handle events.
Effectively it is the same as using the processing mode GENERIC_HANDLER
LOCAL_HANDLER_ONLY,
GENERIC_HANDLERpublic ResourceEventHandler getEventHandler()
setEventHandler(ResourceEventHandler) to handle
Event Notification for a Resource.public void setProcessingMode(int Mode)
Resource should be used.ResourceOutputHandler will handle the
events by writing the message to System.out.Mode - the processing mode to be usedpublic int getProcessingMode()
setProcessingMode(int)