Class AbstractGemFireOperationsSessionRepository

java.lang.Object
org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.session.FindByIndexNameSessionRepository<org.springframework.session.Session>, org.springframework.session.SessionRepository<org.springframework.session.Session>
Direct Known Subclasses:
GemFireOperationsSessionRepository, GemFireOperationsSessionRepositorySupport

public abstract class AbstractGemFireOperationsSessionRepository extends Object implements org.springframework.context.ApplicationEventPublisherAware, org.springframework.session.FindByIndexNameSessionRepository<org.springframework.session.Session>
AbstractGemFireOperationsSessionRepository is an abstract base class encapsulating functionality common to all implementations that support SessionRepository operations backed by Apache Geode.
Since:
1.1.0
See Also:
  • Constructor Details

    • AbstractGemFireOperationsSessionRepository

      protected AbstractGemFireOperationsSessionRepository()
      Protected, default constructor used by extensions of AbstractGemFireOperationsSessionRepository in order to affect and assess SessionRepository configuration and state.
    • AbstractGemFireOperationsSessionRepository

      public AbstractGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
      Constructs a new instance of AbstractGemFireOperationsSessionRepository initialized with a required GemfireOperations object, which is used to perform Apache Geode or Pivotal GemFire data access operations on the cache Region storing and managing Session state to support this SessionRepository and its operations.
      Parameters:
      template - GemfireOperations object used to interact with the Apache Geode or Pivotal GemFire cache Region storing and managing Session state; must not be null.
      Throws:
      IllegalArgumentException - if GemfireOperations is null.
      See Also:
      • GemfireOperations
      • resolveSessionsRegion(GemfireOperations)
      • initializeSessionsRegion(Region)
      • newLogger()
  • Method Details

    • resolvePool

      @Nullable protected org.apache.geode.cache.client.Pool resolvePool(String name)
      Resolves the Pool with the given name from the PoolManager.
      Parameters:
      name - String containing the name of the Pool to resolve.
      Returns:
      the resolved Pool for the given name.
      See Also:
      • PoolManager.find(String)
      • Pool
    • newSessionEventHandler

      Returns:
      a new instance of AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter.
      See Also:
    • newSessionIdInterestRegistrar

      Returns:
      a new instance of AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener.
      See Also:
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(@NonNull org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Sets the configured ApplicationEventPublisher used to publish Session events corresponding to Apache Geode/Pivotal GemFire cache events.
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
      Parameters:
      applicationEventPublisher - ApplicationEventPublisher used to publish Session-based events; must not be null.
      Throws:
      IllegalArgumentException - if ApplicationEventPublisher is null.
      See Also:
      • ApplicationEventPublisher
    • getApplicationEventPublisher

      @NonNull protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
      Returns a reference to the configured ApplicationEventPublisher used to publish Session events corresponding to Apache Geode/Pivotal GemFire cache events.
      Returns:
      the configured ApplicationEventPublisher used to publish Session events.
      See Also:
      • ApplicationEventPublisher
    • setIsDirtyPredicate

      public void setIsDirtyPredicate(IsDirtyPredicate dirtyPredicate)
      Configures the IsDirtyPredicate strategy interface used to determine whether the users' application domain objects are dirty or not.
      Parameters:
      dirtyPredicate - IsDirtyPredicate strategy interface implementation used to determine whether the users' application domain objects are dirty or not.
      See Also:
    • getIsDirtyPredicate

      public IsDirtyPredicate getIsDirtyPredicate()
      Returns the configured IsDirtyPredicate strategy interface implementation used to determine whether the users' application domain objects are dirty or not. Defaults to GemFireHttpSessionConfiguration.DEFAULT_IS_DIRTY_PREDICATE.
      Returns:
      the configured IsDirtyPredicate strategy interface used to determine whether the users' application domain objects are dirty or not.
      See Also:
    • getLogger

      protected org.slf4j.Logger getLogger()
      Return a reference to the Logger used to log messages.
      Returns:
      a reference to the Logger used to log messages.
      See Also:
      • Log
    • setMaxInactiveInterval

      public void setMaxInactiveInterval(Duration maxInactiveInterval)
      Sets the maximum interval in which a Session can remain inactive before the Session is considered expired.
      Parameters:
      maxInactiveInterval - Duration specifying the maximum interval that a Session can remain inactive before the Session is considered expired.
      See Also:
    • getMaxInactiveInterval

      public Duration getMaxInactiveInterval()
      Returns the maximum interval in which a Session can remain inactive before the Session is considered expired.
      Returns:
      a Duration specifying the maximum interval that a Session can remain inactive before the Session is considered expired.
      See Also:
    • setMaxInactiveIntervalInSeconds

      public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
      Sets the maximum interval in seconds in which a Session can remain inactive before the Session is considered expired.
      Parameters:
      maxInactiveIntervalInSeconds - an integer value specifying the maximum interval in seconds that a Session can remain inactive before the Sessionis considered expired.
      See Also:
    • getMaxInactiveIntervalInSeconds

      public int getMaxInactiveIntervalInSeconds()
      Returns the maximum interval in seconds in which a Session can remain inactive before the Session is considered expired.
      Returns:
      an integer value specifying the maximum interval in seconds that a Session can remain inactive before the Session is considered expired.
      See Also:
    • isRegisterInterestEnabled

      protected boolean isRegisterInterestEnabled()
      Determines whether Region register interest is enabled in the current Apache Geode / Pivotal GemFire configuration.
      Returns:
      a boolean value indicating whether interest registration is enabled.
    • getSessionEventHandler

    • getSessionsRegion

      @NonNull protected org.apache.geode.cache.Region<Object,org.springframework.session.Session> getSessionsRegion()
      Returns a reference to the configured Apache Geode / Pivotal GemFire cache Region used to store and manage (HTTP) Session data.
      Returns:
      a reference to the configured Sessions Region.
      See Also:
      • Session
      • Region
    • getSessionsRegionName

      protected String getSessionsRegionName()
      Returns the fully-qualified name of the cache Region used to store and manage Session state.
      Returns:
      a String containing the fully qualified name of the cache Region used to store and manage Session data.
      See Also:
    • getSessionsTemplate

      @NonNull public org.springframework.data.gemfire.GemfireOperations getSessionsTemplate()
      Returns a reference to the template used to perform data access operations and other interactions on the cache Region storing and managing Session state and backing this SessionRepository.
      Returns:
      a reference to the template used to interact the Region storing and managing Session state.
      See Also:
      • GemfireOperations
    • getTemplate

      @Deprecated @NonNull public org.springframework.data.gemfire.GemfireOperations getTemplate()
      Deprecated.
    • setUseDataSerialization

      public void setUseDataSerialization(boolean useDataSerialization)
      Sets a condition indicating whether the DataSerialization framework has been configured.
      Parameters:
      useDataSerialization - boolean indicating whether the DataSerialization framework has been configured.
    • isUsingDataSerialization

      protected static boolean isUsingDataSerialization()
      Determines whether the DataSerialization framework has been configured.
      Returns:
      a boolean indicating whether the DataSerialization framework has been configured.
      See Also:
      • resolveSystemUsingDataSerialization()
    • commit

      @Nullable protected org.springframework.session.Session commit(@Nullable org.springframework.session.Session session)
      Commits the given Session.
      Parameters:
      session - Session to commit, iff the Session is committable.
      Returns:
      the given Session
      See Also:
    • configure

      @Nullable protected org.springframework.session.Session configure(@Nullable org.springframework.session.Session session)
    • delete

      @Nullable protected org.springframework.session.Session delete(@NonNull org.springframework.session.Session session)
      Deletes the given Session from Apache Geode / Pivotal GemFire.
      Parameters:
      session - Session to delete.
      Returns:
      null.
      See Also:
      • Session.getId()
      • Session
      • SessionRepository.deleteById(String)
    • handleDeleted

      protected void handleDeleted(String sessionId, org.springframework.session.Session session)
      Handles the deletion of the given Session.
      Parameters:
      sessionId - String containing the Session.getId() of the given Session.
      session - deleted Session.
      See Also:
    • publishEvent

      protected void publishEvent(org.springframework.context.ApplicationEvent event)
      Publishes the specified ApplicationEvent to the Spring container thereby notifying other (potentially) interested application components/beans.
      Parameters:
      event - ApplicationEvent to publish.
      See Also:
      • ApplicationEventPublisher.publishEvent(ApplicationEvent)
      • ApplicationEvent
    • registerInterest

      protected org.springframework.session.Session registerInterest(@Nullable org.springframework.session.Session session)
      Registers interest in the given Session in order to receive notifications and updates.
      Parameters:
      session - Session of interest to this application that will be registered.
      Returns:
      the given Session.
      See Also:
    • registerInterest

      protected void registerInterest(@Nullable Object sessionId)
      Registers interest on the Session.getId() ID} of a Session. And, only registers interest in the given Session ID iff we have not already registered interest in this Session ID before.
      Parameters:
      sessionId - ID of the Session of interest to this application.
      See Also:
    • touch

      @NonNull protected org.springframework.session.Session touch(@NonNull org.springframework.session.Session session)
      Updates the Session.setLastAccessedTime(Instant) property of the Session to the current time.
      Parameters:
      session - Session to touch.
      Returns:
      the Session.
      See Also:
    • unregisterInterest

      protected org.springframework.session.Session unregisterInterest(@Nullable org.springframework.session.Session session)
      Unregisters interest in the given Session in order to stop notifications and updates.
      Parameters:
      session - Session no longer of any interest to this application that will be unregistered.
      Returns:
      the given Session.
      See Also:
    • unregisterInterest

      protected void unregisterInterest(@Nullable Object sessionId)
      Unregisters interest on the Session.getId() ID} of a Session.
      Parameters:
      sessionId - ID of the Session no longer of any interest to this application.
      See Also: