org.springframework.data.gemfire.support
Class GemfireDaoSupport

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.data.gemfire.support.GemfireDaoSupport
All Implemented Interfaces:
InitializingBean

public class GemfireDaoSupport
extends DaoSupport

Convenient super class for GemFire data access objects. Intended for GemfireTemplate usage.

Requires a Region to be set, providing a GemfireTemplate based on it to subclasses. Can alternatively be initialized directly via a GemfireTemplate, to reuse the latter's settings.

This class will create its own GemfireTemplate if an Region reference is passed in. A custom GemfireTemplate instance can be used through overriding createGemfireTemplate.


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
GemfireDaoSupport()
           
 
Method Summary
protected  void checkDaoConfig()
           
protected  GemfireTemplate createGemfireTemplate(Region<?,?> region)
          Creates a GemfireTemplate for the given Region.
 GemfireTemplate getGemfireTemplate()
          Return the GemfireTemplate for this DAO, pre-initialized with the Region or set explicitly.
 void setGemfireTemplate(GemfireTemplate gemfireTemplate)
          Set the GemfireTemplate for this DAO explicitly, as an alternative to specifying a GemFire Region.
 void setRegion(Region<?,?> region)
          Sets the GemFire Region to be used by this DAO.
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GemfireDaoSupport

public GemfireDaoSupport()
Method Detail

setRegion

public void setRegion(Region<?,?> region)
Sets the GemFire Region to be used by this DAO. Will automatically create a GemfireTemplate for the given Region.

Parameters:
region -

createGemfireTemplate

protected GemfireTemplate createGemfireTemplate(Region<?,?> region)
Creates a GemfireTemplate for the given Region.

Can be overridden in subclasses to provide a GemfireTemplate instance with different configuration, or a custom GemfireTemplate subclass.

Parameters:
region - the GemFire Region to create a GemfireTemplate for
Returns:
the new GemfireTemplate instance
See Also:
setRegion(com.gemstone.gemfire.cache.Region)

setGemfireTemplate

public final void setGemfireTemplate(GemfireTemplate gemfireTemplate)
Set the GemfireTemplate for this DAO explicitly, as an alternative to specifying a GemFire Region.

See Also:
setRegion(com.gemstone.gemfire.cache.Region)

getGemfireTemplate

public final GemfireTemplate getGemfireTemplate()
Return the GemfireTemplate for this DAO, pre-initialized with the Region or set explicitly.


checkDaoConfig

protected final void checkDaoConfig()
Specified by:
checkDaoConfig in class DaoSupport