public class IndexFactoryBean extends AbstractFactoryBeanSupport<org.apache.geode.cache.query.Index> implements InitializingBean
FactoryBean
used to construct, configure and initialize an Index
.Region
,
RegionService
,
Index
,
IndexStatistics
,
QueryService
,
FactoryBean
,
InitializingBean
,
ConfigurableBeanFactory
,
IndexFactoryBean.IndexWrapper
,
IndexConfigurer
,
AbstractFactoryBeanSupport
Modifier and Type | Class and Description |
---|---|
protected static class |
IndexFactoryBean.IndexWrapper |
Modifier and Type | Field and Description |
---|---|
static String |
BASIC_INDEX_DEFINITION |
static String |
DETAILED_INDEX_DEFINITION |
DEFAULT_SINGLETON
OBJECT_TYPE_ATTRIBUTE
Constructor and Description |
---|
IndexFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected void |
applyIndexConfigurers(String indexName,
IndexConfigurer... indexConfigurers)
Null-safe operation to apply the given array of
IndexConfigurers
to this IndexFactoryBean . |
protected void |
applyIndexConfigurers(String indexName,
Iterable<IndexConfigurer> indexConfigurers)
|
protected IndexConfigurer |
getCompositeIndexConfigurer()
Returns a reference to the Composite
IndexConfigurer used to apply additional configuration
to this IndexFactoryBean on Spring container initialization. |
org.apache.geode.cache.query.Index |
getIndex()
Returns a reference to the
Index created by this IndexFactoryBean . |
org.apache.geode.cache.query.Index |
getObject() |
Class<?> |
getObjectType() |
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. |
boolean |
isIgnoreIfExists()
Determines whether to ignore the
Index defined by this IndexFactoryBean
when an IndexExistsException or IndexNameConflictException is thrown. |
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 . |
void |
setCache(org.apache.geode.cache.RegionService cache)
Sets a reference to the
RegionService . |
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. |
void |
setExpression(String expression) |
void |
setFrom(String from) |
void |
setIgnoreIfExists(boolean ignore)
Configures whether to ignore the
Index defined by this IndexFactoryBean
when an IndexExistsException or IndexNameConflictException is thrown. |
void |
setImports(String imports) |
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. |
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. |
void |
setName(String name)
Sets the name of the
Index . |
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 . |
void |
setQueryService(org.apache.geode.cache.query.QueryService service)
Sets the
QueryService used to create the Index . |
void |
setType(IndexType type)
Set the
type of the Index . |
void |
setType(String type)
|
getBeanClassLoader, getBeanFactory, getBeanName, getLog, isSingleton, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLog, setBeanClassLoader, setBeanFactory, setBeanName
public static final String BASIC_INDEX_DEFINITION
public static final String DETAILED_INDEX_DEFINITION
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
protected void applyIndexConfigurers(String indexName, IndexConfigurer... indexConfigurers)
IndexConfigurers
to this IndexFactoryBean
.indexName
- String
containing the name of the Index
.indexConfigurers
- array of IndexConfigurers
applied
to this IndexFactoryBean
.RegionConfigurer
,
applyIndexConfigurers(String, Iterable)
protected void applyIndexConfigurers(String indexName, Iterable<IndexConfigurer> indexConfigurers)
indexName
- String
containing the name of the Index
.indexConfigurers
- Iterable
of IndexConfigurers
applied
to this IndexFactoryBean
.RegionConfigurer
protected IndexConfigurer getCompositeIndexConfigurer()
IndexConfigurer
used to apply additional configuration
to this IndexFactoryBean
on Spring container initialization.IndexConfigurer
.IndexConfigurer
public org.apache.geode.cache.query.Index getIndex()
Index
created by this IndexFactoryBean
.Index
created by this IndexFactoryBean
.Index
public org.apache.geode.cache.query.Index getObject()
getObject
in interface FactoryBean<org.apache.geode.cache.query.Index>
public Class<?> getObjectType()
getObjectType
in interface FactoryBean<org.apache.geode.cache.query.Index>
public void setCache(org.apache.geode.cache.RegionService cache)
RegionService
.cache
- reference to the RegionService
.RegionService
public void setName(String name)
Index
.name
- String
containing the name given to the Index
.public void setQueryService(org.apache.geode.cache.query.QueryService service)
QueryService
used to create the Index
.service
- QueryService
used to create the Index
.QueryService
public void setDefine(boolean define)
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.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.protected boolean isDefine()
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.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.public void setExpression(String expression)
expression
- Index expression to setpublic void setFrom(String from)
from
- Index from clause to setpublic void setImports(String imports)
imports
- Index imports to setpublic void setIgnoreIfExists(boolean ignore)
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.ignore
- boolean value indicating whether to ignore the Index
defined by
this IndexFactoryBean
. Default is false.setOverride(boolean)
public boolean isIgnoreIfExists()
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.Index
defined by this IndexFactoryBean
.
Default is false.setIgnoreIfExists(boolean)
public void setIndexConfigurers(IndexConfigurer... indexConfigurers)
IndexConfigurers
used to apply
additional configuration to this IndexFactoryBean
when using Annotation-based configuration.indexConfigurers
- array of IndexConfigurers
used to apply
additional configuration to this IndexFactoryBean
.IndexConfigurer
,
setIndexConfigurers(List)
public void setIndexConfigurers(List<IndexConfigurer> indexConfigurers)
Iterable
of IndexConfigurers
used to apply
additional configuration to this IndexFactoryBean
when using Annotation-based configuration.indexConfigurers
- Iterable
of IndexConfigurers
used to apply
additional configuration to this IndexFactoryBean
.IndexConfigurer
public void setOverride(boolean override)
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.override
- boolean value indicating whether an existing Index
will be removed and recreated
by this IndexFactoryBean
. Default is false.setIgnoreIfExists(boolean)
public boolean isOverride()
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.Index
will be removed and recreated
by this IndexFactoryBean
. Default is false.setOverride(boolean)
public void setType(String type)
type
- String
specifying the type
of the Index
.IndexType.valueOf(String)
,
setType(IndexType)
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.