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

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

public class RegionLookupFactoryBean<K,V>
extends Object
implements FactoryBean<com.gemstone.gemfire.cache.Region<K,V>>, InitializingBean, BeanNameAware

Simple FactoryBean for retrieving generic GemFire Regions. If the region doesn't exist, an exception is thrown. For declaring and configuring new regions, see RegionFactoryBean.


Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
RegionLookupFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 com.gemstone.gemfire.cache.Region<K,V> getObject()
           
 Class<?> getObjectType()
           
protected  com.gemstone.gemfire.cache.Region<K,V> getRegion()
           
 boolean isSingleton()
           
protected  com.gemstone.gemfire.cache.Region<K,V> lookupFallback(com.gemstone.gemfire.cache.GemFireCache cache, String regionName)
          Fall back method in case the named region does not exist.
 void setBeanName(String name)
           
 void setCache(com.gemstone.gemfire.cache.GemFireCache cache)
          Sets the cache used for creating the region.
 void setName(String name)
          Sets the name of the cache region.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

RegionLookupFactoryBean

public RegionLookupFactoryBean()
Method Detail

afterPropertiesSet

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

lookupFallback

protected com.gemstone.gemfire.cache.Region<K,V> lookupFallback(com.gemstone.gemfire.cache.GemFireCache cache,
                                                                String regionName)
                                                         throws Exception
Fall back method in case the named region does not exist. By default, this implementation throws an exception.

Parameters:
cache - GemFire cache
regionName - region name
Throws:
Exception

getObject

public com.gemstone.gemfire.cache.Region<K,V> getObject()
                                                 throws Exception
Specified by:
getObject in interface FactoryBean<com.gemstone.gemfire.cache.Region<K,V>>
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean<com.gemstone.gemfire.cache.Region<K,V>>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<com.gemstone.gemfire.cache.Region<K,V>>

setBeanName

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

setCache

public void setCache(com.gemstone.gemfire.cache.GemFireCache 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)

getRegion

protected com.gemstone.gemfire.cache.Region<K,V> getRegion()