Class IndexFactoryBean

java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<org.apache.geode.cache.query.Index>
org.springframework.data.gemfire.IndexFactoryBean
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.query.Index>, org.springframework.beans.factory.InitializingBean

public class IndexFactoryBean extends AbstractFactoryBeanSupport<org.apache.geode.cache.query.Index> implements org.springframework.beans.factory.InitializingBean
Spring FactoryBean used to construct, configure and initialize an Index.
Since:
1.0.0
See Also:
  • Field Details

  • Constructor Details

    • IndexFactoryBean

      public IndexFactoryBean()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • applyIndexConfigurers

      protected void applyIndexConfigurers(String indexName, IndexConfigurer... indexConfigurers)
      Null-safe operation to apply the given array of IndexConfigurers to this IndexFactoryBean.
      Parameters:
      indexName - String containing the name of the Index.
      indexConfigurers - array of IndexConfigurers applied to this IndexFactoryBean.
      See Also:
    • applyIndexConfigurers

      protected void applyIndexConfigurers(String indexName, Iterable<IndexConfigurer> indexConfigurers)
      Null-safe operation to apply the given Iterable of IndexConfigurers to this IndexFactoryBean.
      Parameters:
      indexName - String containing the name of the Index.
      indexConfigurers - Iterable of IndexConfigurers applied to this IndexFactoryBean.
      See Also:
    • getCompositeIndexConfigurer

      protected IndexConfigurer getCompositeIndexConfigurer()
      Returns a reference to the Composite IndexConfigurer used to apply additional configuration to this IndexFactoryBean on Spring container initialization.
      Returns:
      the Composite IndexConfigurer.
      See Also:
    • getIndex

      public org.apache.geode.cache.query.Index getIndex()
      Returns a reference to the Index created by this IndexFactoryBean.
      Returns:
      a reference to the Index created by this IndexFactoryBean.
      See Also:
      • Index
    • getObject

      public org.apache.geode.cache.query.Index getObject()
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.query.Index>
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.query.Index>
    • setCache

      public void setCache(org.apache.geode.cache.RegionService cache)
      Sets a reference to the RegionService.
      Parameters:
      cache - reference to the RegionService.
      See Also:
      • RegionService
    • setName

      public void setName(String name)
      Sets the name of the Index.
      Parameters:
      name - String containing the name given to the Index.
    • setQueryService

      public void setQueryService(org.apache.geode.cache.query.QueryService service)
      Sets the QueryService used to create the Index.
      Parameters:
      service - QueryService used to create the Index.
      See Also:
      • QueryService
    • setDefine

      public void setDefine(boolean define)
      Sets a boolean condition to indicate whether the Index declared and defined by this IndexFactoryBean will only be defined initially, or defined and created. If defined-only, the IndexFactoryBean will receive a callback at the end of the Spring container lifecycle to subsequently "create" all "defined-only" Indexes once, in a single operation.
      Parameters:
      define - a boolean value indicating the define or define/create status. If true, the Index declared by this IndexFactoryBean will only be defined initially and subsequently created when this bean receives an appropriate callback from the Spring container; if false, the Index will be created immediately.
    • isDefine

      protected boolean isDefine()
      Returns a boolean indicating whether the Index declared and defined by this IndexFactoryBean will only be defined initially, or defined and created. If defined-only, the IndexFactoryBean will receive a callback at the end of the Spring container lifecycle to subsequently "create" all "defined-only" Indexes once, in a single operation.
      Returns:
      a boolean value indicating the define or define/create status. If true, the Index declared by this IndexFactoryBean will only be defined initially and subsequently created when this bean receives an appropriate callback from the Spring container; if false, the Index will be created immediately.
    • setExpression

      public void setExpression(String expression)
      Parameters:
      expression - Index expression to set
    • setFrom

      public void setFrom(String from)
      Parameters:
      from - Index from clause to set
    • setImports

      public void setImports(String imports)
      Parameters:
      imports - Index imports to set
    • setIgnoreIfExists

      public void setIgnoreIfExists(boolean ignore)
      Configures whether to ignore the Index defined by this IndexFactoryBean when an IndexExistsException or IndexNameConflictException is thrown. An IndexExistsException is thrown when there exists another Index with the same definition but with another name. An IndexNameConflictException is thrown when there exists another Index with the same name but possibly a different definition. When ignoreIfExists is set to true and an IndexExistsException is thrown, then the existing Index will be returned as the object of this IndexFactoryBean creation and the name of the existing Index is added as an alias for this bean. When ignoreIfExists is set to true and IndexNameConflictException is thrown, then the existing Index will be returned as the object of this IndexFactoryBean creation. A warning is logged if the definition of this IndexFactoryBean and the existing Index are different. ignoreIfExists takes precedence over override. Defaults to false.
      Parameters:
      ignore - boolean value indicating whether to ignore the Index defined by this IndexFactoryBean. Default is false.
      See Also:
    • isIgnoreIfExists

      public boolean isIgnoreIfExists()
      Determines whether to ignore the Index defined by this IndexFactoryBean when an IndexExistsException or IndexNameConflictException is thrown. An IndexExistsException is thrown when there exists another Index with the same definition but with another name. An IndexNameConflictException is thrown when there exists another Index with the same name but possibly a different definition. When ignoreIfExists is set to true and an IndexExistsException is thrown, then the existing Index will be returned as the object of this IndexFactoryBean creation and the name of the existing Index is added as an alias for this bean. When ignoreIfExists is set to true and IndexNameConflictException is thrown, then the existing Index will be returned as the object of this IndexFactoryBean creation. A warning is logged if the definition of this IndexFactoryBean and the existing Index are different. ignoreIfExists takes precedence over override. Defaults to false.
      Returns:
      a boolean value indicating whether to ignore the Index defined by this IndexFactoryBean. Default is false.
      See Also:
    • setIndexConfigurers

      public void setIndexConfigurers(IndexConfigurer... indexConfigurers)
      Null-safe operation to set an array of IndexConfigurers used to apply additional configuration to this IndexFactoryBean when using Annotation-based configuration.
      Parameters:
      indexConfigurers - array of IndexConfigurers used to apply additional configuration to this IndexFactoryBean.
      See Also:
    • setIndexConfigurers

      public void setIndexConfigurers(List<IndexConfigurer> indexConfigurers)
      Null-safe operation to set an Iterable of IndexConfigurers used to apply additional configuration to this IndexFactoryBean when using Annotation-based configuration.
      Parameters:
      indexConfigurers - Iterable of IndexConfigurers used to apply additional configuration to this IndexFactoryBean.
      See Also:
    • setOverride

      public void setOverride(boolean override)
      Configures whether to override an existing Index having the same definition but different name as the Index that would be created by this IndexFactoryBean. An IndexExistsException is thrown when there exists another Index with the same definition but with another name. An IndexNameConflictException is thrown when there exists another Index with the same name but possibly a different definition. With override set to true when an IndexExistsException is thrown, then override is effectively the same as "renaming" the existing Index. In other words, the existing Index will be removed and recreated by this IndexFactoryBean under the new name having the same definition. With override set to true when an IndexNameConflictException is thrown, then overriding the existing Index is equivalent to changing the existing Index definition. When this happens, a warning is logged. If the existing Index definition is the same then overriding effectively just rebuilds the Index. ignoreIfExists takes precedence over override. Defaults to false.
      Parameters:
      override - boolean value indicating whether an existing Index will be removed and recreated by this IndexFactoryBean. Default is false.
      See Also:
    • isOverride

      public boolean isOverride()
      Determines whether to override an existing Index having the same definition but different name as the Index that would be created by this IndexFactoryBean. An IndexExistsException is thrown when there exists another Index with the same definition but with another name. An IndexNameConflictException is thrown when there exists another Index with the same name but possibly a different definition. With override set to true when an IndexExistsException is thrown, then override is effectively the same as "renaming" the existing Index. In other words, the existing Index will be removed and recreated by this IndexFactoryBean under the new name having the same definition. With override set to true when an IndexNameConflictException is thrown, then overriding the existing Index is equivalent to changing the existing Index definition. When this happens, a warning is logged. If the existing Index definition is the same then overriding effectively just rebuilds the Index. ignoreIfExists takes precedence over override. Defaults to false.
      Returns:
      a boolean value indicating whether an existing Index will be removed and recreated by this IndexFactoryBean. Default is false.
      See Also:
    • setType

      public void setType(String type)
      Set the type of the Index as a String.
      Parameters:
      type - String specifying the type of the Index.
      See Also:
    • setType

      public void setType(IndexType type)
      Set the type of the Index.
      Parameters:
      type - IndexType indicating the type of the Index.
      See Also: