Package org.springframework.data.gemfire
Class IndexFactoryBean
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<Index>
org.springframework.data.gemfire.IndexFactoryBean
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,FactoryBean<Index>,InitializingBean
Spring
FactoryBean used to construct, configure and initialize an Index.- Since:
- 1.0.0
- Author:
- Costin Leau, David Turanski, John Blum
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETONFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidapplyIndexConfigurers(String indexName, Iterable<IndexConfigurer> indexConfigurers) protected voidapplyIndexConfigurers(String indexName, IndexConfigurer... indexConfigurers) Null-safe operation to apply the given array ofIndexConfigurersto thisIndexFactoryBean.protected IndexConfigurerReturns a reference to the CompositeIndexConfigurerused to apply additional configuration to thisIndexFactoryBeanon Spring container initialization.getIndex()Returns a reference to theIndexcreated by thisIndexFactoryBean.Class<?>protected booleanisDefine()Returns a boolean indicating whether theIndexdeclared and defined by thisIndexFactoryBeanwill only be defined initially, or defined and created.booleanDetermines whether to ignore theIndexdefined by thisIndexFactoryBeanwhen anIndexExistsExceptionorIndexNameConflictExceptionis thrown.booleanDetermines whether to override an existingIndexhaving the same definition but different name as theIndexthat would be created by thisIndexFactoryBean.voidsetCache(RegionService cache) Sets a reference to theRegionService.voidsetDefine(boolean define) Sets a boolean condition to indicate whether theIndexdeclared and defined by thisIndexFactoryBeanwill only be defined initially, or defined and created.voidsetExpression(String expression) voidvoidsetIgnoreIfExists(boolean ignore) Configures whether to ignore theIndexdefined by thisIndexFactoryBeanwhen anIndexExistsExceptionorIndexNameConflictExceptionis thrown.voidsetImports(String imports) voidsetIndexConfigurers(List<IndexConfigurer> indexConfigurers) Null-safe operation to set anIterableofIndexConfigurersused to apply additional configuration to thisIndexFactoryBeanwhen using Annotation-based configuration.voidsetIndexConfigurers(IndexConfigurer... indexConfigurers) Null-safe operation to set an array ofIndexConfigurersused to apply additional configuration to thisIndexFactoryBeanwhen using Annotation-based configuration.voidSets the name of theIndex.voidsetOverride(boolean override) Configures whether to override an existingIndexhaving the same definition but different name as theIndexthat would be created by thisIndexFactoryBean.voidsetQueryService(QueryService service) Sets theQueryServiceused to create theIndex.voidvoidMethods inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
getBeanClassLoader, getBeanFactory, getBeanName, getLog, getOptionalLog, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLog, setBeanClassLoader, setBeanFactory, setBeanName
-
Field Details
-
BASIC_INDEX_DEFINITION
- See Also:
-
DETAILED_INDEX_DEFINITION
- See Also:
-
-
Constructor Details
-
IndexFactoryBean
public IndexFactoryBean()
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception
-
applyIndexConfigurers
Null-safe operation to apply the given array ofIndexConfigurersto thisIndexFactoryBean.- Parameters:
indexName-Stringcontaining the name of theIndex.indexConfigurers- array ofIndexConfigurersapplied to thisIndexFactoryBean.- See Also:
-
applyIndexConfigurers
- Parameters:
indexName-Stringcontaining the name of theIndex.indexConfigurers-IterableofIndexConfigurersapplied to thisIndexFactoryBean.- See Also:
-
getCompositeIndexConfigurer
Returns a reference to the CompositeIndexConfigurerused to apply additional configuration to thisIndexFactoryBeanon Spring container initialization.- Returns:
- the Composite
IndexConfigurer. - See Also:
-
getIndex
Returns a reference to theIndexcreated by thisIndexFactoryBean.- Returns:
- a reference to the
Indexcreated by thisIndexFactoryBean. - See Also:
-
getObject
- Specified by:
getObjectin interfaceFactoryBean<Index>
-
getObjectType
- Specified by:
getObjectTypein interfaceFactoryBean<Index>
-
setCache
Sets a reference to theRegionService.- Parameters:
cache- reference to theRegionService.- See Also:
-
setName
Sets the name of theIndex. -
setQueryService
Sets theQueryServiceused to create theIndex.- Parameters:
service-QueryServiceused to create theIndex.- See Also:
-
setDefine
public void setDefine(boolean define) Sets a boolean condition to indicate whether theIndexdeclared and defined by thisIndexFactoryBeanwill only be defined initially, or defined and created. If defined-only, theIndexFactoryBeanwill receive a callback at the end of the Spring container lifecycle to subsequently "create" all "defined-only"Indexesonce, in a single operation.- Parameters:
define- a boolean value indicating the define or define/create status. If true, theIndexdeclared by thisIndexFactoryBeanwill only be defined initially and subsequently created when this bean receives an appropriate callback from the Spring container; if false, theIndexwill be created immediately.
-
isDefine
protected boolean isDefine()Returns a boolean indicating whether theIndexdeclared and defined by thisIndexFactoryBeanwill only be defined initially, or defined and created. If defined-only, theIndexFactoryBeanwill receive a callback at the end of the Spring container lifecycle to subsequently "create" all "defined-only"Indexesonce, in a single operation.- Returns:
- a boolean value indicating the define or define/create status. If true, the
Indexdeclared by thisIndexFactoryBeanwill only be defined initially and subsequently created when this bean receives an appropriate callback from the Spring container; if false, theIndexwill be created immediately.
-
setExpression
- Parameters:
expression- Index expression to set
-
setFrom
- Parameters:
from- Index from clause to set
-
setImports
- Parameters:
imports- Index imports to set
-
setIgnoreIfExists
public void setIgnoreIfExists(boolean ignore) Configures whether to ignore theIndexdefined by thisIndexFactoryBeanwhen anIndexExistsExceptionorIndexNameConflictExceptionis thrown. AnIndexExistsExceptionis thrown when there exists anotherIndexwith the same definition but with another name. AnIndexNameConflictExceptionis thrown when there exists anotherIndexwith the same name but possibly a different definition. When ignoreIfExists is set to true and anIndexExistsExceptionis thrown, then the existingIndexwill be returned as the object of thisIndexFactoryBeancreation and the name of the existingIndexis added as an alias for this bean. When ignoreIfExists is set to true andIndexNameConflictExceptionis thrown, then the existingIndexwill be returned as the object of thisIndexFactoryBeancreation. A warning is logged if the definition of thisIndexFactoryBeanand the existingIndexare different. ignoreIfExists takes precedence overoverride. Defaults to false.- Parameters:
ignore- boolean value indicating whether to ignore theIndexdefined by thisIndexFactoryBean. Default is false.- See Also:
-
isIgnoreIfExists
public boolean isIgnoreIfExists()Determines whether to ignore theIndexdefined by thisIndexFactoryBeanwhen anIndexExistsExceptionorIndexNameConflictExceptionis thrown. AnIndexExistsExceptionis thrown when there exists anotherIndexwith the same definition but with another name. AnIndexNameConflictExceptionis thrown when there exists anotherIndexwith the same name but possibly a different definition. When ignoreIfExists is set to true and anIndexExistsExceptionis thrown, then the existingIndexwill be returned as the object of thisIndexFactoryBeancreation and the name of the existingIndexis added as an alias for this bean. When ignoreIfExists is set to true andIndexNameConflictExceptionis thrown, then the existingIndexwill be returned as the object of thisIndexFactoryBeancreation. A warning is logged if the definition of thisIndexFactoryBeanand the existingIndexare different. ignoreIfExists takes precedence overoverride. Defaults to false.- Returns:
- a boolean value indicating whether to ignore the
Indexdefined by thisIndexFactoryBean. Default is false. - See Also:
-
setIndexConfigurers
Null-safe operation to set an array ofIndexConfigurersused to apply additional configuration to thisIndexFactoryBeanwhen using Annotation-based configuration.- Parameters:
indexConfigurers- array ofIndexConfigurersused to apply additional configuration to thisIndexFactoryBean.- See Also:
-
setIndexConfigurers
Null-safe operation to set anIterableofIndexConfigurersused to apply additional configuration to thisIndexFactoryBeanwhen using Annotation-based configuration.- Parameters:
indexConfigurers-IterableofIndexConfigurersused to apply additional configuration to thisIndexFactoryBean.- See Also:
-
setOverride
public void setOverride(boolean override) Configures whether to override an existingIndexhaving the same definition but different name as theIndexthat would be created by thisIndexFactoryBean. AnIndexExistsExceptionis thrown when there exists anotherIndexwith the same definition but with another name. AnIndexNameConflictExceptionis thrown when there exists anotherIndexwith the same name but possibly a different definition. With override set to true when anIndexExistsExceptionis thrown, then override is effectively the same as "renaming" the existingIndex. In other words, the existingIndexwill beremovedand recreated by thisIndexFactoryBeanunder the newnamehaving the same definition. With override set to true when anIndexNameConflictExceptionis thrown, then overriding the existingIndexis equivalent to changing the existingIndexdefinition. When this happens, a warning is logged. If the existingIndexdefinition is the same then overriding effectively just rebuilds theIndex. ignoreIfExists takes precedence over override. Defaults to false.- Parameters:
override- boolean value indicating whether an existingIndexwill be removed and recreated by thisIndexFactoryBean. Default is false.- See Also:
-
isOverride
public boolean isOverride()Determines whether to override an existingIndexhaving the same definition but different name as theIndexthat would be created by thisIndexFactoryBean. AnIndexExistsExceptionis thrown when there exists anotherIndexwith the same definition but with another name. AnIndexNameConflictExceptionis thrown when there exists anotherIndexwith the same name but possibly a different definition. With override set to true when anIndexExistsExceptionis thrown, then override is effectively the same as "renaming" the existingIndex. In other words, the existingIndexwill beremovedand recreated by thisIndexFactoryBeanunder the newnamehaving the same definition. With override set to true when anIndexNameConflictExceptionis thrown, then overriding the existingIndexis equivalent to changing the existingIndexdefinition. When this happens, a warning is logged. If the existingIndexdefinition is the same then overriding effectively just rebuilds theIndex. ignoreIfExists takes precedence over override. Defaults to false.- Returns:
- a boolean value indicating whether an existing
Indexwill be removed and recreated by thisIndexFactoryBean. Default is false. - See Also:
-
setType
-
setType
-