Package org.springframework.data.gemfire
Class ResolvableRegionFactoryBean<K,V>
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<Region<K,V>>
org.springframework.data.gemfire.ResolvableRegionFactoryBean<K,V>
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanNameAware
,FactoryBean<Region<K,
,V>> InitializingBean
- Direct Known Subclasses:
CacheTypeAwareRegionFactoryBean
,ConfigurableRegionFactoryBean
,LookupRegionFactoryBean
public abstract class ResolvableRegionFactoryBean<K,V>
extends AbstractFactoryBeanSupport<Region<K,V>>
implements InitializingBean
Spring
FactoryBean
for looking up Regions
.
If lookups are disabled or the Region
does not exist, an exception is thrown.
For declaring and configuring new Regions, see PeerRegionFactoryBean
.- Author:
- Costin Leau, John Blum
- See Also:
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETON
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Initializes thisResolvableRegionFactoryBean
after properties have been set by the Spring container.createRegion
(GemFireCache cache, String regionName) getCache()
Returns a reference to theGemFireCache
used to create theRegion
.Returns an object reference to theRegion
created by thisResolvableRegionFactoryBean
.Class<?>
protected Region<?,
?> Returns a reference to the parentRegion
indicating thisFactoryBean
represents a GemFire cacheSub-Region
.Returns a reference to theRegion
resolved by this SpringFactoryBean
during the lookup operation; maybe a newRegion
.boolean
loadSnapshot
(Region<K, V> region) postProcess
(Region<K, V> region) Post-process theRegion
created by thisPeerRegionFactoryBean
.void
setCache
(GemFireCache cache) Sets a reference to theGemFireCache
used to create theRegion
.void
setLookupEnabled
(Boolean lookupEnabled) void
Sets the name of the cacheRegion
based on the bean 'name' attribute.void
Sets a reference to the parentRegion
to indicated thisFactoryBean
represents a GemFire cacheSub-Region
.protected void
Sets a reference to theRegion
to be resolved by this SpringFactoryBean
.void
setRegionName
(String regionName) Sets the name of the cacheRegion
.void
setSnapshot
(Resource snapshot) Sets the snapshots used for loading a newly created region.Methods inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
getBeanClassLoader, getBeanFactory, getBeanName, getLog, getOptionalLog, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLog, setBeanClassLoader, setBeanFactory, setBeanName
-
Constructor Details
-
ResolvableRegionFactoryBean
public ResolvableRegionFactoryBean()
-
-
Method Details
-
afterPropertiesSet
Initializes thisResolvableRegionFactoryBean
after properties have been set by the Spring container.- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
- if initialization fails.- See Also:
-
resolveRegionName
-
createRegion
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.- Parameters:
cache
- reference to theGemFireCache
.regionName
-name
of the newRegion
.- Returns:
- a new
Region
with the givenname
. - Throws:
BeanInitializationException
- by default unless asubclass
overrides this method.Exception
- See Also:
-
loadSnapshot
- Parameters:
region
-Region
to load.- Returns:
- the given
Region
. - Throws:
RuntimeException
- if the snapshot load fails.- See Also:
-
postProcess
Post-process theRegion
created by thisPeerRegionFactoryBean
. -
getObject
Returns an object reference to theRegion
created by thisResolvableRegionFactoryBean
.- Specified by:
getObject
in interfaceFactoryBean<K>
- Returns:
- an object reference to the
Region
created by thisResolvableRegionFactoryBean
. - Throws:
Exception
- See Also:
-
getObjectType
- Specified by:
getObjectType
in interfaceFactoryBean<K>
- Returns:
- the
Class
type of theRegion
produced by thisResolvableRegionFactoryBean
. - See Also:
-
getCache
Returns a reference to theGemFireCache
used to create theRegion
.- Returns:
- a reference to the
GemFireCache
used to create theRegion
.. - See Also:
-
setCache
Sets a reference to theGemFireCache
used to create theRegion
.- Parameters:
cache
- reference to theGemFireCache
.- See Also:
-
isLookupEnabled
public boolean isLookupEnabled() -
setLookupEnabled
-
getLookupEnabled
-
setName
Sets the name of the cacheRegion
based on the bean 'name' attribute. If noRegion
is found with the given name, a new one will be created. If no name is given, the value of the 'beanName' property will be used.- Parameters:
name
-Region
name.- See Also:
-
setParent
Sets a reference to the parentRegion
to indicated thisFactoryBean
represents a GemFire cacheSub-Region
. -
getParent
Returns a reference to the parentRegion
indicating thisFactoryBean
represents a GemFire cacheSub-Region
.- Returns:
- a reference to the parent
Region
or null if thisRegion
is not aSub-Region
. - See Also:
-
setRegion
Sets a reference to theRegion
to be resolved by this SpringFactoryBean
. -
getRegion
Returns a reference to theRegion
resolved by this SpringFactoryBean
during the lookup operation; maybe a newRegion
. -
setRegionName
Sets the name of the cacheRegion
. If noRegion
is found with the given name, a new one will be created. If no name is given, the value of the 'name' property will be used.- Parameters:
regionName
- name of theRegion
.- See Also:
-
setSnapshot
Sets the snapshots used for loading a newly created region. That is, the snapshot will be used only when a new region is created - if the region already exists, no loading will be performed.- Parameters:
snapshot
- the snapshot to set- See Also:
-