Class ResolvableRegionFactoryBean<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>
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
Direct Known Subclasses:
CacheTypeAwareRegionFactoryBean, ConfigurableRegionFactoryBean, LookupRegionFactoryBean

public abstract class ResolvableRegionFactoryBean<K,V> extends AbstractFactoryBeanSupport<org.apache.geode.cache.Region<K,V>> implements org.springframework.beans.factory.InitializingBean
Spring FactoryBean used to look up or create Regions. For declaring and configuring new client Regions, see ClientRegionFactoryBean. For declaring and configuring new peer Regions, see PeerRegionFactoryBean and subclasses.
See Also:
  • Field Details

  • Constructor Details

    • ResolvableRegionFactoryBean

      public ResolvableRegionFactoryBean()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Initializes this ResolvableRegionFactoryBean after properties have been set by the Spring container.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception - if initialization fails.
      See Also:
    • resolveRegionName

      public String resolveRegionName()
      Resolves the configured name of the Region.
      Returns:
      a String containing the name of the Region.
      See Also:
      • Region.getName()
    • createRegion

      protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache cache, String regionName) throws Exception
      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.
      Parameters:
      cache - 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
    • loadSnapshot

      @NonNull protected org.apache.geode.cache.Region<K,V> loadSnapshot(@NonNull org.apache.geode.cache.Region<K,V> region)
      Loads data from the configured snapshot into the given Region.
      Parameters:
      region - Region to load; must not be null.
      Returns:
      the given Region.
      Throws:
      RuntimeException - if loading the snapshot fails.
      See Also:
      • Region.loadSnapshot(InputStream)
      • Region
    • postProcess

      protected org.apache.geode.cache.Region<K,V> postProcess(org.apache.geode.cache.Region<K,V> region)
      Post-process the Region created by this PeerRegionFactoryBean.
      Parameters:
      region - Region to process.
      See Also:
      • Region
    • getObject

      public org.apache.geode.cache.Region<K,V> getObject() throws Exception
      Returns an object reference to the Region created by this ResolvableRegionFactoryBean.
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<K>
      Returns:
      an object reference to the Region created by this ResolvableRegionFactoryBean.
      Throws:
      Exception
      See Also:
    • getObjectType

      public Class<?> getObjectType()
      Returns the Class type of the Region produced by this ResolvableRegionFactoryBean.
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<K>
      Returns:
      the Class type of the Region produced by this ResolvableRegionFactoryBean.
      See Also:
      • FactoryBean.getObjectType()
    • getCache

      public org.apache.geode.cache.GemFireCache getCache()
      Returns a reference to the GemFireCache used to create the Region.
      Returns:
      a reference to the GemFireCache used to create the Region.
      See Also:
      • GemFireCache
    • setCache

      public void setCache(org.apache.geode.cache.GemFireCache cache)
      Sets a reference to the GemFireCache used to create the Region.
      Parameters:
      cache - reference to the GemFireCache.
      See Also:
      • GemFireCache
    • setLookupEnabled

      public void setLookupEnabled(@Nullable Boolean lookupEnabled)
    • getLookupEnabled

      @Nullable public Boolean getLookupEnabled()
    • isLookupEnabled

      public boolean isLookupEnabled()
    • setName

      public void setName(@NonNull String name)
      Sets the name of the cache Region based on the bean 'name' attribute. If no Region is found with the given name, a new one will be created. If no name is given, the value of the 'beanName' property will be used.
      Parameters:
      name - Region name.
      See Also:
    • setParent

      public void setParent(@Nullable org.apache.geode.cache.Region<?,?> parent)
      Sets a reference to the parent Region making this FactoryBean represent a cache Sub-Region.
      Parameters:
      parent - reference to the parent Region.
      See Also:
      • Region
    • getParent

      @Nullable protected org.apache.geode.cache.Region<?,?> getParent()
      Returns a reference to the parent Region making this FactoryBean represent a cache Sub-Region.
      Returns:
      a reference to the parent Region, or null if this Region is not a Sub-Region.
      See Also:
      • Region
    • setRegion

      protected void setRegion(@Nullable org.apache.geode.cache.Region<K,V> region)
      Sets a reference to the Region to be resolved by this Spring FactoryBean.
      Parameters:
      region - reference to the resolvable Region.
      See Also:
      • Region
    • getRegion

      @Nullable public org.apache.geode.cache.Region<K,V> getRegion()
      Returns a reference to the Region resolved by this Spring FactoryBean during the lookup operation; maybe a new Region.
      Returns:
      a reference to the Region resolved during lookup.
      See Also:
      • Region
    • setRegionName

      public void setRegionName(@Nullable String regionName)
      Sets the name of the cache Region. If no Region is found with the given name, a new one will be created. If no name is given, the value of the 'name' property will be used.
      Parameters:
      regionName - name of the Region.
      See Also:
    • setSnapshot

      public void setSnapshot(@Nullable org.springframework.core.io.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: