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 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.- Author:
- Costin Leau, John Blum
- See Also:
-
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(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 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.voidprotected 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, 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 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; must not be null.- Returns:
- the given
Region. - Throws:
RuntimeException- if loading the snapshot 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:
-
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:
-
setParent
-
getParent
- Returns:
- a reference to the parent
Region, or 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:
-