Class AbstractCacheConfiguration

java.lang.Object
org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport
org.springframework.data.gemfire.config.annotation.AbstractCacheConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.annotation.ImportAware, org.springframework.context.EnvironmentAware
Direct Known Subclasses:
ClientCacheConfiguration, PeerCacheConfiguration

@Configuration public abstract class AbstractCacheConfiguration extends AbstractAnnotationConfigSupport implements org.springframework.context.annotation.ImportAware
AbstractCacheConfiguration is an abstract base class for configuring either a Pivotal GemFire/Apache Geode client or peer-based cache instance using Spring's Java-based, Annotation Configuration support. This class encapsulates configuration settings common to both Pivotal GemFire/Apache Geode peer caches and client caches.
Since:
1.9.0
See Also:
  • Field Details

  • Constructor Details

    • AbstractCacheConfiguration

      public AbstractCacheConfiguration()
  • Method Details

    • gemfireProperties

      @Bean protected Properties gemfireProperties()
      Returns a Properties object containing Pivotal GemFire/Apache Geode properties used to configure the Pivotal GemFire/Apache Geode cache. The name of the Pivotal GemFire/Apache Geode member/node in the cluster is set to a default, pre-defined and descriptive value depending on the type of configuration meta-data applied. mcast-port is set to 0 and locators is set to an empty String, which is necessary for cache client-based applications. These values can be changed and set accordingly for peer cache and cache server applications. Finally, the log-level property defaults to config.
      Returns:
      a Properties object containing Pivotal GemFire/Apache Geode properties used to configure the Pivotal GemFire/Apache Geode cache instance.
      See Also:
    • setImportMetadata

      public void setImportMetadata(org.springframework.core.type.AnnotationMetadata importMetadata)
      Specified by:
      setImportMetadata in interface org.springframework.context.annotation.ImportAware
    • configureInfrastructure

      protected void configureInfrastructure(org.springframework.core.type.AnnotationMetadata importMetadata)
      Configures Spring container infrastructure components and beans used by Spring Data GemFire to enable Pivotal GemFire or Apache Geode to function properly inside a Spring context.
      Parameters:
      importMetadata - AnnotationMetadata containing annotation meta-data for the Spring Data GemFire cache application class.
      See Also:
      • AnnotationMetadata
    • configureCache

      protected void configureCache(org.springframework.core.type.AnnotationMetadata importMetadata)
      Configures Pivotal GemFire/Apache Geode cache specific settings.
      Parameters:
      importMetadata - AnnotationMetadata containing the cache meta-data used to configure the cache.
      See Also:
      • AnnotationMetadata
    • configureOptional

      protected void configureOptional(org.springframework.core.type.AnnotationMetadata importMetadata)
      Callback method allowing developers to configure other cache or application specific configuration settings.
      Parameters:
      importMetadata - AnnotationMetadata containing meta-data used to configure the cache or application.
      See Also:
      • AnnotationMetadata
    • constructCacheFactoryBean

      protected <T extends CacheFactoryBean> T constructCacheFactoryBean()
      Constructs a new, initialized instance of CacheFactoryBean based on the Spring application's cache type preference (i.e. client or peer), which is expressed via the appropriate annotation. Use the ClientCacheApplication Annotation to construct a cache client application. Use the PeerCacheApplication Annotation to construct a peer cache application.
      Type Parameters:
      T - Class specific sub-type of the CacheFactoryBean.
      Returns:
      a new instance of the appropriate CacheFactoryBean given the Spring application's cache type preference (i.e client or peer), (e.g. ClientCacheApplication or PeerCacheApplication).
      See Also:
    • newCacheFactoryBean

      protected abstract <T extends CacheFactoryBean> T newCacheFactoryBean()
      Constructs a new, uninitialized instance of CacheFactoryBean based on the Spring application's cache type preference (i.e. client or peer), which is expressed via the appropriate annotation. Use the ClientCacheApplication Annotation to construct a cache client application. Use the PeerCacheApplication Annotation to construct a peer cache application.
      Type Parameters:
      T - Class specific sub-type of the CacheFactoryBean.
      Returns:
      a new instance of the appropriate CacheFactoryBean given the Spring application's cache type preference (i.e client or peer), (e.g. ClientCacheApplication or PeerCacheApplication).
      See Also:
    • configureCacheFactoryBean

      protected <T extends CacheFactoryBean> T configureCacheFactoryBean(T gemfireCache)
      Configures the CacheFactoryBean with common cache configuration settings.
      Type Parameters:
      T - Class specific sub-type of the CacheFactoryBean.
      Parameters:
      gemfireCache - CacheFactoryBean to configure.
      Returns:
      the given CacheFactoryBean with common cache configuration settings applied.
      See Also:
    • isCacheServerApplication

      protected boolean isCacheServerApplication(org.springframework.core.type.AnnotationMetadata importMetadata)
      Determines whether this is a GemFire CacheServer application, which is indicated by the presence of the CacheServerApplication annotation on a Spring application @Configuration class.
      Parameters:
      importMetadata - AnnotationMetadata containing application configuration meta-data from the annotations used to configure the Spring application.
      Returns:
      a boolean value indicating whether this is a GemFire cache server application.
      See Also:
    • isClientCacheApplication

      protected boolean isClientCacheApplication(org.springframework.core.type.AnnotationMetadata importMetadata)
      Determines whether this is a GemFire ClientCache application, which is indicated by the presence of the ClientCacheApplication annotation on a Spring application @Configuration class.
      Parameters:
      importMetadata - AnnotationMetadata containing application configuration meta-data from the annotations used to configure the Spring application.
      Returns:
      a boolean value indicating whether this is a GemFire cache client application.
      See Also:
    • isPeerCacheApplication

      protected boolean isPeerCacheApplication(org.springframework.core.type.AnnotationMetadata importMetadata)
      Determines whether this is a GemFire peer Cache application, which is indicated by the presence of the PeerCacheApplication annotation on a Spring application @Configuration class.
      Parameters:
      importMetadata - AnnotationMetadata containing application configuration meta-data from the annotations used to configure the Spring application.
      Returns:
      a boolean value indicating whether this is a GemFire peer cache application.
      See Also:
    • isTypedCacheApplication

      protected boolean isTypedCacheApplication(Class<? extends Annotation> annotationType, org.springframework.core.type.AnnotationMetadata importMetadata)
      Determines whether this Spring application is annotated with the given GemFire cache type annotation.
      Parameters:
      annotationType - Annotation cache type.
      importMetadata - AnnotationMetadata containing application configuration meta-data from the annotations used to configure the Spring application.
      Returns:
      a boolean value indicating if this Spring application is annotated with the given GemFire cache type annotation.
      See Also:
    • isCacheServerOrPeerCacheApplication

      protected boolean isCacheServerOrPeerCacheApplication(org.springframework.core.type.AnnotationMetadata importMetadata)
      Determines whether this is a GemFire CacheServer or peer cache application, which is indicated by the presence of either the CacheServerApplication annotation or the PeerCacheApplication annotation on a Spring application @Configuration class.
      Parameters:
      importMetadata - AnnotationMetadata containing application configuration meta-data from the annotations used to configure the Spring application.
      Returns:
      a boolean value indicating whether this is a GemFire cache server or peer cache application.
      See Also:
    • isClientPeerOrServerCacheApplication

      protected boolean isClientPeerOrServerCacheApplication(org.springframework.core.type.AnnotationMetadata importMetadata)
      Determine whether this Spring application is a CacheServer, ClientCache or a Cache application.
      Parameters:
      importMetadata - AnnotationMetadata containing application configuration meta-data from the class type-level annotations used to configure the Spring application.
      Returns:
      a boolean value indicating whether this is a GemFire cache server, client cache or peer cache Spring application.
      See Also:
    • getCacheXml

      protected org.springframework.core.io.Resource getCacheXml()
    • isClose

      protected boolean isClose()
    • getCopyOnRead

      protected boolean getCopyOnRead()
    • getCriticalHeapPercentage

      protected Float getCriticalHeapPercentage()
    • getCriticalOffHeapPercentage

      protected Float getCriticalOffHeapPercentage()
    • getEvictionHeapPercentage

      protected Float getEvictionHeapPercentage()
    • getEvictionOffHeapPercentage

      protected Float getEvictionOffHeapPercentage()
    • getGatewayConflictResolver

      protected org.apache.geode.cache.util.GatewayConflictResolver getGatewayConflictResolver()
    • getJndiDataSources

      protected List<CacheFactoryBean.JndiDataSource> getJndiDataSources()
    • locators

      protected String locators()
    • logLevel

      protected String logLevel()
    • mcastPort

      protected Integer mcastPort()
    • name

      protected String name()
    • startLocator

      protected String startLocator()
    • getTransactionListeners

      protected List<org.apache.geode.cache.TransactionListener> getTransactionListeners()
    • getTransactionWriter

      protected org.apache.geode.cache.TransactionWriter getTransactionWriter()
    • useBeanFactoryLocator

      protected boolean useBeanFactoryLocator()
    • add

      public void add(Properties gemfireProperties)
    • toString

      public String toString()
      Overrides:
      toString in class Object