@Configuration
public class GemFireHttpSessionConfiguration
extends org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration
implements org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.context.annotation.ImportAware
GemFireHttpSessionConfiguration class is a Spring @Configuration class
used to configure and initialize Pivotal GemFire/Apache Geode as a clustered, distributed and replicated
HttpSession provider implementation in Spring Session.ExpirationAttributes,
GemFireCache,
Region,
RegionAttributes,
RegionShortcut,
ClientRegionShortcut,
Pool,
BeanClassLoaderAware,
Bean,
Configuration,
DependsOn,
ImportAware,
AnnotationAttributes,
AnnotationMetadata,
GemfireOperations,
GemfireTemplate,
IndexFactoryBean,
RegionAttributesFactoryBean,
Session,
SpringHttpSessionConfiguration,
GemFireOperationsSessionRepository,
EnableGemFireHttpSession,
GemFireCacheTypeAwareRegionFactoryBean,
SessionAttributesIndexFactoryBean| Modifier and Type | Field and Description |
|---|---|
static org.apache.geode.cache.client.ClientRegionShortcut |
DEFAULT_CLIENT_REGION_SHORTCUT
Default
ClientRegionShortcut used to configure the data management policy of the ClientCache
Region that will store Session state. |
static java.lang.String[] |
DEFAULT_INDEXABLE_SESSION_ATTRIBUTES
Defaults names of all
Session attributes that will be indexed by Apache Geode. |
static int |
DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS
Default maximum interval in seconds in which a
Session can remain inactive before it expires. |
static java.lang.String |
DEFAULT_POOL_NAME
Name of the connection
Pool used by the client Region to send Session state
to the cluster of Geode servers. |
static org.apache.geode.cache.RegionShortcut |
DEFAULT_SERVER_REGION_SHORTCUT
Default
RegionShortcut used to configure the data management policy of the Cache Region
that will store Session state. |
static java.lang.String |
DEFAULT_SESSION_REGION_NAME
Default name of (Client)Cache
Region used to store Session state. |
static java.lang.String |
DEFAULT_SESSION_SERIALIZER_BEAN_NAME |
static java.lang.String |
SESSION_DATA_SERIALIZER_BEAN_NAME
Set of defaults for
Session serialization. |
static java.lang.String |
SESSION_PDX_SERIALIZER_BEAN_NAME |
protected static java.lang.Class<java.lang.Object> |
SESSION_REGION_KEY_CONSTRAINT
Key and Value class type constraints applied to the
Session Region. |
protected static java.lang.Class<AbstractGemFireOperationsSessionRepository.GemFireSession> |
SESSION_REGION_VALUE_CONSTRAINT |
static java.lang.String |
SESSION_SERIALIZER_BEAN_ALIAS |
| Constructor and Description |
|---|
GemFireHttpSessionConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
getApplicationContext()
Returns a reference to the Spring
ApplicationContext. |
protected java.lang.ClassLoader |
getBeanClassLoader()
Returns a reference to the
ClassLoader used by the Spring container to load bean
class types. |
protected org.springframework.beans.factory.config.ConfigurableBeanFactory |
getBeanFactory()
Returns a reference to the Spring container
ConfigurableBeanFactory. |
protected org.apache.geode.cache.client.ClientRegionShortcut |
getClientRegionShortcut()
Gets the
ClientRegionShortcut used to configure the data management policy of the ClientCache
Region that will store Session state. |
protected java.lang.String[] |
getIndexableSessionAttributes()
Get the names of all
Session attributes that will be indexed. |
protected int |
getMaxInactiveIntervalInSeconds()
Gets the maximum interval in seconds in which a
Session can remain inactive before it expires. |
protected java.lang.String |
getPoolName()
Returns the name of the
Pool used by the client Region to send Session
to the cluster of servers during cache operations. |
protected org.apache.geode.cache.RegionShortcut |
getServerRegionShortcut()
Gets the
RegionShortcut used to configure the data management policy of the Cache Region
that will store Session state. |
protected java.lang.String |
getSessionRegionName()
Returns the name of the (Client)Cache
Region used to store Session state. |
protected java.lang.String |
getSessionSerializerBeanName()
Returns the configured
bean name of the Spring bean declared in the Spring application context
defining the serialization strategy for serializing the Session. |
void |
init() |
protected boolean |
isUsingDataSerialization()
Determine whether the configured serialization strategy is using Apache Geode / Pivotal GemFire's
DataSerialization framework.
|
org.springframework.data.gemfire.IndexFactoryBean |
principalNameIndex(org.apache.geode.cache.GemFireCache gemfireCache)
Defines a GemFire Index bean on the GemFire cache
Region storing and managing Sessions,
specifically on the 'principalName' property for quick lookup of Sessions by 'principalName'. |
SessionAttributesIndexFactoryBean |
sessionAttributesIndex(org.apache.geode.cache.GemFireCache gemfireCache)
Defines a GemFire Index bean on the GemFire cache
Region storing and managing Sessions,
specifically on all Session attributes for quick lookup and queries on Session attribute names
with a given value. |
java.lang.Object |
sessionDataSerializer() |
java.lang.Object |
sessionPdxSerializer() |
GemFireCacheTypeAwareRegionFactoryBean<java.lang.Object,org.springframework.session.Session> |
sessionRegion(org.apache.geode.cache.GemFireCache gemfireCache,
org.apache.geode.cache.RegionAttributes<java.lang.Object,org.springframework.session.Session> sessionRegionAttributes)
Defines the
Region used to store and manage Session state in either a client-server
or peer-to-peer (p2p) topology. |
org.springframework.data.gemfire.RegionAttributesFactoryBean |
sessionRegionAttributes(org.apache.geode.cache.GemFireCache gemfireCache)
Defines a
RegionAttributes used to configure and initialize the cache Region
used to store Session state. |
org.springframework.data.gemfire.GemfireTemplate |
sessionRegionTemplate(org.apache.geode.cache.GemFireCache gemfireCache)
Defines a
GemfireTemplate bean used to interact with the (Client)Cache Region
used to store Session state. |
GemFireOperationsSessionRepository |
sessionRepository(org.springframework.data.gemfire.GemfireOperations gemfireOperations)
Defines the
SessionRepository bean used to interact with Apache Geode or Pivotal GemFire
as the Spring Session provider. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Sets a reference the Spring
ApplicationContext. |
void |
setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
Sets a reference to the
ClassLoader used by the Spring container to load bean class types. |
void |
setClientRegionShortcut(org.apache.geode.cache.client.ClientRegionShortcut shortcut)
Gets the
ClientRegionShortcut used to configure the data management policy of the ClientCache
Region that will store Session state. |
void |
setImportMetadata(org.springframework.core.type.AnnotationMetadata importMetadata)
Callback with the
AnnotationMetadata of the class containing @Import annotation
that imported this @Configuration class. |
void |
setIndexableSessionAttributes(java.lang.String[] indexableSessionAttributes)
Sets the names of all
Session attributes that will be indexed. |
void |
setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
Sets the maximum interval in seconds in which a
Session can remain inactive before it expires. |
void |
setPoolName(java.lang.String poolName)
Sets the name of the
Pool used by the client Region to send Session
to the cluster of servers during cache operations. |
void |
setServerRegionShortcut(org.apache.geode.cache.RegionShortcut shortcut)
Sets the
RegionShortcut used to configure the data management policy of the Cache Region
that will store Session state. |
void |
setSessionRegionName(java.lang.String sessionRegionName)
Sets the name of the (Client)Cache
Region used to store Session state. |
void |
setSessionSerializerBeanName(java.lang.String sessionSerializerBeanName)
Sets the
bean name of the Spring bean declared in the Spring application context
defining the serialization strategy for serializing the Session. |
public static final int DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS
Session can remain inactive before it expires.protected static final java.lang.Class<java.lang.Object> SESSION_REGION_KEY_CONSTRAINT
Session Region.protected static final java.lang.Class<AbstractGemFireOperationsSessionRepository.GemFireSession> SESSION_REGION_VALUE_CONSTRAINT
public static final org.apache.geode.cache.client.ClientRegionShortcut DEFAULT_CLIENT_REGION_SHORTCUT
ClientRegionShortcut used to configure the data management policy of the ClientCache
Region that will store Session state.public static final org.apache.geode.cache.RegionShortcut DEFAULT_SERVER_REGION_SHORTCUT
RegionShortcut used to configure the data management policy of the Cache Region
that will store Session state.public static final java.lang.String DEFAULT_POOL_NAME
Pool used by the client Region to send Session state
to the cluster of Geode servers.public static final java.lang.String DEFAULT_SESSION_REGION_NAME
Region used to store Session state.public static final java.lang.String SESSION_DATA_SERIALIZER_BEAN_NAME
Session serialization.public static final java.lang.String SESSION_PDX_SERIALIZER_BEAN_NAME
public static final java.lang.String SESSION_SERIALIZER_BEAN_ALIAS
public static final java.lang.String DEFAULT_SESSION_SERIALIZER_BEAN_NAME
public static final java.lang.String[] DEFAULT_INDEXABLE_SESSION_ATTRIBUTES
Session attributes that will be indexed by Apache Geode.public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
ApplicationContext.setApplicationContext in interface org.springframework.context.ApplicationContextAwaresetApplicationContext in class org.springframework.session.config.annotation.web.http.SpringHttpSessionConfigurationapplicationContext - reference to the Spring ApplicationContext.org.springframework.beans.BeansException - if the reference cannot be stored.ApplicationContextprotected org.springframework.context.ApplicationContext getApplicationContext()
ApplicationContext.ApplicationContext.ApplicationContextpublic void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
ClassLoader used by the Spring container to load bean class types.setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAwarebeanClassLoader - ClassLoader used by the Spring container to load bean class types.BeanClassLoaderAware.setBeanClassLoader(ClassLoader),
ClassLoaderprotected java.lang.ClassLoader getBeanClassLoader()
ClassLoader used by the Spring container to load bean
class types.ClassLoader used by the Spring container to load bean class types.ClassLoaderprotected org.springframework.beans.factory.config.ConfigurableBeanFactory getBeanFactory()
ConfigurableBeanFactory.ConfigurableBeanFactory.ConfigurableBeanFactory,
getApplicationContext()public void setClientRegionShortcut(org.apache.geode.cache.client.ClientRegionShortcut shortcut)
ClientRegionShortcut used to configure the data management policy of the ClientCache
Region that will store Session state.
Defaults to ClientRegionShortcut.PROXY.shortcut - ClientRegionShortcut used to configure the data management policy
of the ClientCache Region.EnableGemFireHttpSession.clientRegionShortcut(),
ClientRegionShortcutprotected org.apache.geode.cache.client.ClientRegionShortcut getClientRegionShortcut()
ClientRegionShortcut used to configure the data management policy of the ClientCache
Region that will store Session state.
Defaults to ClientRegionShortcut.PROXY.ClientRegionShortcut used to configure the data management policy
of the ClientCache Region.ClientRegionShortcutpublic void setIndexableSessionAttributes(java.lang.String[] indexableSessionAttributes)
Session attributes that will be indexed.indexableSessionAttributes - an array of Strings containing the names
of all Session attributes for which an Index will be created.EnableGemFireHttpSession.indexableSessionAttributes()protected java.lang.String[] getIndexableSessionAttributes()
Session attributes that will be indexed.Strings containing the names of all Session attributes
for which an Index will be created. Defaults to an empty array if unspecified.public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds)
Session can remain inactive before it expires.maxInactiveIntervalInSeconds - integer value specifying the maximum interval in seconds
that a Session can remain inactive before it expires.EnableGemFireHttpSession.maxInactiveIntervalInSeconds()protected int getMaxInactiveIntervalInSeconds()
Session can remain inactive before it expires.Session can remain inactive
before it expires.public void setPoolName(java.lang.String poolName)
Pool used by the client Region to send Session
to the cluster of servers during cache operations.poolName - String containing the name of a Pool.EnableGemFireHttpSession.poolName()protected java.lang.String getPoolName()
Pool used by the client Region to send Session
to the cluster of servers during cache operations.String containing the name of a Pool.Pool.getName()public void setServerRegionShortcut(org.apache.geode.cache.RegionShortcut shortcut)
RegionShortcut used to configure the data management policy of the Cache Region
that will store Session state.
Defaults to RegionShortcut.PARTITION.shortcut - RegionShortcut used to configure the data management policy
of the Cache Region.EnableGemFireHttpSession.serverRegionShortcut(),
RegionShortcutprotected org.apache.geode.cache.RegionShortcut getServerRegionShortcut()
RegionShortcut used to configure the data management policy of the Cache Region
that will store Session state.
Defaults to RegionShortcut.PARTITION.RegionShortcut used to configure the data management policy
of the Cache Region.RegionShortcutpublic void setSessionRegionName(java.lang.String sessionRegionName)
Region used to store Session state.sessionRegionName - String specifying the name of the (Client)Cache Region
used to store Session state.EnableGemFireHttpSession.regionName()protected java.lang.String getSessionRegionName()
Region used to store Session state.String specifying the name of the (Client)Cache Region
used to store Session state.Region.getName()public void setSessionSerializerBeanName(java.lang.String sessionSerializerBeanName)
bean name of the Spring bean declared in the Spring application context
defining the serialization strategy for serializing the Session.
The serialization strategy and bean referred to by its name must be an implementation of
SessionSerializer.
Defaults to SessionDataSerializer.sessionSerializerBeanName - bean name of the SessionSerializer used to
serialize the Session.DataSerializableSessionSerializer,
SessionSerializerprotected java.lang.String getSessionSerializerBeanName()
bean name of the Spring bean declared in the Spring application context
defining the serialization strategy for serializing the Session.
The serialization strategy and bean referred to by its name must be an implementation of
SessionSerializer.
Defaults to SessionDataSerializer.bean name of the SessionSerializer used to serialize the Session.DataSerializableSessionSerializer,
SessionSerializerprotected boolean isUsingDataSerialization()
getSessionSerializerBeanName()public void setImportMetadata(org.springframework.core.type.AnnotationMetadata importMetadata)
AnnotationMetadata of the class containing @Import annotation
that imported this @Configuration class.setImportMetadata in interface org.springframework.context.annotation.ImportAwareimportMetadata - AnnotationMetadata of the application class importing
this Configuration class.AnnotationMetadata@PostConstruct public void init()
init in class org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration@Bean(value="SessionDataSerializer") public java.lang.Object sessionDataSerializer()
@Bean(value="SessionPdxSerializer") public java.lang.Object sessionPdxSerializer()
@Bean(name="ClusteredSpringSessions") public GemFireCacheTypeAwareRegionFactoryBean<java.lang.Object,org.springframework.session.Session> sessionRegion(org.apache.geode.cache.GemFireCache gemfireCache, @Qualifier(value="sessionRegionAttributes") org.apache.geode.cache.RegionAttributes<java.lang.Object,org.springframework.session.Session> sessionRegionAttributes)
Region used to store and manage Session state in either a client-server
or peer-to-peer (p2p) topology.gemfireCache - reference to the GemFireCache.sessionRegionAttributes - RegionAttributes used to configure the Region.GemFireCacheTypeAwareRegionFactoryBean used to configure and initialize
the cache Region used to store and manage Session state.GemFireCache,
RegionAttributes,
getClientRegionShortcut(),
getPoolName(),
getServerRegionShortcut(),
getSessionRegionName()@Bean public org.springframework.data.gemfire.RegionAttributesFactoryBean sessionRegionAttributes(org.apache.geode.cache.GemFireCache gemfireCache)
RegionAttributes used to configure and initialize the cache Region
used to store Session state.
Expiration is also configured for the Region on the basis that the cache Region
is a not a proxy on either the client or server.gemfireCache - reference to the GemFireCache.RegionAttributes used to configure and initialize cache Region
used to store and manage Session state.RegionAttributesFactoryBean,
GemFireCache,
PartitionAttributes,
isExpirationAllowed(GemFireCache)@Bean @DependsOn(value="ClusteredSpringSessions") public org.springframework.data.gemfire.GemfireTemplate sessionRegionTemplate(org.apache.geode.cache.GemFireCache gemfireCache)
GemfireTemplate bean used to interact with the (Client)Cache Region
used to store Session state.gemfireCache - reference to the single GemFireCache instance used by the GemfireTemplate
to perform cache Region data access operations.GemfireTemplate used to interact with the (Client)Cache Region
used to store Session state.GemfireTemplate,
GemFireCache,
Region,
getSessionRegionName()@Bean public GemFireOperationsSessionRepository sessionRepository(@Qualifier(value="sessionRegionTemplate") org.springframework.data.gemfire.GemfireOperations gemfireOperations)
SessionRepository bean used to interact with Apache Geode or Pivotal GemFire
as the Spring Session provider.gemfireOperations - instance of GemfireOperations used to manage Session state
in Apache Geode or Pivotal GemFire.GemFireOperationsSessionRepository for managing (clustering/replicating) Session state
in Apache Geode or Pivotal GemFire.GemFireOperationsSessionRepository,
GemfireOperations@Bean @DependsOn(value="ClusteredSpringSessions") public org.springframework.data.gemfire.IndexFactoryBean principalNameIndex(org.apache.geode.cache.GemFireCache gemfireCache)
Region storing and managing Sessions,
specifically on the 'principalName' property for quick lookup of Sessions by 'principalName'.gemfireCache - a reference to the GemFire cache.IndexFactoryBean to create an GemFire Index on the 'principalName' property
for Sessions stored in the GemFire cache Region.IndexFactoryBean,
GemFireCache@Bean @DependsOn(value="ClusteredSpringSessions") public SessionAttributesIndexFactoryBean sessionAttributesIndex(org.apache.geode.cache.GemFireCache gemfireCache)
Region storing and managing Sessions,
specifically on all Session attributes for quick lookup and queries on Session attribute names
with a given value.gemfireCache - a reference to the GemFire cache.IndexFactoryBean to create an GemFire Index on attributes of Sessions
stored in the GemFire cache Region.IndexFactoryBean,
GemFireCache