GigaSpaces XAP 9.7.2 API

org.openspaces.events
Class AbstractTemplateEventListenerContainer

java.lang.Object
  extended by org.openspaces.events.AbstractSpaceListeningContainer
      extended by org.openspaces.events.AbstractEventListenerContainer
          extended by org.openspaces.events.AbstractTemplateEventListenerContainer
All Implemented Interfaces:
EventListener, ServiceDetailsProvider, ServiceMonitorsProvider, Aware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ApplicationListener<ApplicationEvent>, Lifecycle
Direct Known Subclasses:
AbstractTransactionalEventListenerContainer

public abstract class AbstractTemplateEventListenerContainer
extends AbstractEventListenerContainer

A simple base class that provides support methods for Template based event listeners.

There are several ways a template can be provided. The first is by explicitly setting it using setTemplate(Object). The second option is for the event listener to implement an interface called EventTemplateProvider. The last option is to annotate a method within the event listener that will return the actual template using EventTemplate annotation.

Author:
kimchy

Field Summary
 
Fields inherited from class org.openspaces.events.AbstractEventListenerContainer
exceptionHandler, failedEvents, processedEvents
 
Fields inherited from class org.openspaces.events.AbstractSpaceListeningContainer
beanName, logger
 
Constructor Summary
AbstractTemplateEventListenerContainer()
           
 
Method Summary
protected  Object getReceiveTemplate()
          Returns the template to be used for receive operations.
protected  Object getTemplate()
          Returns the template that will be used.
 void initialize()
          Initialize this container.
protected  boolean isDynamicTemplate()
          Returns whether dynamic template is configured
protected  boolean isPerformSnapshot()
           
 void setDynamicTemplate(Object dynamicTemplate)
          Called before each take and read polling operation to change the template Overrides any template defined with setTemplate(Object)
 void setPerformSnapshot(boolean performSnapshot)
          If set to true will perform snapshot operation on the provided template before invoking registering as an event listener.
 void setTemplate(Object template)
          Sets the specified template to be used with the polling space operation.
 
Methods inherited from class org.openspaces.events.AbstractEventListenerContainer
doStart, executeListener, getActualEventListener, getApplicationContext, getEventListener, getEventListenerClass, getExceptionHandler, getFailedEvents, getProcessedEvents, handleListenerException, invokeExceptionListener, invokeListener, setApplicationContext, setEventListener, setEventListenerRef, setExceptionHandler
 
Methods inherited from class org.openspaces.events.AbstractSpaceListeningContainer
afterPropertiesSet, destroy, doAfterStart, doBeforeStop, doInitialize, doRescheduleTask, doShutdown, doStop, getBeanName, getGigaSpace, getStatus, isActive, isRunning, message, onApplicationEvent, rescheduleTaskIfNecessary, setActiveWhenPrimary, setAutoStart, setBeanName, setGigaSpace, setRegisterSpaceModeListener, shutdown, start, stop, validateConfiguration, waitWhileNotRunning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openspaces.pu.service.ServiceDetailsProvider
getServicesDetails
 
Methods inherited from interface org.openspaces.pu.service.ServiceMonitorsProvider
getServicesMonitors
 

Constructor Detail

AbstractTemplateEventListenerContainer

public AbstractTemplateEventListenerContainer()
Method Detail

initialize

public void initialize()
                throws DataAccessException
Description copied from class: AbstractSpaceListeningContainer
Initialize this container. If this container is not configured with "activeWhenPrimary" flag set to true will call AbstractSpaceListeningContainer.doStart() (if it is set to true, lifecycle of the container will be controlled by the current space mode). AbstractSpaceListeningContainer.doInitialize() will be called for additional initialization after the possible AbstractSpaceListeningContainer.doStart() call.

Overrides:
initialize in class AbstractEventListenerContainer
Throws:
DataAccessException
See Also:
AbstractSpaceListeningContainer.onApplicationEvent(org.springframework.context.ApplicationEvent)

setTemplate

public void setTemplate(Object template)
Sets the specified template to be used with the polling space operation.

See Also:
GigaSpace.take(Object,long)

getTemplate

protected Object getTemplate()
Returns the template that will be used. Note, in order to perform receive operations, the getReceiveTemplate() should be used.


isDynamicTemplate

protected boolean isDynamicTemplate()
Returns whether dynamic template is configured


getReceiveTemplate

protected Object getReceiveTemplate()
Returns the template to be used for receive operations. If setPerformSnapshot(boolean) is set to true (the default) will return the snapshot of the provided template.


setPerformSnapshot

public void setPerformSnapshot(boolean performSnapshot)
If set to true will perform snapshot operation on the provided template before invoking registering as an event listener.

See Also:
GigaSpace.snapshot(Object)

isPerformSnapshot

protected boolean isPerformSnapshot()

setDynamicTemplate

public void setDynamicTemplate(Object dynamicTemplate)
Called before each take and read polling operation to change the template Overrides any template defined with setTemplate(Object)

Parameters:
templateProvider - - An object that implements DynamicEventTemplateProvider or has a method annotated with DynamicEventTemplateProvider

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.