public abstract class RegionFactoryBean<K,V> extends RegionLookupFactoryBean<K,V> implements DisposableBean, SmartLifecycle
FactoryBean for constructing and initializing a GemFire Region.
=======
Abstract Spring FactoryBean base class extended by other SDG FactoryBeans used to
construct, configure and initialize peer Regions.
This FactoryBean allows for very easy and flexible creation of peer Region.
For client Regions, however, see the ClientRegionFactoryBean.
>>>>>>> c22ebe6... DATAGEODE-12 - Introduce Spring Configurers to flexibly alter Spring Data GemFire configuration when using Annotation config.DisposableBean,
SmartLifecycle,
=======,
Cache,
CacheListener,
CacheLoader,
CacheWriter,
DataPolicy,
EvictionAttributes,
GemFireCache,
PartitionAttributes,
Region,
RegionAttributes,
RegionFactory,
RegionShortcut,
Scope,
AsyncEventQueue,
DisposableBean,
SmartLifecycle,
RegionLookupFactoryBean,
ClientRegionFactoryBean,
>>>>>>> c22ebe6... DATAGEODE-12 - Introduce Spring Configurers to flexibly alter Spring Data GemFire configuration when using Annotation config.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
log |
DEFAULT_SINGLETON| Constructor and Description |
|---|
RegionFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyRegionConfigurers(String regionName,
Iterable<RegionConfigurer> regionConfigurers)
|
protected void |
applyRegionConfigurers(String regionName,
RegionConfigurer... regionConfigurers)
Null-safe operation to apply the given array of
RegionConfigurers
to this RegionFactoryBean. |
protected void |
assertDataPolicyAndPersistentAttributesAreCompatible(org.apache.geode.cache.DataPolicy resolvedDataPolicy)
Validates that the settings for Data Policy and the 'persistent' attribute in <gfe:*-region> elements
are compatible.
|
protected org.apache.geode.cache.RegionFactory<K,V> |
configure(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
Configures the
RegionFactory based on the configuration settings of this RegionFactoryBean. |
protected org.apache.geode.cache.Region<K,V> |
createRegion(org.apache.geode.cache.GemFireCache gemfireCache,
String regionName)
Creates a new
Region with the given name. |
protected org.apache.geode.cache.RegionFactory<K,V> |
createRegionFactory(org.apache.geode.cache.Cache cache)
Creates an instance of
RegionFactory with the given Cache which is then used to construct,
configure and initialize the Region specified by this RegionFactoryBean. |
void |
destroy()
Closes and destroys the
Region. |
org.apache.geode.cache.RegionAttributes<K,V> |
getAttributes()
Returns the attributes used to configure the Region created by this factory as set in the SDG XML namespace
configuration meta-data, or as set with the setAttributes(:Attributes) method.
|
protected RegionConfigurer |
getCompositeRegionConfigurer()
Returns a reference to the Composite
RegionConfigurer used to apply additional configuration
to this RegionFactoryBean on Spring container initialization. |
org.apache.geode.cache.DataPolicy |
getDataPolicy()
Gets the "resolved" Data Policy as determined by this RegionFactory when configuring the attributes
of the Region to be created.
|
Boolean |
getOffHeap()
Returns a
Boolean value indicating whether off-heap memory was enabled for this Region. |
int |
getPhase() |
org.apache.geode.cache.Scope |
getScope() |
protected org.apache.geode.cache.RegionShortcut |
getShortcut() |
boolean |
isAutoStartup() |
protected boolean |
isNotPersistent()
Returns true when the user explicitly specified a value for the persistent attribute and it is false.
|
boolean |
isOffHeap()
Returns a boolean value indicating whether off-heap has been enabled for this
Region. |
protected boolean |
isPersistent()
Returns true when the user explicitly specified a value for the persistent attribute and it is true.
|
protected boolean |
isPersistentUnspecified()
Determines whether the user explicitly set the 'persistent' attribute or not.
|
boolean |
isRunning() |
protected <K,V> void |
mergePartitionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
org.apache.geode.cache.RegionAttributes<K,V> regionAttributes) |
protected <K,V> org.apache.geode.cache.RegionFactory<K,V> |
mergeRegionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
Intelligently merges the given RegionAttributes with the configuration setting of the RegionFactory.
|
protected org.apache.geode.cache.RegionFactory<K,V> |
postProcess(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
Post-process the
RegionFactory used to create the Region specified by
this RegionFactoryBean during initialization. |
protected void |
resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
Boolean persistent,
org.apache.geode.cache.DataPolicy dataPolicy)
=======
>>>>>>> c22ebe6...
|
protected void |
resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
Boolean persistent,
String dataPolicy)
Validates the configured Data Policy and may override it, taking into account the 'persistent' attribute
and constraints for the Region type.
|
void |
setAsyncEventQueues(org.apache.geode.cache.asyncqueue.AsyncEventQueue[] asyncEventQueues)
The list of AsyncEventQueues to use with this Region.
|
void |
setAttributes(org.apache.geode.cache.RegionAttributes<K,V> attributes)
Sets the region attributes used for the region used by this factory.
|
void |
setCacheListeners(org.apache.geode.cache.CacheListener<K,V>[] cacheListeners)
Sets the cache listeners used for the region used by this factory.
|
void |
setCacheLoader(org.apache.geode.cache.CacheLoader<K,V> cacheLoader)
Sets the cache loader used for the region used by this factory.
|
void |
setCacheWriter(org.apache.geode.cache.CacheWriter<K,V> cacheWriter)
Sets the cache writer used for the region used by this factory.
|
void |
setClose(boolean close)
Indicates whether the Region referred to by this factory bean will be closed on shutdown (default true).
|
void |
setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy)
Sets the DataPolicy of the Region.
|
void |
setDataPolicy(String dataPolicyName)
Deprecated.
as of 1.4.0, use setDataPolicy(:DataPolicy) instead.
|
void |
setDestroy(boolean destroy)
Indicates whether the Region referred to by this factory bean will be destroyed on shutdown (default false).
|
void |
setDiskStoreName(String diskStoreName)
Sets the name of Disk Store used for either overflow or persistence, or both.
|
void |
setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes) |
void |
setGatewaySenders(org.apache.geode.cache.wan.GatewaySender[] gatewaySenders) |
void |
setKeyConstraint(Class<K> keyConstraint) |
void |
setOffHeap(Boolean offHeap)
Sets whether to enable this
Region to store it's data in off-heap memory. |
void |
setPersistent(Boolean persistent) |
void |
setRegionConfigurers(List<RegionConfigurer> regionConfigurers)
Null-safe operation to set an
Iterable of RegionConfigurers used to apply
additional configuration to this RegionFactoryBean when using Annotation-based configuration. |
void |
setRegionConfigurers(RegionConfigurer... regionConfigurers)
Null-safe operation to set an array of
RegionConfigurers used to apply
additional configuration to this RegionFactoryBean when using Annotation-based configuration. |
void |
setScope(org.apache.geode.cache.Scope scope)
Sets the region scope.
|
void |
setShortcut(org.apache.geode.cache.RegionShortcut shortcut)
Configures the Region with a RegionShortcut.
|
void |
setValueConstraint(Class<V> valueConstraint) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
afterPropertiesSet, getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, loadSnapshot, postProcess, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshotgetBeanClassLoader, getBeanFactory, getBeanName, getLog, isSingleton, logDebug, logDebug, logInfo, logInfo, newLog, setBeanClassLoader, setBeanFactory, setBeanNameprotected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception
Region with the given name.createRegion in class RegionLookupFactoryBean<K,V>gemfireCache - reference to the GemFireCache.regionName - name of the new Region.Region with the given name.BeanInitializationException - by default unless a subclass overrides this method.ExceptionGemFireCache,
Regionprotected void applyRegionConfigurers(String regionName, RegionConfigurer... regionConfigurers)
RegionConfigurers
to this RegionFactoryBean.regionName - String containing the name of the Region.regionConfigurers - array of RegionConfigurers applied
to this RegionFactoryBean.RegionConfigurer,
applyRegionConfigurers(String, Iterable)protected void applyRegionConfigurers(String regionName, Iterable<RegionConfigurer> regionConfigurers)
regionName - String containing the name of the Region.regionConfigurers - Iterable of RegionConfigurers applied
to this RegionFactoryBean.RegionConfigurerprotected org.apache.geode.cache.RegionFactory<K,V> createRegionFactory(org.apache.geode.cache.Cache cache)
RegionFactory with the given Cache which is then used to construct,
configure and initialize the Region specified by this RegionFactoryBean.cache - reference to the Cache.RegionFactory used to construct, configure and initialized the Region specified by
this RegionFactoryBean.Cache.createRegionFactory(org.apache.geode.cache.RegionShortcut),
Cache.createRegionFactory(org.apache.geode.cache.RegionAttributes),
Cache.createRegionFactory(),
RegionFactoryprotected org.apache.geode.cache.RegionFactory<K,V> configure(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
RegionFactory based on the configuration settings of this RegionFactoryBean.regionFactory - RegionFactory to configureRegionFactory.RegionFactoryprotected org.apache.geode.cache.RegionFactory<K,V> postProcess(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
RegionFactory used to create the Region specified by
this RegionFactoryBean during initialization.
The RegionFactory has been already constructed, configured and initialized by
this RegionFactoryBean before this method gets invoked.regionFactory - RegionFactory used to create the Region.RegionFactory.RegionFactoryprotected RegionConfigurer getCompositeRegionConfigurer()
RegionConfigurer used to apply additional configuration
to this RegionFactoryBean on Spring container initialization.RegionConfigurer.RegionConfigurerprotected <K,V> org.apache.geode.cache.RegionFactory<K,V> mergeRegionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
K - the Class type fo the Region key.V - the Class type of the Region value.regionFactory - the GemFire RegionFactory used to configure and create the Region that is the product
of this RegionFactoryBean.regionAttributes - the RegionAttributes containing the Region configuration settings to merge to the
RegionFactory.isUserSpecifiedEvictionAttributes(org.apache.geode.cache.RegionAttributes),
validateRegionAttributes(org.apache.geode.cache.RegionAttributes),
RegionAttributes,
RegionFactoryprotected <K,V> void mergePartitionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
regionFactory - regionAttributes - protected boolean isPersistent()
isNotPersistent(),
isPersistentUnspecified()protected boolean isPersistentUnspecified()
isPersistent(),
isNotPersistent()protected boolean isNotPersistent()
isPersistent(),
isPersistentUnspecified()protected void assertDataPolicyAndPersistentAttributesAreCompatible(org.apache.geode.cache.DataPolicy resolvedDataPolicy)
resolvedDataPolicy - the GemFire Data Policy resolved form the Spring GemFire XML namespace configuration
meta-data.isPersistent(),
isNotPersistent(),
DataPolicyprotected void resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory, Boolean persistent, org.apache.geode.cache.DataPolicy dataPolicy)
regionFactory - the RegionFactory used by this FactoryBean to create and configure the Region.persistent - a boolean value indicating whether the Region should be persistent and persist it's
data to disk.dataPolicy - the configured Data Policy for the Region.resolveDataPolicy(org.apache.geode.cache.RegionFactory, Boolean, String),
DataPolicy,
RegionFactoryprotected void resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory, Boolean persistent, String dataPolicy)
regionFactory - the GemFire RegionFactory used to create the desired Region.persistent - a boolean value indicating whether the Region should persist it's data to disk.dataPolicy - requested Data Policy as set by the user in the Spring GemFire configuration meta-data.DataPolicy,
RegionFactorypublic void destroy()
throws Exception
Region.destroy in interface DisposableBeanException - if destroy fails.DisposableBeanpublic void setAsyncEventQueues(org.apache.geode.cache.asyncqueue.AsyncEventQueue[] asyncEventQueues)
asyncEventQueues - defined as Object for backwards compatibility with Gemfire 6.public void setAttributes(org.apache.geode.cache.RegionAttributes<K,V> attributes)
attributes - the attributes to set on a newly created regionpublic org.apache.geode.cache.RegionAttributes<K,V> getAttributes()
RegionAttributespublic void setCacheListeners(org.apache.geode.cache.CacheListener<K,V>[] cacheListeners)
setAttributes(RegionAttributes).cacheListeners - the cacheListeners to set on a newly created regionpublic void setCacheLoader(org.apache.geode.cache.CacheLoader<K,V> cacheLoader)
setAttributes(RegionAttributes).cacheLoader - the cacheLoader to set on a newly created regionpublic void setCacheWriter(org.apache.geode.cache.CacheWriter<K,V> cacheWriter)
setAttributes(RegionAttributes).cacheWriter - the cacheWriter to set on a newly created regionpublic void setClose(boolean close)
close - a boolean value indicating whether this Region should be closed on member shutdown.setDestroy(boolean)public void setDestroy(boolean destroy)
destroy - a boolean value indicating whether the Region is to be destroy on member shutdown.setDestroy(boolean)public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy)
dataPolicy - the GemFire DataPolicy to use when configuring the Region.@Deprecated public void setDataPolicy(String dataPolicyName)
dataPolicyName - the name of the DataPolicy (e.g. REPLICATE, PARTITION)setDataPolicy(org.apache.geode.cache.DataPolicy)public org.apache.geode.cache.DataPolicy getDataPolicy()
DataPolicypublic void setDiskStoreName(String diskStoreName)
diskStoreName - the name of the Disk Store bean in context used for overflow/persistence.public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes)
public void setGatewaySenders(org.apache.geode.cache.wan.GatewaySender[] gatewaySenders)
gatewaySenders - defined as Object for backward compatibility with
Gemfire 6public void setOffHeap(Boolean offHeap)
Region to store it's data in off-heap memory.offHeap - Boolean value indicating whether to enable off-heap memory for this Region.RegionFactory.setOffHeap(boolean)public Boolean getOffHeap()
Boolean value indicating whether off-heap memory was enabled for this Region.
Off-heap will be enabled if this method returns a non-null Boolean value that evaluates
to true.Boolean value indicating whether off-heap is enabled for this Region.public boolean isOffHeap()
Region.Region.getOffHeap()public void setPersistent(Boolean persistent)
public void setRegionConfigurers(RegionConfigurer... regionConfigurers)
RegionConfigurers used to apply
additional configuration to this RegionFactoryBean when using Annotation-based configuration.regionConfigurers - array of RegionConfigurers used to apply
additional configuration to this RegionFactoryBean.RegionConfigurer,
setRegionConfigurers(List)public void setRegionConfigurers(List<RegionConfigurer> regionConfigurers)
Iterable of RegionConfigurers used to apply
additional configuration to this RegionFactoryBean when using Annotation-based configuration.regionConfigurers - Iterable of RegionConfigurers used to apply
additional configuration to this RegionFactoryBean.RegionConfigurerpublic org.apache.geode.cache.Scope getScope()
public void setScope(org.apache.geode.cache.Scope scope)
setAttributes(RegionAttributes).scope - the region scopeScopepublic void setShortcut(org.apache.geode.cache.RegionShortcut shortcut)
shortcut - the RegionShortcut used to configure pre-defined default for the Region created
by this FactoryBean.RegionShortcutprotected final org.apache.geode.cache.RegionShortcut getShortcut()
public void stop(Runnable callback)
stop in interface SmartLifecyclepublic boolean isAutoStartup()
isAutoStartup in interface SmartLifecycleCopyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.