org.springframework.data.gemfire
Class RegionFactoryBean<K,V>

java.lang.Object
  extended by org.springframework.data.gemfire.RegionFactoryBean<K,V>
All Implemented Interfaces:
BeanNameAware, DisposableBean, FactoryBean<Region<K,V>>, InitializingBean
Direct Known Subclasses:
ClientRegionFactoryBean

public class RegionFactoryBean<K,V>
extends Object
implements DisposableBean, FactoryBean<Region<K,V>>, InitializingBean, BeanNameAware

FactoryBean for creating generic Gemfire Regions. Will try to first locate the region (by name) and, in case none if found, proceed to creating one using the given settings.

Author:
Costin Leau

Field Summary
protected  Log log
           
 
Constructor Summary
RegionFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 Region<K,V> getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
protected  void postProcess(Region<K,V> region)
          Post-process the region object for this factory bean during the initialization process.
 void setAttributes(RegionAttributes<K,V> attributes)
          Sets the region attributes used for the region used by this factory.
 void setBeanName(String beanName)
           
 void setCache(Cache cache)
          Sets the cache used for creating the region.
 void setCacheListeners(CacheListener<K,V>[] cacheListeners)
          Sets the cache listeners used for the region used by this factory.
 void setCacheLoader(CacheLoader<K,V> cacheLoader)
          Sets the cache loader used for the region used by this factory.
 void setCacheWriter(CacheWriter<K,V> cacheWriter)
          Sets the cache writer used for the region used by this factory.
 void setDataPolicy(DataPolicy dataPolicy)
          Sets the data policy.
 void setDestroy(boolean destroy)
          Indicates whether the region referred by this factory bean, will be destroyed on shutdown (default false).
 void setName(String name)
          Sets the name of the cache region.
 void setScope(Scope scope)
          Sets the region scope.
 void setSnapshot(Resource snapshot)
          Sets the snapshots used for loading a newly created region.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final Log log
Constructor Detail

RegionFactoryBean

public RegionFactoryBean()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

postProcess

protected void postProcess(Region<K,V> region)
Post-process the region object for this factory bean during the initialization process. The object is already initialized and configured by the factory bean before this method is invoked.

Parameters:
region -

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

getObject

public Region<K,V> getObject()
                      throws Exception
Specified by:
getObject in interface FactoryBean<Region<K,V>>
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean<Region<K,V>>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<Region<K,V>>

setBeanName

public void setBeanName(String beanName)
Specified by:
setBeanName in interface BeanNameAware

setCache

public void setCache(Cache cache)
Sets the cache used for creating the region.

Parameters:
cache - the cache to set
See Also:
CacheFactoryBean

setName

public void setName(String name)
Sets the name of the cache region. If no cache is found under the given name, a new one will be created. If no name is given, the beanName will be used.

Parameters:
name - the region name
See Also:
Region.getFullPath(), setBeanName(String)

setDestroy

public void setDestroy(boolean destroy)
Indicates whether the region referred by this factory bean, will be destroyed on shutdown (default false).

Parameters:
destroy - the destroy to set

setSnapshot

public void setSnapshot(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:
setName(String)

setCacheListeners

public void setCacheListeners(CacheListener<K,V>[] cacheListeners)
Sets the cache listeners used for the region used by this factory. Used only when a new region is created.Overrides the settings specified through setAttributes(RegionAttributes).

Parameters:
cacheListeners - the cacheListeners to set on a newly created region

setCacheLoader

public void setCacheLoader(CacheLoader<K,V> cacheLoader)
Sets the cache loader used for the region used by this factory. Used only when a new region is created.Overrides the settings specified through setAttributes(RegionAttributes).

Parameters:
cacheLoader - the cacheLoader to set on a newly created region

setCacheWriter

public void setCacheWriter(CacheWriter<K,V> cacheWriter)
Sets the cache writer used for the region used by this factory. Used only when a new region is created. Overrides the settings specified through setAttributes(RegionAttributes).

Parameters:
cacheWriter - the cacheWriter to set on a newly created region

setDataPolicy

public void setDataPolicy(DataPolicy dataPolicy)
Sets the data policy. Used only when a new region is created. Overrides the settings specified through setAttributes(RegionAttributes).

Parameters:
dataPolicy - the region data policy

setScope

public void setScope(Scope scope)
Sets the region scope. Used only when a new region is created. Overrides the settings specified through setAttributes(RegionAttributes).

Parameters:
scope - the region scope
See Also:
Scope

setAttributes

public void setAttributes(RegionAttributes<K,V> attributes)
Sets the region attributes used for the region used by this factory. Allows maximum control in specifying the region settings. Used only when a new region is created.

Parameters:
attributes - the attributes to set on a newly created region


Copyright © 2010 SpringSource, a division of VMware. All Rights Reserved.