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 of Event this interceptor accepts
T - 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 Details

  • Constructor Details

    • EventHandler

      protected EventHandler(EventObserverSupport.EventObserver<E> observer, Class<T> classEventType)
      Construct EventHandler instance.
      Parameters:
      observer - the observer method to delegate events to
      classEventType - the class of event type enumeration
  • Method Details

    • introduceEventDispatcher

      public void introduceEventDispatcher(String sIdentifier, EventDispatcher dispatcher)
      Description copied from interface: EventDispatcherAwareInterceptor
      Introduce and possibly bind this EventInterceptor to the specified EventDispatcher.

      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 interface EventDispatcherAwareInterceptor<E extends Event<T>>
      Parameters:
      sIdentifier - the unique name identifying this interceptor
      dispatcher - the dispatcher being introduced
    • onEvent

      public void onEvent(E event)
      Description copied from interface: EventInterceptor
      Perform necessary processing of the specified Event.
      Specified by:
      onEvent in interface EventInterceptor<E extends Event<T>>
      Parameters:
      event - the Event to be processed
      See Also:
    • getId

      public String getId()
      Return a unique identifier for this interceptor.
      Returns:
      a unique identifier for this interceptor
    • isApplicable

      protected abstract boolean isApplicable(EventDispatcher dispatcher, String sScopeName)
      Return true if this interceptor should be registered with a specified dispatcher.
      Parameters:
      dispatcher - a dispatcher to register this interceptor with
      sScopeName - a scope name the observer is interested in, or null for all scopes
      Returns:
      true if this interceptor should be registered with a specified dispatcher; false otherwise
    • shouldFire

      protected boolean shouldFire(E event)
      Return true 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

      protected String getEventScope(E event)
      Return the scope name of the ConfigurableCacheFactory the specified event was raised from.
      Parameters:
      event - the event to extract scope name from
      Returns:
      the scope name
    • addType

      protected void addType(T type)
      Add specified event type to a set of types this interceptor should handle.
      Parameters:
      type - the event type to add
    • eventTypes

      protected EnumSet<T> 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

      public String 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

      protected String removeScope(String sServiceName)
      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