Spring Session for VMware GemFire
Class GemFireOperationsSessionRepository
java.lang.Object
org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
org.springframework.session.data.gemfire.GemFireOperationsSessionRepository
- 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>
The
GemFireOperationsSessionRepository class is a Spring SessionRepository implementation
that interfaces with and uses Apache Geode or Pivotal GemFire to back and store Spring Sessions.- Since:
- 1.1.0
- See Also:
-
GemfireOperationsSessionSessionRepositoryAbstractGemFireOperationsSessionRepository
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSession, AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSessionAttributes, AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>, AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes, AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter, AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener -
Field Summary
FieldsFields inherited from interface org.springframework.session.FindByIndexNameSessionRepository
PRINCIPAL_NAME_INDEX_NAME -
Constructor Summary
ConstructorsConstructorDescriptionGemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofGemFireOperationsSessionRepositoryinitialized with the requiredGemfireOperationsobject used to perform data access operations for managing (HTTP)Sessionstate. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.session.SessionConstructs a newSessioninstance backed by GemFire.voiddeleteById(String sessionId) Deletes (removes) any existingSessionfrom GemFire.org.springframework.session.SessionFinds an existing, non-expiredSessionby ID.findByIndexNameAndIndexValue(String indexName, String indexValue) protected StringprepareQuery(String indexName) Prepares the appropriate Pivotal GemFire OQL query based on the indexed Session attribute name.voidsave(org.springframework.session.Session session) Saves the specifiedSessionto Apache Geode or Pivotal GemFire.Methods inherited from class org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository
commit, configure, delete, getApplicationEventPublisher, getIsDirtyPredicate, getLogger, getMaxInactiveInterval, getMaxInactiveIntervalInSeconds, getSessionEventHandler, getSessionsRegion, getSessionsRegionName, getSessionsTemplate, getTemplate, handleDeleted, isRegisterInterestEnabled, isUsingDataSerialization, newSessionEventHandler, newSessionIdInterestRegistrar, publishEvent, registerInterest, registerInterest, resolvePool, setApplicationEventPublisher, setIsDirtyPredicate, setMaxInactiveInterval, setMaxInactiveIntervalInSeconds, setUseDataSerialization, touch, unregisterInterest, unregisterInterestMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.session.FindByIndexNameSessionRepository
findByPrincipalName
-
Field Details
-
FIND_SESSIONS_BY_INDEX_NAME_AND_INDEX_VALUE_QUERY
- See Also:
-
FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY
- See Also:
-
-
Constructor Details
-
GemFireOperationsSessionRepository
public GemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template) Constructs a new instance ofGemFireOperationsSessionRepositoryinitialized with the requiredGemfireOperationsobject used to perform data access operations for managing (HTTP)Sessionstate.- Parameters:
template-GemfireOperationsobject used to access and manageSessionstate in GemFire.- See Also:
-
GemfireOperations
-
-
Method Details
-
createSession
@NonNull public org.springframework.session.Session createSession()Constructs a newSessioninstance backed by GemFire.- Returns:
- an instance of
Sessionbacked by GemFire. - See Also:
-
findById
Finds an existing, non-expiredSessionby ID. If theSessionis expired, then theSessionis deleted and null is returned.- Parameters:
sessionId-Stringcontaining theID} of theSessionto get.- Returns:
- an existing
Sessionby ID or null if noSessionexists or theSessionexpired. - See Also:
-
AbstractGemFireOperationsSessionRepository.GemFireSession.from(Session)GemfireTemplate.get(Object)SessionAbstractGemFireOperationsSessionRepository.getSessionsTemplate()prepare(Session)AbstractGemFireOperationsSessionRepository.delete(Session)
-
findByIndexNameAndIndexValue
public Map<String,org.springframework.session.Session> findByIndexNameAndIndexValue(String indexName, String indexValue) - Parameters:
indexName-nameof the indexedSessionattribute. (e.g.FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME).indexValue-valueof the indexedSessionattribute to search on (e.g. username).- Returns:
- a mapping of
Session.getId()Session IDs} toSessionobjects. - See Also:
-
GemfireTemplate.find(String, Object...)SessionMapAbstractGemFireOperationsSessionRepository.getSessionsTemplate()prepareQuery(String)prepare(Session)
-
prepareQuery
Prepares the appropriate Pivotal GemFire OQL query based on the indexed Session attribute name.- Parameters:
indexName- a String indicating the name of the indexed Session attribute.- Returns:
- an appropriate Pivotal GemFire OQL statement for querying on a particular indexed Session attribute.
- See Also:
-
save
public void save(@Nullable org.springframework.session.Session session) Saves the specifiedSessionto Apache Geode or Pivotal GemFire. Warning, the save method should never be called asynchronously and concurrently, from a separate Thread, while the caller continues to modify the givenSessionfrom the forking Thread or data loss can occur! There is a reason why this method is blocking!- Parameters:
session- theSessionto save.- See Also:
-
GemfireOperations.put(Object, Object)SessionisNonNullAndDirty(Session)doSave(Session)
-
deleteById
Deletes (removes) any existingSessionfrom GemFire. This operation also results in a SessionDeletedEvent.- Parameters:
sessionId- a String indicating the ID of the Session to remove from GemFire.- See Also:
-
GemfireOperations.remove(Object)AbstractGemFireOperationsSessionRepository.handleDeleted(String, Session)
-