Spring Data for VMware GemFire
Class ClientRegionFactoryBean<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.ConfigurableRegionFactoryBean<K,V>
org.springframework.data.gemfire.client.ClientRegionFactoryBean<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.DisposableBean,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> SmartLifecycleSupport
public class ClientRegionFactoryBean<K,V>
extends ConfigurableRegionFactoryBean<K,V>
implements SmartLifecycleSupport, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, org.springframework.beans.factory.DisposableBean
Spring
FactoryBean used to construct, configure and initialize a client Region.- See Also:
-
CacheListenerCacheLoaderCacheWriterCustomExpiryDataPolicyEvictionAttributesExpirationAttributesGemFireCacheRegionRegionAttributesClientCacheClientRegionFactoryClientRegionShortcutPoolCompressorDisposableBeanFactoryBeanConfigurableRegionFactoryBeanPoolResolverRegionConfigurerEvictingRegionFactoryBeanExpiringRegionFactoryBeanSmartLifecycleSupport
-
Field Summary
FieldsFields inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
CREATING_REGION_LOG_MESSAGE, REGION_FOUND_LOG_MESSAGE, REGION_NOT_FOUND_ERROR_MESSAGEFields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETONFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.data.gemfire.support.SmartLifecycleSupport
DEFAULT_AUTO_STARTUP, DEFAULT_IS_RUNNING, DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInitializes a the instance ofClientRegionFactoryBean.Configures the givenClientRegionFactoryBeanfrom the configuration settings of thisClientRegionFactoryBeanand anyRegionAttributes.createClientRegionFactory(org.apache.geode.cache.client.ClientCache clientCache, org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactoryusing the givenClientCacheandClientRegionShortcut.createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Creates a newRegionwith the givenname.voiddestroy()Closes and destroys theRegion.Gets theRegionAttributesused to configure theclient Regioncreated by thisClientRegionFactoryBean.Gets a reference to the configured, defaultPoolResolverused by this clientRegionto resolvePoolobjects if a explicitPoolResolverwas not configured.protected booleanprotected booleanbooleanpostProcess(org.apache.geode.cache.client.ClientRegionFactory<K, V> clientRegionFactory) Post-process the givenClientRegionFactorysetup by thisClientRegionFactoryBean.postProcess(org.apache.geode.cache.Region<K, V> region) Post-process theRegioncreated by thisClientRegionFactoryBean.protected booleanvoidsetAttributes(org.apache.geode.cache.RegionAttributes<K, V> attributes) Sets the region attributes used for the region used by this factory.voidsetCacheListeners(org.apache.geode.cache.CacheListener<K, V>[] cacheListeners) Sets the cache listeners used for the region used by this factory.voidsetCacheLoader(org.apache.geode.cache.CacheLoader<K, V> cacheLoader) Sets the CacheLoader used to load data local to the client's Region on cache misses.voidsetCacheWriter(org.apache.geode.cache.CacheWriter<K, V> cacheWriter) Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.voidsetCloningEnabled(Boolean cloningEnabled) voidsetClose(boolean close) Indicates whether the region referred by this factory bean will be closed on shutdown (default true).voidsetCompressor(org.apache.geode.compression.Compressor compressor) Configures theCompressorused to compress the thisRegion'sdata.voidsetConcurrencyChecksEnabled(Boolean concurrencyChecksEnabled) voidsetConcurrencyLevel(Integer concurrencyLevel) voidsetCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K, V> customEntryIdleTimeout) voidsetCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K, V> customEntryTimeToLive) voidsetDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy) Sets the Data Policy.voidsetDestroy(boolean destroy) Indicates whether the region referred by this factory bean will be destroyed on shutdown (default false).voidsetDiskStoreName(String diskStoreName) Sets the name of disk store to use for overflow and persistencevoidsetDiskSynchronous(Boolean diskSynchronous) voidsetEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout) voidsetEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive) voidsetEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes) voidsetInitialCapacity(Integer initialCapacity) voidsetInterests(Interest<K>[] interests) Set the interests for this client region.voidsetKeyConstraint(Class<K> keyConstraint) Sets atypeconstraint on thisclient Region'skeys.voidsetLoadFactor(Float loadFactor) voidsetPersistent(boolean persistent) Configures whether thisclient Regionis persistent, i.e.voidsetPool(org.apache.geode.cache.client.Pool pool) Configures thePoolused by this clientRegion.voidsetPoolName(String poolName) voidsetPoolResolver(PoolResolver poolResolver) voidsetRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) voidsetRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) voidsetShortcut(org.apache.geode.cache.client.ClientRegionShortcut shortcut) Initializes theDataPolicyof theclient Regionusing the givenClientRegionShortcut.voidsetStatisticsEnabled(Boolean statisticsEnabled) voidsetValueConstraint(Class<V> valueConstraint) Sets atypeconstraint on thisclient Region'svalues.voidstart()Registers interests in the startup lifecycle phase of the Spring container.Methods inherited from class org.springframework.data.gemfire.ConfigurableRegionFactoryBean
applyRegionConfigurers, applyRegionConfigurers, applyRegionConfigurers, getCompositeRegionConfigurer, setRegionConfigurers, setRegionConfigurersMethods inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, isLookupEnabled, loadSnapshot, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshotMethods 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, setBeanNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.gemfire.support.SmartLifecycleSupport
getPhase, isAutoStartup, isRunning, stop, stop
-
Field Details
-
DEFAULT_POOL_NAME
- See Also:
-
GEMFIRE_POOL_NAME
- See Also:
-
-
Constructor Details
-
ClientRegionFactoryBean
public ClientRegionFactoryBean()
-
-
Method Details
-
afterPropertiesSet
Initializes a the instance ofClientRegionFactoryBean.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classConfigurableRegionFactoryBean<K,V> - Throws:
Exception- if initialization fails.- See Also:
-
InitializingBean.afterPropertiesSet()ResolvableRegionFactoryBean.createRegion(GemFireCache, String)
-
createRegion
protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Creates a newRegionwith the givenname.- Overrides:
createRegionin classResolvableRegionFactoryBean<K,V> - Parameters:
gemfireCache- reference to theGemFireCache.regionName-nameof the newRegion.- Returns:
- a new
Regionwith the givenname. - See Also:
-
createClientRegionFactory(ClientCache, ClientRegionShortcut)newRegion(ClientRegionFactory, Region, String)GemFireCacheRegion
-
createClientRegionFactory
protected org.apache.geode.cache.client.ClientRegionFactory<K,V> createClientRegionFactory(org.apache.geode.cache.client.ClientCache clientCache, org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactoryusing the givenClientCacheandClientRegionShortcut.- Parameters:
clientCache- reference to theClientCache.clientRegionShortcut-ClientRegionShortcutused to configure theclient RegionDataPolicy.- Returns:
- a new instance of
ClientRegionFactory. - See Also:
-
ClientCache.createClientRegionFactory(ClientRegionShortcut)ClientRegionShortcutClientRegionFactory
-
configure
protected org.apache.geode.cache.client.ClientRegionFactory<K,V> configure(org.apache.geode.cache.client.ClientRegionFactory<K, V> clientRegionFactory) Configures the givenClientRegionFactoryBeanfrom the configuration settings of thisClientRegionFactoryBeanand anyRegionAttributes.- Parameters:
clientRegionFactory-ClientRegionFactoryto configure.- Returns:
- the configured
ClientRegionFactory. - See Also:
-
ClientRegionFactory
-
postProcess
protected org.apache.geode.cache.client.ClientRegionFactory<K,V> postProcess(org.apache.geode.cache.client.ClientRegionFactory<K, V> clientRegionFactory) Post-process the givenClientRegionFactorysetup by thisClientRegionFactoryBean.- Parameters:
clientRegionFactory-ClientRegionFactoryto process.- Returns:
- the given
ClientRegionFactory. - See Also:
-
ClientRegionFactory
-
postProcess
Post-process theRegioncreated by thisClientRegionFactoryBean.- Overrides:
postProcessin classResolvableRegionFactoryBean<K,V> - Parameters:
region-Regionto process.- See Also:
-
Region
-
start
public void start()Registers interests in the startup lifecycle phase of the Spring container.- Specified by:
startin interfaceorg.springframework.context.Lifecycle- See Also:
-
ResolvableRegionFactoryBean.getRegion()registerInterests(Region)
-
destroy
Closes and destroys theRegion.- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception- if destroy fails.- See Also:
-
DisposableBean
-
setAttributes
Sets the region attributes used for the region used by this factory. Allows maximum control in specifying the region settings. Used only when a new region is created. Note that using this method allows for advanced customization of the region - while it provides a lot of flexibility, note that it's quite easy to create misconfigured regions (especially in a client/server scenario).- Parameters:
attributes- the attributes to set on a newly created region
-
getAttributes
Gets theRegionAttributesused to configure theclient Regioncreated by thisClientRegionFactoryBean.- Returns:
- the
RegionAttributesused to configure theclient Region. - See Also:
-
RegionAttributes
-
setCacheListeners
Sets the cache listeners used for the region used by this factory. Used only when a new region is created.Overrides the settings specified throughsetAttributes(RegionAttributes).- Parameters:
cacheListeners- the cacheListeners to set on a newly created region
-
setCacheLoader
Sets the CacheLoader used to load data local to the client's Region on cache misses.- Parameters:
cacheLoader- a GemFire CacheLoader used to load data into the client Region.- See Also:
-
CacheLoader
-
setCacheWriter
Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.- Parameters:
cacheWriter- the GemFire CacheWriter used to perform synchronous write-behinds on put ops.- See Also:
-
CacheWriter
-
setCloningEnabled
-
setClose
public void setClose(boolean close) Indicates whether the region referred by this factory bean will be closed on shutdown (default true). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.- Parameters:
close- whether to close or not the region- See Also:
-
setCompressor
public void setCompressor(org.apache.geode.compression.Compressor compressor) Configures theCompressorused to compress the thisRegion'sdata.- Parameters:
compressor-Compressorused to compress the thisRegion'sdata.- See Also:
-
Compressor
-
setConcurrencyChecksEnabled
-
setConcurrencyLevel
-
setCustomEntryIdleTimeout
public void setCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K, V> customEntryIdleTimeout) - Specified by:
setCustomEntryIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
setCustomEntryTimeToLive
public void setCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K, V> customEntryTimeToLive) - Specified by:
setCustomEntryTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
setDataPolicy
public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy) Sets the Data Policy. Used only when a new Region is created.- Parameters:
dataPolicy- the client Region's Data Policy.- See Also:
-
DataPolicy
-
setDestroy
public void setDestroy(boolean destroy) Indicates whether the region referred by this factory bean will be destroyed on shutdown (default false). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.- Parameters:
destroy- whether or not to destroy the region- See Also:
-
setDiskStoreName
Sets the name of disk store to use for overflow and persistence- Parameters:
diskStoreName- a String specifying the 'name' of the client Region Disk Store.
-
setDiskSynchronous
-
setEntryIdleTimeout
public void setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout) - Specified by:
setEntryIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
setEntryTimeToLive
public void setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive) - Specified by:
setEntryTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
setEvictionAttributes
public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes) - Specified by:
setEvictionAttributesin interfaceEvictingRegionFactoryBean
-
setInitialCapacity
-
setInterests
Set the interests for this client region. Both key and regex interest are supported.- Parameters:
interests- the interests to set
-
setKeyConstraint
Sets atypeconstraint on thisclient Region'skeys. -
setLoadFactor
-
isPersistent
protected boolean isPersistent() -
isNotPersistent
protected boolean isNotPersistent() -
setPersistent
public void setPersistent(boolean persistent) Configures whether thisclient Regionis persistent, i.e. stores data to disk.- Parameters:
persistent- boolean value used to enable disk persistence.
-
setPool
public void setPool(org.apache.geode.cache.client.Pool pool) Configures thePoolused by this clientRegion.- Parameters:
pool-Poolused by this clientRegionto send/receive data to/from the server.- See Also:
-
PoolsetPoolName(String)
-
setPoolName
- Parameters:
poolName-Stringcontaining the name of the clientPoolto be used by this clientRegion.- See Also:
-
getPoolName
-
setPoolResolver
Sets (configures) thePoolResolverused by this clientRegionto resolvePoolobjects. ThePoolobjects may be managed or un-managed depending on thePoolResolverimplementation.- Parameters:
poolResolver-PoolResolverused to resolve the configuredPool.- See Also:
-
getPoolResolver
- Returns:
- the configured
PoolResolver. If noPoolResolverwas configured, then return the default,PoolManagerPoolResolver. - See Also:
-
getDefaultPoolResolver
Gets a reference to the configured, defaultPoolResolverused by this clientRegionto resolvePoolobjects if a explicitPoolResolverwas not configured. The defaultPoolResolveruses a composition of theBeanFactoryPoolResolverandPoolManagerPoolResolverto fallback on.- Returns:
- the default
PoolResolver. - See Also:
-
setRegionIdleTimeout
public void setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) - Specified by:
setRegionIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
setRegionTimeToLive
public void setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) - Specified by:
setRegionTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
setShortcut
public void setShortcut(org.apache.geode.cache.client.ClientRegionShortcut shortcut) Initializes theDataPolicyof theclient Regionusing the givenClientRegionShortcut.- Parameters:
shortcut-ClientRegionShortcutused to initialize theDataPolicyof thisclient Region.- See Also:
-
ClientRegionShortcut
-
setStatisticsEnabled
-
getStatisticsEnabled
-
isStatisticsEnabled
public boolean isStatisticsEnabled() -
resolveStatisticsEnabled
protected boolean resolveStatisticsEnabled() -
setValueConstraint
Sets atypeconstraint on thisclient Region'svalues.
-