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_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(GemFireCache cache, String regionName) getCache()Returns a reference to theGemFireCacheused to create theRegion.Returns an object reference to theRegioncreated by thisResolvableRegionFactoryBean.Class<?>protected Region<?,?> Returns a reference to the parentRegionindicating thisFactoryBeanrepresents a GemFire cacheSub-Region.Returns a reference to theRegionresolved by this SpringFactoryBeanduring the lookup operation; maybe a newRegion.booleanloadSnapshot(Region<K, V> region) postProcess(Region<K, V> region) Post-process theRegioncreated by thisPeerRegionFactoryBean.voidsetCache(GemFireCache cache) Sets a reference to theGemFireCacheused to create theRegion.voidsetLookupEnabled(Boolean lookupEnabled) voidSets the name of the cacheRegionbased on the bean 'name' attribute.voidSets a reference to the parentRegionto indicated thisFactoryBeanrepresents a GemFire cacheSub-Region.protected voidSets a reference to theRegionto be resolved by this SpringFactoryBean.voidsetRegionName(String regionName) Sets the name of the cacheRegion.voidsetSnapshot(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 thisResolvableRegionFactoryBeanafter properties have been set by the Spring container.- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception- if initialization fails.- See Also:
-
resolveRegionName
-
createRegion
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.- Parameters:
cache- reference to theGemFireCache.regionName-nameof the newRegion.- Returns:
- a new
Regionwith the givenname. - Throws:
BeanInitializationException- by default unless asubclassoverrides this method.Exception- See Also:
-
loadSnapshot
- Parameters:
region-Regionto load.- Returns:
- the given
Region. - Throws:
RuntimeException- if the snapshot load fails.- See Also:
-
postProcess
Post-process theRegioncreated by thisPeerRegionFactoryBean. -
getObject
Returns an object reference to theRegioncreated by thisResolvableRegionFactoryBean.- Specified by:
getObjectin interfaceFactoryBean<K>- Returns:
- an object reference to the
Regioncreated by thisResolvableRegionFactoryBean. - Throws:
Exception- See Also:
-
getObjectType
- Specified by:
getObjectTypein interfaceFactoryBean<K>- Returns:
- the
Classtype of theRegionproduced by thisResolvableRegionFactoryBean. - See Also:
-
getCache
Returns a reference to theGemFireCacheused to create theRegion.- Returns:
- a reference to the
GemFireCacheused to create theRegion.. - See Also:
-
setCache
Sets a reference to theGemFireCacheused to create theRegion.- Parameters:
cache- reference to theGemFireCache.- See Also:
-
isLookupEnabled
public boolean isLookupEnabled() -
setLookupEnabled
-
getLookupEnabled
-
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:
-
setParent
Sets a reference to the parentRegionto indicated thisFactoryBeanrepresents a GemFire cacheSub-Region. -
getParent
Returns a reference to the parentRegionindicating thisFactoryBeanrepresents a GemFire cacheSub-Region.- Returns:
- a reference to the parent
Regionor null if thisRegionis not aSub-Region. - See Also:
-
setRegion
Sets a reference to theRegionto be resolved by this SpringFactoryBean. -
getRegion
Returns a reference to theRegionresolved by this SpringFactoryBeanduring the lookup operation; maybe a newRegion. -
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:
-
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:
-