public abstract class ResolvableRegionFactoryBean<K,V> extends AbstractFactoryBeanSupport<org.apache.geode.cache.Region<K,V>> implements InitializingBean
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
.GemFireCache
,
Region
,
FactoryBean
,
InitializingBean
,
AbstractFactoryBeanSupport
Modifier and Type | Field and Description |
---|---|
protected static String |
CREATING_REGION_LOG_MESSAGE |
protected static String |
REGION_FOUND_LOG_MESSAGE |
protected static String |
REGION_NOT_FOUND_ERROR_MESSAGE |
DEFAULT_SINGLETON
OBJECT_TYPE_ATTRIBUTE
Constructor and Description |
---|
ResolvableRegionFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Initializes this
ResolvableRegionFactoryBean after properties have been set by the Spring container. |
protected org.apache.geode.cache.Region<K,V> |
createRegion(org.apache.geode.cache.GemFireCache cache,
String regionName)
Creates a new
Region with the given name . |
org.apache.geode.cache.GemFireCache |
getCache()
Returns a reference to the
GemFireCache used to create the Region . |
Boolean |
getLookupEnabled() |
org.apache.geode.cache.Region<K,V> |
getObject()
Returns an object reference to the
Region created by this ResolvableRegionFactoryBean . |
Class<?> |
getObjectType()
|
protected org.apache.geode.cache.Region<?,?> |
getParent()
|
org.apache.geode.cache.Region<K,V> |
getRegion()
Returns a reference to the
Region resolved by this Spring FactoryBean
during the lookup operation; maybe a new Region . |
boolean |
isLookupEnabled() |
protected org.apache.geode.cache.Region<K,V> |
loadSnapshot(org.apache.geode.cache.Region<K,V> region)
Loads data from the configured
snapshot into the given Region . |
protected org.apache.geode.cache.Region<K,V> |
postProcess(org.apache.geode.cache.Region<K,V> region)
Post-process the
Region created by this PeerRegionFactoryBean . |
String |
resolveRegionName()
Resolves the configured
name of the Region . |
void |
setCache(org.apache.geode.cache.GemFireCache cache)
Sets a reference to the
GemFireCache used to create the Region . |
void |
setLookupEnabled(Boolean lookupEnabled) |
void |
setName(String name)
Sets the name of the cache
Region based on the bean 'name' attribute. |
void |
setParent(org.apache.geode.cache.Region<?,?> parent)
|
protected void |
setRegion(org.apache.geode.cache.Region<K,V> region)
Sets a reference to the
Region to be resolved by this Spring FactoryBean . |
void |
setRegionName(String regionName)
Sets the name of the cache
Region . |
void |
setSnapshot(Resource snapshot)
Sets the snapshots used for loading a newly created region.
|
getBeanClassLoader, getBeanFactory, getBeanName, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, setBeanClassLoader, setBeanFactory, setBeanName
protected static final String CREATING_REGION_LOG_MESSAGE
protected static final String REGION_FOUND_LOG_MESSAGE
protected static final String REGION_NOT_FOUND_ERROR_MESSAGE
public void afterPropertiesSet() throws Exception
ResolvableRegionFactoryBean
after properties have been set by the Spring container.afterPropertiesSet
in interface InitializingBean
Exception
- if initialization fails.InitializingBean.afterPropertiesSet()
,
createRegion(GemFireCache, String)
public String resolveRegionName()
name
of the Region
.String
containing the name of the Region
.Region.getName()
protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache cache, String regionName) throws Exception
Region
with the given name
.
This method gets called when a Region
with the specified name
does not already exist.
By default, this method implementation throws a BeanInitializationException
and it is expected
that subclasses
will override this method.cache
- reference to the GemFireCache
.regionName
- name
of the new Region
.Region
with the given name
.BeanInitializationException
- by default unless a subclass
overrides this method.Exception
GemFireCache
,
Region
@NonNull protected org.apache.geode.cache.Region<K,V> loadSnapshot(@NonNull org.apache.geode.cache.Region<K,V> region)
snapshot
into the given Region
.region
- Region
to load; must not be null.Region
.RuntimeException
- if loading the snapshot fails.Region.loadSnapshot(InputStream)
,
Region
protected org.apache.geode.cache.Region<K,V> postProcess(org.apache.geode.cache.Region<K,V> region)
Region
created by this PeerRegionFactoryBean
.region
- Region
to process.Region
public org.apache.geode.cache.Region<K,V> getObject() throws Exception
Region
created by this ResolvableRegionFactoryBean
.getObject
in interface FactoryBean<org.apache.geode.cache.Region<K,V>>
Region
created by this ResolvableRegionFactoryBean
.Exception
FactoryBean.getObject()
,
Region
,
getRegion()
public Class<?> getObjectType()
getObjectType
in interface FactoryBean<org.apache.geode.cache.Region<K,V>>
Class
type of the Region
produced by this ResolvableRegionFactoryBean
.FactoryBean.getObjectType()
public org.apache.geode.cache.GemFireCache getCache()
GemFireCache
used to create the Region
.GemFireCache
used to create the Region
.GemFireCache
public void setCache(org.apache.geode.cache.GemFireCache cache)
GemFireCache
used to create the Region
.cache
- reference to the GemFireCache
.GemFireCache
public boolean isLookupEnabled()
public void setName(@NonNull String name)
Region
based on the bean 'name' attribute. If no Region
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.name
- Region
name.AbstractFactoryBeanSupport.setBeanName(String)
,
Region.getFullPath()
public void setParent(@Nullable org.apache.geode.cache.Region<?,?> parent)
parent
- reference to the parent Region
.Region
@Nullable protected org.apache.geode.cache.Region<?,?> getParent()
Region
, or null if this Region
is not a Sub-Region
.Region
protected void setRegion(@Nullable org.apache.geode.cache.Region<K,V> region)
Region
to be resolved by this Spring FactoryBean
.region
- reference to the resolvable Region
.Region
@Nullable public org.apache.geode.cache.Region<K,V> getRegion()
Region
resolved by this Spring FactoryBean
during the lookup operation; maybe a new Region
.Region
resolved during lookup.Region
public void setRegionName(@Nullable String regionName)
Region
. If no Region
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.regionName
- name of the Region
.setName(String)
,
Region.getName()
public void setSnapshot(@Nullable Resource snapshot)
snapshot
- the snapshot to setsetName(String)
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.