Class CacheTypeAwareRegionFactoryBean<K,V>

java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<org.apache.geode.cache.Region<K,V>>
org.springframework.data.gemfire.ResolvableRegionFactoryBean<K,V>
org.springframework.data.gemfire.config.annotation.support.CacheTypeAwareRegionFactoryBean<K,V>
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.Region<K,V>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>

public class CacheTypeAwareRegionFactoryBean<K,V> extends ResolvableRegionFactoryBean<K,V> implements EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, org.springframework.context.SmartLifecycle
The CacheTypeAwareRegionFactoryBean class is a smart Spring FactoryBean that knows how to create a client or server Region depending on whether the GemFireCache is a ClientCache or a peer Cache.
Since:
1.9.0
See Also:
  • Constructor Details

    • CacheTypeAwareRegionFactoryBean

      public CacheTypeAwareRegionFactoryBean()
  • Method Details

    • createRegion

      public org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception
      Description copied from class: ResolvableRegionFactoryBean
      Creates a new Region with the given name. This method gets called when a Region with the specified name does not already exist. By default, this method implementation throws a BeanInitializationException and it is expected that subclasses will override this method.
      Overrides:
      createRegion in class ResolvableRegionFactoryBean<K,V>
      Parameters:
      gemfireCache - reference to the GemFireCache.
      regionName - name of the new Region.
      Returns:
      a new Region with the given name.
      Throws:
      org.springframework.beans.factory.BeanInitializationException - by default unless a subclass overrides this method.
      Exception
      See Also:
      • GemFireCache
      • Region
    • newClientRegion

      protected org.apache.geode.cache.Region<K,V> newClientRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception
      Constructs, configures and initialize\s a new client Region using the ClientRegionFactoryBean.
      Parameters:
      gemfireCache - reference to the GemFireCache used to create/initialize the factory used to create the client Region.
      regionName - name given to the client Region.
      Returns:
      a new instance of a client Region with the given regionName.
      Throws:
      Exception - if the client Region could not be created.
      See Also:
    • newClientRegionFactoryBean

      protected <K, V> ClientRegionFactoryBean<K,V> newClientRegionFactoryBean()
      Constructs a new instance of the ClientRegionFactoryBean.
      Type Parameters:
      K - type of the created Region's key.
      V - type of the created Region's value.
      Returns:
      a new instance of the ClientRegionFactoryBean.
      See Also:
    • newServerRegion

      protected org.apache.geode.cache.Region<K,V> newServerRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) throws Exception
      Constructs, configures and initializes a new server Region using a sub-class of PeerRegionFactoryBean.
      Parameters:
      gemfireCache - reference to the GemFireCache used to create/initialize the factory used to create the server Region.
      regionName - name given to the server Region.
      Returns:
      a new instance of a server Region with the given regionName.
      Throws:
      Exception - if the server Region could not be created.
      See Also:
    • newPeerRegionFactoryBean

      protected PeerRegionFactoryBean<K,V> newPeerRegionFactoryBean()
      Constructs a sub-type of the PeerRegionFactoryBean class based on the getServerRegionShortcut() and getDataPolicy().
      Returns:
      a new instance of the PeerRegionFactoryBean.
      See Also:
    • configureEviction

      protected void configureEviction(EvictingRegionFactoryBean regionFactoryBean)
    • configureExpiration

      protected void configureExpiration(ExpiringRegionFactoryBean<K,V> regionFactoryBean)
    • setAttributes

      public void setAttributes(org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
    • getAttributes

      protected org.apache.geode.cache.RegionAttributes<K,V> getAttributes()
    • setClientRegionShortcut

      public void setClientRegionShortcut(org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut)
    • getClientRegionShortcut

      protected org.apache.geode.cache.client.ClientRegionShortcut getClientRegionShortcut()
    • setClose

      public void setClose(Boolean close)
    • getClose

      protected Boolean getClose()
    • isClose

      protected boolean isClose()
    • setCompressor

      public void setCompressor(org.apache.geode.compression.Compressor compressor)
      Configures the Compressor used to compress the this Region's data.
      Parameters:
      compressor - Compressor used to compress the this Region's data.
      See Also:
      • Compressor
    • getCompressor

      protected org.apache.geode.compression.Compressor getCompressor()
      Returns the configured Compressor used to compress the this Region's data.
      Returns:
      the configured Compressor used to compress the this Region's data.
      See Also:
      • Compressor
    • setCustomEntryIdleTimeout

      public void setCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K,V> customEntryIdleTimeout)
      Specified by:
      setCustomEntryIdleTimeout in interface ExpiringRegionFactoryBean<K,V>
    • getCustomEntryIdleTimeout

      protected org.apache.geode.cache.CustomExpiry<K,V> getCustomEntryIdleTimeout()
    • setCustomEntryTimeToLive

      public void setCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K,V> customEntryTimeToLive)
      Specified by:
      setCustomEntryTimeToLive in interface ExpiringRegionFactoryBean<K,V>
    • getCustomEntryTimeToLive

      protected org.apache.geode.cache.CustomExpiry<K,V> getCustomEntryTimeToLive()
    • setDataPolicy

      public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy)
    • getDataPolicy

      protected org.apache.geode.cache.DataPolicy getDataPolicy()
    • setDiskStoreName

      public void setDiskStoreName(String diskStoreName)
    • getDiskStoreName

      protected String getDiskStoreName()
    • setEvictionAttributes

      public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes)
      Specified by:
      setEvictionAttributes in interface EvictingRegionFactoryBean
    • getEvictionAttributes

      protected org.apache.geode.cache.EvictionAttributes getEvictionAttributes()
    • setEntryIdleTimeout

      public void setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout)
      Specified by:
      setEntryIdleTimeout in interface ExpiringRegionFactoryBean<K,V>
    • getEntryIdleTimeout

      protected org.apache.geode.cache.ExpirationAttributes getEntryIdleTimeout()
    • setEntryTimeToLive

      public void setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive)
      Specified by:
      setEntryTimeToLive in interface ExpiringRegionFactoryBean<K,V>
    • getEntryTimeToLive

      protected org.apache.geode.cache.ExpirationAttributes getEntryTimeToLive()
    • setInterests

      public void setInterests(Interest<K>[] interests)
    • getInterests

      protected Interest<K>[] getInterests()
    • setKeyConstraint

      public void setKeyConstraint(Class<K> keyConstraint)
    • getKeyConstraint

      protected Class<K> getKeyConstraint()
    • setOffHeap

      public void setOffHeap(Boolean offHeap)
      Configure the Region to manage data in Off-Heap Memory.
      Parameters:
      offHeap - boolean value indicating whether the Region's data will be managed in Off-Heap Memory.
    • getOffHeap

      protected Boolean getOffHeap()
      Return the configuration setting for whether the Region's data will be managed in Off-Heap Memory.
      Returns:
      a boolean value indicating whether the Region's data will be managed in Off-Heap Memory.
    • setPoolName

      public void setPoolName(String poolName)
    • getPoolName

      protected Optional<String> getPoolName()
    • resolvePoolName

      protected String resolvePoolName()
    • setRegionConfigurers

      public void setRegionConfigurers(RegionConfigurer... regionConfigurers)
      Null-safe operation used to set an array of RegionConfigurers used to apply additional configuration to this ResolvableRegionFactoryBean when using Annotation-based configuration.
      Parameters:
      regionConfigurers - array of RegionConfigurers used to apply additional configuration to this ResolvableRegionFactoryBean.
      See Also:
    • setRegionConfigurers

      public void setRegionConfigurers(List<RegionConfigurer> regionConfigurers)
      Null-safe operation used to set an Iterable of RegionConfigurers used to apply additional configuration to this ResolvableRegionFactoryBean when using Annotation-based configuration.
      Parameters:
      regionConfigurers - Iterable of RegionConfigurers used to apply additional configuration to this ResolvableRegionFactoryBean.
      See Also:
    • setRegionIdleTimeout

      public void setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout)
      Specified by:
      setRegionIdleTimeout in interface ExpiringRegionFactoryBean<K,V>
    • getRegionIdleTimeout

      protected org.apache.geode.cache.ExpirationAttributes getRegionIdleTimeout()
    • setRegionTimeToLive

      public void setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive)
      Specified by:
      setRegionTimeToLive in interface ExpiringRegionFactoryBean<K,V>
    • getRegionTimeToLive

      protected org.apache.geode.cache.ExpirationAttributes getRegionTimeToLive()
    • setScope

      public void setScope(org.apache.geode.cache.Scope scope)
    • getScope

      protected org.apache.geode.cache.Scope getScope()
    • setServerRegionShortcut

      public void setServerRegionShortcut(org.apache.geode.cache.RegionShortcut shortcut)
    • getServerRegionShortcut

      protected org.apache.geode.cache.RegionShortcut getServerRegionShortcut()
    • getSmartLifecycleComponent

      protected Optional<org.springframework.context.SmartLifecycle> getSmartLifecycleComponent()
    • setStatisticsEnabled

      public void setStatisticsEnabled(Boolean statisticsEnabled)
    • getStatisticsEnabled

      public Boolean getStatisticsEnabled()
    • setValueConstraint

      public void setValueConstraint(Class<V> valueConstraint)
    • getValueConstraint

      protected Class<V> getValueConstraint()
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle