Package com.oracle.coherence.cdi.events
Class EventObserverSupport.EventHandler<E extends Event<T>,T extends Enum<T>>
java.lang.Object
com.oracle.coherence.cdi.events.EventObserverSupport.EventHandler<E,T>
- Type Parameters:
E
- the type ofEvent
this interceptor acceptsT
- the enumeration of event types E supports
- All Implemented Interfaces:
EventDispatcherAwareInterceptor<E>
,EventInterceptor<E>
- Direct Known Subclasses:
EventObserverSupport.CacheLifecycleEventHandler
,EventObserverSupport.CoherenceLifecycleEventHandler
,EventObserverSupport.EntryEventHandler
,EventObserverSupport.EntryProcessorEventHandler
,EventObserverSupport.LifecycleEventHandler
,EventObserverSupport.ServiceEventHandler
,EventObserverSupport.SessionLifecycleEventHandler
- Enclosing class:
EventObserverSupport
public abstract static class EventObserverSupport.EventHandler<E extends Event<T>,T extends Enum<T>>
extends Object
implements EventDispatcherAwareInterceptor<E>
Abstract base class for all observer-based interceptors.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final EventObserverSupport.EventObserver
<E> The observer method to delegate events to.A set of event types the observer is interested in. -
Constructor Summary
ModifierConstructorDescriptionprotected
EventHandler
(EventObserverSupport.EventObserver<E> observer, Class<T> classEventType) ConstructEventHandler
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add specified event type to a set of types this interceptor should handle.Create a final set of event types to register this interceptor for.protected String
getEventScope
(E event) Return the scope name of theConfigurableCacheFactory
the specified event was raised from.getId()
Return a unique identifier for this interceptor.Return the name of the scope this interceptor should be registered with.void
introduceEventDispatcher
(String sIdentifier, EventDispatcher dispatcher) Introduce and possibly bind thisEventInterceptor
to the specifiedEventDispatcher
.protected abstract boolean
isApplicable
(EventDispatcher dispatcher, String sScopeName) Returntrue
if this interceptor should be registered with a specified dispatcher.void
Perform necessary processing of the specifiedEvent
.protected String
removeScope
(String sServiceName) Remove the scope prefix from a specified service name.protected boolean
shouldFire
(E event) Returntrue
if the event should fire.
-
Field Details
-
m_observer
The observer method to delegate events to. -
m_setTypes
A set of event types the observer is interested in.
-
-
Constructor Details
-
EventHandler
ConstructEventHandler
instance.- Parameters:
observer
- the observer method to delegate events toclassEventType
- the class of event type enumeration
-
-
Method Details
-
introduceEventDispatcher
Description copied from interface:EventDispatcherAwareInterceptor
Introduce and possibly bind thisEventInterceptor
to the specifiedEventDispatcher
.Note that EventInterceptors are responsible for determining whether they should be registered with an EventDispatcher by calling
EventDispatcher.addEventInterceptor(com.tangosol.net.events.EventInterceptor<E>)
.- Specified by:
introduceEventDispatcher
in interfaceEventDispatcherAwareInterceptor<E extends Event<T>>
- Parameters:
sIdentifier
- the unique name identifying this interceptordispatcher
- the dispatcher being introduced
-
onEvent
Description copied from interface:EventInterceptor
Perform necessary processing of the specifiedEvent
.- Specified by:
onEvent
in interfaceEventInterceptor<E extends Event<T>>
- Parameters:
event
- the Event to be processed- See Also:
-
getId
Return a unique identifier for this interceptor.- Returns:
- a unique identifier for this interceptor
-
isApplicable
Returntrue
if this interceptor should be registered with a specified dispatcher.- Parameters:
dispatcher
- a dispatcher to register this interceptor withsScopeName
- a scope name the observer is interested in, ornull
for all scopes- Returns:
true
if this interceptor should be registered with a specified dispatcher;false
otherwise
-
shouldFire
Returntrue
if the event should fire.This allows sub-classes to provide additional filtering logic and prevent the observer method notification from happening even after the Coherence server-side event is fired.
- Parameters:
event
- the event to check- Returns:
true
if the event should fire
-
getEventScope
Return the scope name of theConfigurableCacheFactory
the specified event was raised from.- Parameters:
event
- the event to extract scope name from- Returns:
- the scope name
-
addType
Add specified event type to a set of types this interceptor should handle.- Parameters:
type
- the event type to add
-
eventTypes
Create a final set of event types to register this interceptor for.- Returns:
- a final set of event types to register this interceptor for
-
getScopeName
Return the name of the scope this interceptor should be registered with.- Returns:
- the name of the scope this interceptor should be registered with
-
removeScope
Remove the scope prefix from a specified service name.- Parameters:
sServiceName
- the service name to remove scope prefix from- Returns:
- service name with scope prefix removed
-