org.springframework.data.gemfire.client
Class ClientRegionFactoryBean<K,V>

java.lang.Object
  extended by org.springframework.data.gemfire.RegionLookupFactoryBean<K,V>
      extended by org.springframework.data.gemfire.client.ClientRegionFactoryBean<K,V>
All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, FactoryBean<Region<K,V>>, InitializingBean

public class ClientRegionFactoryBean<K,V>
extends RegionLookupFactoryBean<K,V>
implements BeanFactoryAware, DisposableBean

Client extension for GemFire regions.


Constructor Summary
ClientRegionFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
protected  Region<K,V> lookupFallback(GemFireCache cache, String regionName)
          Fall back method in case the named region does not exist.
protected  void postProcess(Region<K,V> region)
           
 void setAttributes(RegionAttributes<K,V> attributes)
          Sets the region attributes used for the region used by this factory.
 void setBeanFactory(BeanFactory beanFactory)
           
 void setCacheListeners(CacheListener<K,V>[] cacheListeners)
          Sets the cache listeners used for the region used by this factory.
 void setClose(boolean close)
          Indicates whether the region referred by this factory bean, will be closed on shutdown (default true).
 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 setInterests(Interest<K>[] interests)
          Set the interests for this client region.
 void setPool(Pool pool)
          Sets the pool used by this client.
 void setPoolName(String poolName)
          Sets the pool name used by this client.
 void setShortcut(ClientRegionShortcut shortcut)
          Initializes the client using a GemFire ClientRegionShortcut.
 void setSnapshot(Resource snapshot)
          Sets the snapshots used for loading a newly created region.
 
Methods inherited from class org.springframework.data.gemfire.RegionLookupFactoryBean
getObject, getObjectType, getRegion, isSingleton, setBeanName, setCache, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientRegionFactoryBean

public ClientRegionFactoryBean()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class RegionLookupFactoryBean<K,V>
Throws:
Exception

lookupFallback

protected Region<K,V> lookupFallback(GemFireCache cache,
                                     String regionName)
                              throws Exception
Description copied from class: RegionLookupFactoryBean
Fall back method in case the named region does not exist. By default, this implementation throws an exception.

Overrides:
lookupFallback in class RegionLookupFactoryBean<K,V>
Parameters:
cache - GemFire cache
regionName - region name
Throws:
Exception

postProcess

protected void postProcess(Region<K,V> region)

destroy

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

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException
Specified by:
setBeanFactory in interface BeanFactoryAware
Throws:
BeansException

setInterests

public void setInterests(Interest<K>[] interests)
Set the interests for this client region. Both key and regex interest are supported.

Parameters:
interests - the interests to set

setPoolName

public void setPoolName(String poolName)
Sets the pool name used by this client.

Parameters:
poolName -

setPool

public void setPool(Pool pool)
Sets the pool used by this client.

Parameters:
pool -

setShortcut

public void setShortcut(ClientRegionShortcut shortcut)
Initializes the client using a GemFire ClientRegionShortcut. The recommended way for creating clients since it covers all the major scenarios with minimal configuration.

Parameters:
shortcut -

setDestroy

public void setDestroy(boolean destroy)
Indicates whether the region referred by this factory bean, will be destroyed on shutdown (default false). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.

Parameters:
destroy - whether or not to destroy the region
See Also:
setClose(boolean)

setClose

public void setClose(boolean close)
Indicates whether the region referred by this factory bean, will be closed on shutdown (default true). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.

Parameters:
close - whether to close or not the region
See Also:
setDestroy(boolean)

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:
RegionLookupFactoryBean.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

setDataPolicy

public void setDataPolicy(DataPolicy dataPolicy)
Sets the data policy. Used only when a new region is created.

Parameters:
dataPolicy - the region data policy

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. Note that using this method allows for advanced customization of the region - while it provides a lot of flexibility, note that it's quite easy to create misconfigured regions (especially in a client/server scenario).

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