Package org.springframework.data.gemfire
Class ResolvableRegionFactoryBean<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>
- 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
- Direct Known Subclasses:
CacheTypeAwareRegionFactoryBean
,ConfigurableRegionFactoryBean
,LookupRegionFactoryBean
public abstract class ResolvableRegionFactoryBean<K,V>
extends AbstractFactoryBeanSupport<org.apache.geode.cache.Region<K,V>>
implements org.springframework.beans.factory.InitializingBean
Spring
FactoryBean
used to look up or create Regions
.
For declaring and configuring new client Regions
, see ClientRegionFactoryBean
.
For declaring and configuring new peer Regions
, see PeerRegionFactoryBean
and subclasses
.- See Also:
-
GemFireCache
Region
FactoryBean
InitializingBean
AbstractFactoryBeanSupport
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
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
(org.apache.geode.cache.GemFireCache cache, String regionName) Creates a newRegion
with the givenname
.org.apache.geode.cache.GemFireCache
getCache()
Returns a reference to theGemFireCache
used to create theRegion
.Returns an object reference to theRegion
created by thisResolvableRegionFactoryBean
.Class<?>
protected org.apache.geode.cache.Region<?,
?> Returns a reference to the parentRegion
making thisFactoryBean
represent a cacheSub-Region
.Returns a reference to theRegion
resolved by this SpringFactoryBean
during the lookup operation; maybe a newRegion
.boolean
loadSnapshot
(org.apache.geode.cache.Region<K, V> region) Loads data from the configuredsnapshot
into the givenRegion
.postProcess
(org.apache.geode.cache.Region<K, V> region) Post-process theRegion
created by thisPeerRegionFactoryBean
.Resolves the configuredname
of theRegion
.void
setCache
(org.apache.geode.cache.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
setParent
(org.apache.geode.cache.Region<?, ?> parent) Sets a reference to the parentRegion
making thisFactoryBean
represent a 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
(org.springframework.core.io.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, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, setBeanClassLoader, setBeanFactory, setBeanName
-
Field Details
-
CREATING_REGION_LOG_MESSAGE
- See Also:
-
REGION_FOUND_LOG_MESSAGE
- See Also:
-
REGION_NOT_FOUND_ERROR_MESSAGE
- See Also:
-
-
Constructor Details
-
ResolvableRegionFactoryBean
public ResolvableRegionFactoryBean()
-
-
Method Details
-
afterPropertiesSet
Initializes thisResolvableRegionFactoryBean
after properties have been set by the Spring container.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
- if initialization fails.- See Also:
-
InitializingBean.afterPropertiesSet()
createRegion(GemFireCache, String)
-
resolveRegionName
Resolves the configuredname
of theRegion
.- Returns:
- a
String
containing the name of theRegion
. - See Also:
-
Region.getName()
-
createRegion
protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache cache, String regionName) throws Exception 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. -
loadSnapshot
@NonNull protected org.apache.geode.cache.Region<K,V> loadSnapshot(@NonNull org.apache.geode.cache.Region<K, V> region) Loads data from the configuredsnapshot
into the givenRegion
.- Parameters:
region
-Region
to load; must not be null.- Returns:
- the given
Region
. - Throws:
RuntimeException
- if loading the snapshot fails.- See Also:
-
Region.loadSnapshot(InputStream)
Region
-
postProcess
Post-process theRegion
created by thisPeerRegionFactoryBean
.- Parameters:
region
-Region
to process.- See Also:
-
Region
-
getObject
Returns an object reference to theRegion
created by thisResolvableRegionFactoryBean
.- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<K>
- Returns:
- an object reference to the
Region
created by thisResolvableRegionFactoryBean
. - Throws:
Exception
- See Also:
-
FactoryBean.getObject()
Region
getRegion()
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<K>
- Returns:
- the
Class
type of theRegion
produced by thisResolvableRegionFactoryBean
. - See Also:
-
FactoryBean.getObjectType()
-
getCache
public org.apache.geode.cache.GemFireCache getCache()Returns a reference to theGemFireCache
used to create theRegion
.- Returns:
- a reference to the
GemFireCache
used to create theRegion
. - See Also:
-
GemFireCache
-
setCache
public void setCache(org.apache.geode.cache.GemFireCache cache) Sets a reference to theGemFireCache
used to create theRegion
.- Parameters:
cache
- reference to theGemFireCache
.- See Also:
-
GemFireCache
-
setLookupEnabled
-
getLookupEnabled
-
isLookupEnabled
public boolean isLookupEnabled() -
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:
-
AbstractFactoryBeanSupport.setBeanName(String)
Region.getFullPath()
-
setParent
public void setParent(@Nullable org.apache.geode.cache.Region<?, ?> parent) Sets a reference to the parentRegion
making thisFactoryBean
represent a cacheSub-Region
.- Parameters:
parent
- reference to the parentRegion
.- See Also:
-
Region
-
getParent
@Nullable protected org.apache.geode.cache.Region<?,?> getParent()Returns a reference to the parentRegion
making thisFactoryBean
represent a cacheSub-Region
.- Returns:
- a reference to the parent
Region
, or null if thisRegion
is not aSub-Region
. - See Also:
-
Region
-
setRegion
Sets a reference to theRegion
to be resolved by this SpringFactoryBean
.- Parameters:
region
- reference to the resolvableRegion
.- See Also:
-
Region
-
getRegion
Returns a reference to theRegion
resolved by this SpringFactoryBean
during the lookup operation; maybe a newRegion
.- Returns:
- a reference to the
Region
resolved during lookup. - See Also:
-
Region
-
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:
-
setName(String)
Region.getName()
-
setSnapshot
public void setSnapshot(@Nullable org.springframework.core.io.Resource snapshot) 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:
-