Class CacheTypeAwareRegionFactoryBean<K,V>
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<org.apache.geode.cache.Region<K,V>>
org.springframework.data.gemfire.ResolvableRegionFactoryBean<K,V>
org.springframework.data.gemfire.config.annotation.support.CacheTypeAwareRegionFactoryBean<K,V>
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.Region<K,
,V>> org.springframework.beans.factory.InitializingBean
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
,EvictingRegionFactoryBean
,ExpiringRegionFactoryBean<K,
V>
public class CacheTypeAwareRegionFactoryBean<K,V>
extends ResolvableRegionFactoryBean<K,V>
implements EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, org.springframework.context.SmartLifecycle
The
CacheTypeAwareRegionFactoryBean
class is a smart Spring FactoryBean
that knows how to
create a client or server Region
depending on whether the GemFireCache
is a ClientCache
or a peer Cache
.- Since:
- 1.9.0
- See Also:
-
Cache
CustomExpiry
DataPolicy
EvictionAttributes
ExpirationAttributes
GemFireCache
Region
RegionAttributes
RegionShortcut
Scope
ClientCache
ClientRegionShortcut
Compressor
GenericRegionFactoryBean
LocalRegionFactoryBean
PartitionedRegionFactoryBean
PeerRegionFactoryBean
ResolvableRegionFactoryBean
ReplicatedRegionFactoryBean
ClientRegionFactoryBean
RegionConfigurer
EvictingRegionFactoryBean
ExpiringRegionFactoryBean
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
CREATING_REGION_LOG_MESSAGE, REGION_FOUND_LOG_MESSAGE, REGION_NOT_FOUND_ERROR_MESSAGE
Fields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETON
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureEviction
(EvictingRegionFactoryBean regionFactoryBean) protected void
configureExpiration
(ExpiringRegionFactoryBean<K, V> regionFactoryBean) createRegion
(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Creates a newRegion
with the givenname
.protected org.apache.geode.cache.client.ClientRegionShortcut
protected Boolean
getClose()
protected org.apache.geode.compression.Compressor
Returns the configuredCompressor
used to compress the thisRegion's
data.protected org.apache.geode.cache.DataPolicy
protected String
protected org.apache.geode.cache.ExpirationAttributes
protected org.apache.geode.cache.ExpirationAttributes
protected org.apache.geode.cache.EvictionAttributes
protected Boolean
Return the configuration setting for whether theRegion's
data will be managed in Off-Heap Memory.int
getPhase()
protected org.apache.geode.cache.ExpirationAttributes
protected org.apache.geode.cache.ExpirationAttributes
protected org.apache.geode.cache.Scope
getScope()
protected org.apache.geode.cache.RegionShortcut
protected Optional<org.springframework.context.SmartLifecycle>
boolean
protected boolean
isClose()
boolean
newClientRegion
(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Constructs, configures and initialize\s a new clientRegion
using theClientRegionFactoryBean
.protected <K,
V> ClientRegionFactoryBean<K, V> Constructs a new instance of theClientRegionFactoryBean
.protected PeerRegionFactoryBean<K,
V> Constructs asub-type
of thePeerRegionFactoryBean
class based on thegetServerRegionShortcut()
andgetDataPolicy()
.newServerRegion
(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Constructs, configures and initializes a new serverRegion
using a sub-class ofPeerRegionFactoryBean
.protected String
void
setAttributes
(org.apache.geode.cache.RegionAttributes<K, V> regionAttributes) void
setClientRegionShortcut
(org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut) void
void
setCompressor
(org.apache.geode.compression.Compressor compressor) Configures theCompressor
used to compress the thisRegion's
data.void
setCustomEntryIdleTimeout
(org.apache.geode.cache.CustomExpiry<K, V> customEntryIdleTimeout) void
setCustomEntryTimeToLive
(org.apache.geode.cache.CustomExpiry<K, V> customEntryTimeToLive) void
setDataPolicy
(org.apache.geode.cache.DataPolicy dataPolicy) void
setDiskStoreName
(String diskStoreName) void
setEntryIdleTimeout
(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout) void
setEntryTimeToLive
(org.apache.geode.cache.ExpirationAttributes entryTimeToLive) void
setEvictionAttributes
(org.apache.geode.cache.EvictionAttributes evictionAttributes) void
setInterests
(Interest<K>[] interests) void
setKeyConstraint
(Class<K> keyConstraint) void
setOffHeap
(Boolean offHeap) Configure theRegion
to manage data in Off-Heap Memory.void
setPoolName
(String poolName) void
setRegionConfigurers
(List<RegionConfigurer> regionConfigurers) Null-safe operation used to set anIterable
ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.void
setRegionConfigurers
(RegionConfigurer... regionConfigurers) Null-safe operation used to set an array ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.void
setRegionIdleTimeout
(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) void
setRegionTimeToLive
(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) void
setScope
(org.apache.geode.cache.Scope scope) void
setServerRegionShortcut
(org.apache.geode.cache.RegionShortcut shortcut) void
setStatisticsEnabled
(Boolean statisticsEnabled) void
setValueConstraint
(Class<V> valueConstraint) void
start()
void
stop()
void
Methods inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
afterPropertiesSet, getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, isLookupEnabled, loadSnapshot, postProcess, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshot
Methods inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
getBeanClassLoader, getBeanFactory, getBeanName, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, setBeanClassLoader, setBeanFactory, setBeanName
-
Constructor Details
-
CacheTypeAwareRegionFactoryBean
public CacheTypeAwareRegionFactoryBean()
-
-
Method Details
-
createRegion
public org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception Description copied from class:ResolvableRegionFactoryBean
Creates a newRegion
with the givenname
. This method gets called when aRegion
with the specifiedname
does not already exist. By default, this method implementation throws aBeanInitializationException
and it is expected thatsubclasses
will override this method.- Overrides:
createRegion
in classResolvableRegionFactoryBean<K,
V> - Parameters:
gemfireCache
- reference to theGemFireCache
.regionName
-name
of the newRegion
.- Returns:
- a new
Region
with the givenname
. - Throws:
org.springframework.beans.factory.BeanInitializationException
- by default unless asubclass
overrides this method.Exception
- See Also:
-
GemFireCache
Region
-
newClientRegion
protected org.apache.geode.cache.Region<K,V> newClientRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception Constructs, configures and initialize\s a new clientRegion
using theClientRegionFactoryBean
.- Parameters:
gemfireCache
- reference to theGemFireCache
used to create/initialize the factory used to create the clientRegion
.regionName
- name given to the clientRegion
.- Returns:
- a new instance of a client
Region
with the givenregionName
. - Throws:
Exception
- if the clientRegion
could not be created.- See Also:
-
ClientRegionFactoryBean
GemFireCache
Region
newClientRegionFactoryBean()
-
newClientRegionFactoryBean
Constructs a new instance of theClientRegionFactoryBean
.- Type Parameters:
K
-type
of the createdRegion's
key.V
-type
of the createdRegion's
value.- Returns:
- a new instance of the
ClientRegionFactoryBean
. - See Also:
-
newServerRegion
protected org.apache.geode.cache.Region<K,V> newServerRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception Constructs, configures and initializes a new serverRegion
using a sub-class ofPeerRegionFactoryBean
.- Parameters:
gemfireCache
- reference to theGemFireCache
used to create/initialize the factory used to create the serverRegion
.regionName
- name given to the serverRegion
.- Returns:
- a new instance of a server
Region
with the givenregionName
. - Throws:
Exception
- if the serverRegion
could not be created.- See Also:
-
GenericRegionFactoryBean
GemFireCache
Region
newPeerRegionFactoryBean()
-
newPeerRegionFactoryBean
Constructs asub-type
of thePeerRegionFactoryBean
class based on thegetServerRegionShortcut()
andgetDataPolicy()
.- Returns:
- a new instance of the
PeerRegionFactoryBean
. - See Also:
-
configureEviction
-
configureExpiration
-
setAttributes
-
getAttributes
-
setClientRegionShortcut
public void setClientRegionShortcut(org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut) -
getClientRegionShortcut
protected org.apache.geode.cache.client.ClientRegionShortcut getClientRegionShortcut() -
setClose
-
getClose
-
isClose
protected boolean isClose() -
setCompressor
public void setCompressor(org.apache.geode.compression.Compressor compressor) Configures theCompressor
used to compress the thisRegion's
data.- Parameters:
compressor
-Compressor
used to compress the thisRegion's
data.- See Also:
-
Compressor
-
getCompressor
protected org.apache.geode.compression.Compressor getCompressor()Returns the configuredCompressor
used to compress the thisRegion's
data.- Returns:
- the configured
Compressor
used to compress the thisRegion's
data. - See Also:
-
Compressor
-
setCustomEntryIdleTimeout
public void setCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K, V> customEntryIdleTimeout) - Specified by:
setCustomEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
getCustomEntryIdleTimeout
-
setCustomEntryTimeToLive
public void setCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K, V> customEntryTimeToLive) - Specified by:
setCustomEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
getCustomEntryTimeToLive
-
setDataPolicy
public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy) -
getDataPolicy
protected org.apache.geode.cache.DataPolicy getDataPolicy() -
setDiskStoreName
-
getDiskStoreName
-
setEvictionAttributes
public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes) - Specified by:
setEvictionAttributes
in interfaceEvictingRegionFactoryBean
-
getEvictionAttributes
protected org.apache.geode.cache.EvictionAttributes getEvictionAttributes() -
setEntryIdleTimeout
public void setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout) - Specified by:
setEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
getEntryIdleTimeout
protected org.apache.geode.cache.ExpirationAttributes getEntryIdleTimeout() -
setEntryTimeToLive
public void setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive) - Specified by:
setEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
getEntryTimeToLive
protected org.apache.geode.cache.ExpirationAttributes getEntryTimeToLive() -
setInterests
-
getInterests
-
setKeyConstraint
-
getKeyConstraint
-
setOffHeap
Configure theRegion
to manage data in Off-Heap Memory.- Parameters:
offHeap
- boolean value indicating whether theRegion's
data will be managed in Off-Heap Memory.
-
getOffHeap
Return the configuration setting for whether theRegion's
data will be managed in Off-Heap Memory.- Returns:
- a boolean value indicating whether the
Region's
data will be managed in Off-Heap Memory.
-
setPoolName
-
getPoolName
-
resolvePoolName
-
setRegionConfigurers
Null-safe operation used to set an array ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.- Parameters:
regionConfigurers
- array ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
.- See Also:
-
setRegionConfigurers
Null-safe operation used to set anIterable
ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.- Parameters:
regionConfigurers
-Iterable
ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
.- See Also:
-
setRegionIdleTimeout
public void setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) - Specified by:
setRegionIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
getRegionIdleTimeout
protected org.apache.geode.cache.ExpirationAttributes getRegionIdleTimeout() -
setRegionTimeToLive
public void setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) - Specified by:
setRegionTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
getRegionTimeToLive
protected org.apache.geode.cache.ExpirationAttributes getRegionTimeToLive() -
setScope
public void setScope(org.apache.geode.cache.Scope scope) -
getScope
protected org.apache.geode.cache.Scope getScope() -
setServerRegionShortcut
public void setServerRegionShortcut(org.apache.geode.cache.RegionShortcut shortcut) -
getServerRegionShortcut
protected org.apache.geode.cache.RegionShortcut getServerRegionShortcut() -
getSmartLifecycleComponent
-
setStatisticsEnabled
-
getStatisticsEnabled
-
setValueConstraint
-
getValueConstraint
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfaceorg.springframework.context.Phased
- Specified by:
getPhase
in interfaceorg.springframework.context.SmartLifecycle
-
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
stop
- Specified by:
stop
in interfaceorg.springframework.context.SmartLifecycle
-