From 8db58729b3c97b015f28d71b73ca6a159b3d8197 Mon Sep 17 00:00:00 2001 From: John Blum Date: Wed, 21 Nov 2018 15:13:01 -0800 Subject: [PATCH] Reorder overridden SessionRepository methods. Edit Javadoc. --- ...ireOperationsSessionRepositorySupport.java | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/support/GemFireOperationsSessionRepositorySupport.java b/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/support/GemFireOperationsSessionRepositorySupport.java index 7a0ce04..d9888bb 100644 --- a/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/support/GemFireOperationsSessionRepositorySupport.java +++ b/spring-session-data-geode/src/main/java/org/springframework/session/data/gemfire/support/GemFireOperationsSessionRepositorySupport.java @@ -18,14 +18,25 @@ package org.springframework.session.data.gemfire.support; import java.util.Map; +import org.apache.geode.cache.Region; + import org.springframework.data.gemfire.GemfireOperations; import org.springframework.session.Session; +import org.springframework.session.SessionRepository; import org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository; /** * Framework supporting class for {@link AbstractGemFireOperationsSessionRepository} implementations. * + * By default, all {@link SessionRepository} data access operations throw an {@link UnsupportedOperationException}. + * Therefore, you are free to implement only the {@link SessionRepository} data access operations you need. + * + * For instance, if you only want to implement a {@literal read-only} {@link SessionRepository}, then you can simply + * {@literal override} the {@link #findById(String)}, {@link #findByIndexNameAndIndexValue(String, String)} + * and {@link #findByPrincipalName(String)} Repository methods. In that way, the {@link Session} can never be updated. + * * @author John Blum + * @see org.apache.geode.cache.Region * @see org.springframework.data.gemfire.GemfireOperations * @see org.springframework.session.Session * @see org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepository @@ -37,17 +48,26 @@ public abstract class GemFireOperationsSessionRepositorySupport private static final String OPERATION_NOT_SUPPORTED = "Operation Not Supported"; + /** + * Construct an uninitialized instance of {@link GemFireOperationsSessionRepositorySupport}. + * + * @see #GemFireOperationsSessionRepositorySupport(GemfireOperations) + */ protected GemFireOperationsSessionRepositorySupport() { } + /** + * Constructs a new instance of {@link GemFireOperationsSessionRepositorySupport} initialized with + * the given {@link GemfireOperations} object used to perform {@link Region} data access operations + * managing the {@link Session} state. + * + * @param gemfireOperations {@link GemfireOperations} for performing data access operations + * on the {@link Region} used to manage {@link Session} state. + * @see org.springframework.data.gemfire.GemfireOperations + */ public GemFireOperationsSessionRepositorySupport(GemfireOperations gemfireOperations) { super(gemfireOperations); } - @Override - public Map findByIndexNameAndIndexValue(String indexName, String indexValue) { - throw new UnsupportedOperationException(OPERATION_NOT_SUPPORTED); - } - @Override public Session createSession() { throw new UnsupportedOperationException(OPERATION_NOT_SUPPORTED); @@ -63,6 +83,11 @@ public abstract class GemFireOperationsSessionRepositorySupport throw new UnsupportedOperationException(OPERATION_NOT_SUPPORTED); } + @Override + public Map findByIndexNameAndIndexValue(String indexName, String indexValue) { + throw new UnsupportedOperationException(OPERATION_NOT_SUPPORTED); + } + @Override public void save(Session session) { throw new UnsupportedOperationException(OPERATION_NOT_SUPPORTED);