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
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETON
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
applyIndexConfigurers
(String indexName, Iterable<IndexConfigurer> indexConfigurers) protected void
applyIndexConfigurers
(String indexName, IndexConfigurer... indexConfigurers) Null-safe operation to apply the given array ofIndexConfigurers
to thisIndexFactoryBean
.protected IndexConfigurer
Returns a reference to the CompositeIndexConfigurer
used to apply additional configuration to thisIndexFactoryBean
on Spring container initialization.getIndex()
Returns a reference to theIndex
created by thisIndexFactoryBean
.Class<?>
protected boolean
isDefine()
Returns a boolean indicating whether theIndex
declared and defined by thisIndexFactoryBean
will only be defined initially, or defined and created.boolean
Determines whether to ignore theIndex
defined by thisIndexFactoryBean
when anIndexExistsException
orIndexNameConflictException
is thrown.boolean
Determines whether to override an existingIndex
having the same definition but different name as theIndex
that would be created by thisIndexFactoryBean
.void
setCache
(RegionService cache) Sets a reference to theRegionService
.void
setDefine
(boolean define) Sets a boolean condition to indicate whether theIndex
declared and defined by thisIndexFactoryBean
will only be defined initially, or defined and created.void
setExpression
(String expression) void
void
setIgnoreIfExists
(boolean ignore) Configures whether to ignore theIndex
defined by thisIndexFactoryBean
when anIndexExistsException
orIndexNameConflictException
is thrown.void
setImports
(String imports) void
setIndexConfigurers
(List<IndexConfigurer> indexConfigurers) Null-safe operation to set anIterable
ofIndexConfigurers
used to apply additional configuration to thisIndexFactoryBean
when using Annotation-based configuration.void
setIndexConfigurers
(IndexConfigurer... indexConfigurers) Null-safe operation to set an array ofIndexConfigurers
used to apply additional configuration to thisIndexFactoryBean
when using Annotation-based configuration.void
Sets the name of theIndex
.void
setOverride
(boolean override) Configures whether to override an existingIndex
having the same definition but different name as theIndex
that would be created by thisIndexFactoryBean
.void
setQueryService
(QueryService service) Sets theQueryService
used to create theIndex
.void
void
Methods 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:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
-
applyIndexConfigurers
Null-safe operation to apply the given array ofIndexConfigurers
to thisIndexFactoryBean
.- Parameters:
indexName
-String
containing the name of theIndex
.indexConfigurers
- array ofIndexConfigurers
applied to thisIndexFactoryBean
.- See Also:
-
applyIndexConfigurers
- Parameters:
indexName
-String
containing the name of theIndex
.indexConfigurers
-Iterable
ofIndexConfigurers
applied to thisIndexFactoryBean
.- See Also:
-
getCompositeIndexConfigurer
Returns a reference to the CompositeIndexConfigurer
used to apply additional configuration to thisIndexFactoryBean
on Spring container initialization.- Returns:
- the Composite
IndexConfigurer
. - See Also:
-
getIndex
Returns a reference to theIndex
created by thisIndexFactoryBean
.- Returns:
- a reference to the
Index
created by thisIndexFactoryBean
. - See Also:
-
getObject
- Specified by:
getObject
in interfaceFactoryBean<Index>
-
getObjectType
- Specified by:
getObjectType
in interfaceFactoryBean<Index>
-
setCache
Sets a reference to theRegionService
.- Parameters:
cache
- reference to theRegionService
.- See Also:
-
setName
Sets the name of theIndex
. -
setQueryService
Sets theQueryService
used to create theIndex
.- Parameters:
service
-QueryService
used to create theIndex
.- See Also:
-
setDefine
public void setDefine(boolean define) Sets a boolean condition to indicate whether theIndex
declared and defined by thisIndexFactoryBean
will only be defined initially, or defined and created. If defined-only, theIndexFactoryBean
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, theIndex
declared by thisIndexFactoryBean
will only be defined initially and subsequently created when this bean receives an appropriate callback from the Spring container; if false, theIndex
will be created immediately.
-
isDefine
protected boolean isDefine()Returns a boolean indicating whether theIndex
declared and defined by thisIndexFactoryBean
will only be defined initially, or defined and created. If defined-only, theIndexFactoryBean
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 thisIndexFactoryBean
will only be defined initially and subsequently created when this bean receives an appropriate callback from the Spring container; if false, theIndex
will 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 theIndex
defined by thisIndexFactoryBean
when anIndexExistsException
orIndexNameConflictException
is thrown. AnIndexExistsException
is thrown when there exists anotherIndex
with the same definition but with another name. AnIndexNameConflictException
is thrown when there exists anotherIndex
with the same name but possibly a different definition. When ignoreIfExists is set to true and anIndexExistsException
is thrown, then the existingIndex
will be returned as the object of thisIndexFactoryBean
creation and the name of the existingIndex
is added as an alias for this bean. When ignoreIfExists is set to true andIndexNameConflictException
is thrown, then the existingIndex
will be returned as the object of thisIndexFactoryBean
creation. A warning is logged if the definition of thisIndexFactoryBean
and the existingIndex
are different. ignoreIfExists takes precedence overoverride
. Defaults to false.- Parameters:
ignore
- boolean value indicating whether to ignore theIndex
defined by thisIndexFactoryBean
. Default is false.- See Also:
-
isIgnoreIfExists
public boolean isIgnoreIfExists()Determines whether to ignore theIndex
defined by thisIndexFactoryBean
when anIndexExistsException
orIndexNameConflictException
is thrown. AnIndexExistsException
is thrown when there exists anotherIndex
with the same definition but with another name. AnIndexNameConflictException
is thrown when there exists anotherIndex
with the same name but possibly a different definition. When ignoreIfExists is set to true and anIndexExistsException
is thrown, then the existingIndex
will be returned as the object of thisIndexFactoryBean
creation and the name of the existingIndex
is added as an alias for this bean. When ignoreIfExists is set to true andIndexNameConflictException
is thrown, then the existingIndex
will be returned as the object of thisIndexFactoryBean
creation. A warning is logged if the definition of thisIndexFactoryBean
and the existingIndex
are different. ignoreIfExists takes precedence overoverride
. Defaults to false.- Returns:
- a boolean value indicating whether to ignore the
Index
defined by thisIndexFactoryBean
. Default is false. - See Also:
-
setIndexConfigurers
Null-safe operation to set an array ofIndexConfigurers
used to apply additional configuration to thisIndexFactoryBean
when using Annotation-based configuration.- Parameters:
indexConfigurers
- array ofIndexConfigurers
used to apply additional configuration to thisIndexFactoryBean
.- See Also:
-
setIndexConfigurers
Null-safe operation to set anIterable
ofIndexConfigurers
used to apply additional configuration to thisIndexFactoryBean
when using Annotation-based configuration.- Parameters:
indexConfigurers
-Iterable
ofIndexConfigurers
used to apply additional configuration to thisIndexFactoryBean
.- See Also:
-
setOverride
public void setOverride(boolean override) Configures whether to override an existingIndex
having the same definition but different name as theIndex
that would be created by thisIndexFactoryBean
. AnIndexExistsException
is thrown when there exists anotherIndex
with the same definition but with another name. AnIndexNameConflictException
is thrown when there exists anotherIndex
with the same name but possibly a different definition. With override set to true when anIndexExistsException
is thrown, then override is effectively the same as "renaming" the existingIndex
. In other words, the existingIndex
will beremoved
and recreated by thisIndexFactoryBean
under the newname
having the same definition. With override set to true when anIndexNameConflictException
is thrown, then overriding the existingIndex
is equivalent to changing the existingIndex
definition. When this happens, a warning is logged. If the existingIndex
definition is the same then overriding effectively just rebuilds theIndex
. ignoreIfExists takes precedence over override. Defaults to false.- Parameters:
override
- boolean value indicating whether an existingIndex
will be removed and recreated by thisIndexFactoryBean
. Default is false.- See Also:
-
isOverride
public boolean isOverride()Determines whether to override an existingIndex
having the same definition but different name as theIndex
that would be created by thisIndexFactoryBean
. AnIndexExistsException
is thrown when there exists anotherIndex
with the same definition but with another name. AnIndexNameConflictException
is thrown when there exists anotherIndex
with the same name but possibly a different definition. With override set to true when anIndexExistsException
is thrown, then override is effectively the same as "renaming" the existingIndex
. In other words, the existingIndex
will beremoved
and recreated by thisIndexFactoryBean
under the newname
having the same definition. With override set to true when anIndexNameConflictException
is thrown, then overriding the existingIndex
is equivalent to changing the existingIndex
definition. When this happens, a warning is logged. If the existingIndex
definition 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
Index
will be removed and recreated by thisIndexFactoryBean
. Default is false. - See Also:
-
setType
-
setType
-