Spring Data for VMware GemFire
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:
-
GemFireCacheRegionFactoryBeanInitializingBeanAbstractFactoryBeanSupport
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETONFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInitializes thisResolvableRegionFactoryBeanafter properties have been set by the Spring container.createRegion(org.apache.geode.cache.GemFireCache cache, String regionName) Creates a newRegionwith the givenname.org.apache.geode.cache.GemFireCachegetCache()Returns a reference to theGemFireCacheused to create theRegion.Returns an object reference to theRegioncreated by thisResolvableRegionFactoryBean.Class<?>protected org.apache.geode.cache.Region<?,?> Returns a reference to the parentRegionmaking thisFactoryBeanrepresent a cacheSub-Region.Returns a reference to theRegionresolved by this SpringFactoryBeanduring the lookup operation; maybe a newRegion.booleanloadSnapshot(org.apache.geode.cache.Region<K, V> region) Loads data from the configuredsnapshotinto the givenRegion.postProcess(org.apache.geode.cache.Region<K, V> region) Post-process theRegioncreated by thisPeerRegionFactoryBean.Resolves the configurednameof theRegion.voidsetCache(org.apache.geode.cache.GemFireCache cache) Sets a reference to theGemFireCacheused to create theRegion.voidsetLookupEnabled(Boolean lookupEnabled) voidSets the name of the cacheRegionbased on the bean 'name' attribute.voidsetParent(org.apache.geode.cache.Region<?, ?> parent) Sets a reference to the parentRegionmaking thisFactoryBeanrepresent a cacheSub-Region.protected voidSets a reference to theRegionto be resolved by this SpringFactoryBean.voidsetRegionName(String regionName) Sets the name of the cacheRegion.voidsetSnapshot(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 thisResolvableRegionFactoryBeanafter properties have been set by the Spring container.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception- if initialization fails.- See Also:
-
InitializingBean.afterPropertiesSet()createRegion(GemFireCache, String)
-
resolveRegionName
Resolves the configurednameof theRegion.- Returns:
- a
Stringcontaining 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 newRegionwith the givenname. This method gets called when aRegionwith the specifiednamedoes not already exist. By default, this method implementation throws aBeanInitializationExceptionand it is expected thatsubclasseswill 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 configuredsnapshotinto the givenRegion.- Parameters:
region-Regionto 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 theRegioncreated by thisPeerRegionFactoryBean.- Parameters:
region-Regionto process.- See Also:
-
Region
-
getObject
Returns an object reference to theRegioncreated by thisResolvableRegionFactoryBean.- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<K>- Returns:
- an object reference to the
Regioncreated by thisResolvableRegionFactoryBean. - Throws:
Exception- See Also:
-
FactoryBean.getObject()RegiongetRegion()
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<K>- Returns:
- the
Classtype of theRegionproduced by thisResolvableRegionFactoryBean. - See Also:
-
FactoryBean.getObjectType()
-
getCache
public org.apache.geode.cache.GemFireCache getCache()Returns a reference to theGemFireCacheused to create theRegion.- Returns:
- a reference to the
GemFireCacheused to create theRegion. - See Also:
-
GemFireCache
-
setCache
public void setCache(org.apache.geode.cache.GemFireCache cache) Sets a reference to theGemFireCacheused to create theRegion.- Parameters:
cache- reference to theGemFireCache.- See Also:
-
GemFireCache
-
setLookupEnabled
-
getLookupEnabled
-
isLookupEnabled
public boolean isLookupEnabled() -
setName
Sets the name of the cacheRegionbased on the bean 'name' attribute. If noRegionis 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-Regionname.- See Also:
-
AbstractFactoryBeanSupport.setBeanName(String)Region.getFullPath()
-
setParent
public void setParent(@Nullable org.apache.geode.cache.Region<?, ?> parent) Sets a reference to the parentRegionmaking thisFactoryBeanrepresent 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 parentRegionmaking thisFactoryBeanrepresent a cacheSub-Region.- Returns:
- a reference to the parent
Region, or null if thisRegionis not aSub-Region. - See Also:
-
Region
-
setRegion
Sets a reference to theRegionto be resolved by this SpringFactoryBean.- Parameters:
region- reference to the resolvableRegion.- See Also:
-
Region
-
getRegion
Returns a reference to theRegionresolved by this SpringFactoryBeanduring the lookup operation; maybe a newRegion.- Returns:
- a reference to the
Regionresolved during lookup. - See Also:
-
Region
-
setRegionName
Sets the name of the cacheRegion. If noRegionis 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:
-