public class LuceneIndexFactoryBean extends AbstractFactoryBeanSupport<org.apache.geode.cache.lucene.LuceneIndex> implements DisposableBean, InitializingBean
FactoryBean
used to construct, configure and initialize Lucene Indexes
on application domain object fields.GemFireCache
,
Region
,
LuceneIndex
,
LuceneIndexFactory
,
LuceneService
,
LuceneServiceProvider
,
Analyzer
,
DisposableBean
,
FactoryBean
,
InitializingBean
,
IndexConfigurer
,
AbstractFactoryBeanSupport
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEFAULT_DESTROY |
DEFAULT_SINGLETON
OBJECT_TYPE_ATTRIBUTE
Constructor and Description |
---|
LuceneIndexFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected void |
applyIndexConfigurers(String indexName,
IndexConfigurer... indexConfigurers)
Applies the given array of
IndexConfigurers to this LuceneIndexFactoryBean . |
protected void |
applyIndexConfigurers(String indexName,
Iterable<IndexConfigurer> indexConfigurers)
|
protected org.apache.geode.cache.lucene.LuceneIndex |
createLuceneIndex(String indexName,
String regionPath)
Creates a
LuceneIndex with the given indexName on the GemFireCache Region
identified by the given regionPath . |
void |
destroy() |
protected org.apache.geode.cache.GemFireCache |
getCache()
Returns a reference to the
GemFireCache . |
protected IndexConfigurer |
getCompositeIndexConfigurer()
Returns a reference to the Composite
IndexConfigurer used to apply additional configuration
to this LuceneIndexFactoryBean on Spring container initialization. |
protected Map<String,org.apache.lucene.analysis.Analyzer> |
getFieldAnalyzers()
Returns a
Map of application domain object field names to Analyzers used in
the construction of the Lucene Indexes for each field. |
protected List<String> |
getFields()
Returns a
List of application domain object fields to be indexed. |
protected String |
getIndexName()
Returns the name of the
LuceneIndex as identified in the GemFireCache . |
Optional<org.apache.geode.cache.lucene.LuceneIndex> |
getLuceneIndex()
|
protected org.apache.geode.cache.lucene.LuceneSerializer<?> |
getLuceneSerializer()
Returns a reference to the
LuceneSerializer used to convert objects
to Lucene documents for the LuceneIndex created by this LuceneIndexFactoryBean . |
protected org.apache.geode.cache.lucene.LuceneService |
getLuceneService()
|
org.apache.geode.cache.lucene.LuceneIndex |
getObject() |
Class<?> |
getObjectType() |
protected org.apache.geode.cache.Region<?,?> |
getRegion()
Returns a reference to the
GemFireCache Region on which the LuceneIndex will be created. |
protected String |
getRegionPath()
Returns the fully-qualified pathname to the
GemFireCache Region on which the LuceneIndex
will be created. |
protected boolean |
isDestroy()
Determines whether the
LuceneIndex will be destroyed on shutdown. |
protected boolean |
isLuceneIndexDestroyable(org.apache.geode.cache.lucene.LuceneIndex luceneIndex)
Determine whether the given
LuceneIndex created by this FactoryBean is destroyable. |
protected org.apache.geode.cache.lucene.LuceneIndex |
postProcess(org.apache.geode.cache.lucene.LuceneIndex luceneIndex)
Performs additional post processing to the newly created
LuceneIndex . |
protected org.apache.geode.cache.lucene.LuceneIndexFactory |
postProcess(org.apache.geode.cache.lucene.LuceneIndexFactory luceneIndexFactory)
Performs additional post processing to the newly created
LuceneIndexFactory . |
protected org.apache.geode.cache.GemFireCache |
resolveCache()
Resolves a reference to the
GemFireCache . |
protected List<String> |
resolveFields(List<String> fields)
Resolves the
List of fields on the object to index. |
protected org.apache.geode.cache.lucene.LuceneIndex |
resolveLuceneIndex(String indexName,
String regionPath)
Attempts to resolve a
LuceneIndex by the given indexName first then attempts to create
the LuceneIndex with the given Region path . |
protected org.apache.geode.cache.lucene.LuceneIndexFactory |
resolveLuceneIndexFactory()
Resolves the appropriate
LuceneIndexFactory from the LuceneService . |
protected org.apache.geode.cache.lucene.LuceneService |
resolveLuceneService()
|
protected org.apache.geode.cache.lucene.LuceneService |
resolveLuceneService(org.apache.geode.cache.GemFireCache gemfireCache)
|
protected org.apache.geode.cache.Region<?,?> |
resolveRegion()
Attempts to resolve the
GemFireCache Region on which the LuceneIndex will be created. |
protected String |
resolveRegionPath()
Resolves the fully-qualified pathname of the
GemFireCache Region on which the LuceneIndex
will be created. |
void |
setBeanName(String name)
Sets the
bean name assigned to this FactoryBean as declared in the Spring container. |
void |
setCache(org.apache.geode.cache.GemFireCache gemfireCache)
Sets a reference to the
GemFireCache . |
void |
setDestroy(boolean destroy)
Sets whether to destroy the
LuceneIndex on shutdown. |
void |
setFieldAnalyzers(Map<String,org.apache.lucene.analysis.Analyzer> fieldAnalyzers)
Set a
Map of application domain object field names to Analyzers used in the construction
of the Lucene Indexes for each field. |
void |
setFields(List<String> fields)
Sets the application domain object fields to index.
|
void |
setFields(String... fields)
Sets the application domain object fields to index.
|
void |
setIndexConfigurers(IndexConfigurer... indexConfigurers)
Null-safe operation to set an array of
IndexConfigurers used to apply
additional configuration to this LuceneIndexFactoryBean 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 LuceneIndexFactoryBean when using Annotation-based configuration. |
void |
setIndexName(String indexName)
Sets the name of the
LuceneIndex as identified in the GemFireCache . |
LuceneIndexFactoryBean |
setLuceneIndex(org.apache.geode.cache.lucene.LuceneIndex luceneIndex)
Sets the given
LuceneIndex as the index created by this FactoryBean . |
void |
setLuceneSerializer(org.apache.geode.cache.lucene.LuceneSerializer<?> luceneSerializer)
Configures a reference to the
LuceneSerializer used to convert objects
to Lucene documents for the LuceneIndex created by this LuceneIndexFactoryBean . |
void |
setLuceneService(org.apache.geode.cache.lucene.LuceneService luceneService)
|
void |
setRegion(org.apache.geode.cache.Region<?,?> region)
Sets a reference to the
GemFireCache Region on which the LuceneIndex will be created. |
void |
setRegionPath(String pathname)
Sets the fully-qualified pathname to the
GemFireCache Region on which the LuceneIndex
will be created. |
getBeanClassLoader, getBeanFactory, getBeanName, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, setBeanClassLoader, setBeanFactory
protected static final boolean DEFAULT_DESTROY
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
protected void applyIndexConfigurers(String indexName, IndexConfigurer... indexConfigurers)
IndexConfigurers
to this LuceneIndexFactoryBean
.indexName
- String
containing the name of the LuceneIndex
.indexConfigurers
- array of IndexConfigurers
applied
to this LuceneIndexFactoryBean
.IndexConfigurer
,
applyIndexConfigurers(String, Iterable)
protected void applyIndexConfigurers(String indexName, Iterable<IndexConfigurer> indexConfigurers)
indexName
- String
containing the name of the LuceneIndex
.indexConfigurers
- Iterable
of IndexConfigurers
applied
to this LuceneIndexFactoryBean
.IndexConfigurer
protected org.apache.geode.cache.lucene.LuceneIndex createLuceneIndex(String indexName, String regionPath)
LuceneIndex
with the given indexName
on the GemFireCache
Region
identified by the given regionPath
.indexName
- String
containing the name for the LuceneIndex
.regionPath
- String
containing the fully-qualified pathname to
the GemFireCache
Region
.LuceneIndex
with the given indexName
on the named Region
.LuceneService.createIndexFactory()
,
LuceneService.getIndex(String, String)
,
LuceneIndexFactory.create(String, String)
,
resolveLuceneService()
,
postProcess(LuceneIndexFactory)
,
getFieldAnalyzers()
,
getFields()
,
resolveFields(List)
protected org.apache.geode.cache.lucene.LuceneIndexFactory postProcess(org.apache.geode.cache.lucene.LuceneIndexFactory luceneIndexFactory)
LuceneIndexFactory
.luceneIndexFactory
- LuceneIndexFactory
to post process.LuceneIndexFactory
.LuceneIndexFactory
protected org.apache.geode.cache.lucene.LuceneIndex postProcess(org.apache.geode.cache.lucene.LuceneIndex luceneIndex)
LuceneIndex
.luceneIndex
- LuceneIndex
created by this LuceneIndexFactoryBean
.LuceneIndex
.LuceneIndex
protected org.apache.geode.cache.lucene.LuceneIndex resolveLuceneIndex(String indexName, String regionPath)
LuceneIndex
by the given indexName
first then attempts to create
the LuceneIndex
with the given Region path
.indexName
- name
of the LuceneIndex
to resolve.regionPath
- Region path
on which the LuceneIndex
is applied.LuceneIndex
by the given indexName
or the created LuceneIndex
with the given Region path
if the LuceneIndex
could not be resolved by
indexName
.LuceneService.getIndex(String, String)
,
createLuceneIndex(String, String)
,
getLuceneIndex()
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
protected boolean isLuceneIndexDestroyable(org.apache.geode.cache.lucene.LuceneIndex luceneIndex)
LuceneIndex
created by this FactoryBean
is destroyable.luceneIndex
- LuceneIndex
subject to destruction.LuceneIndex
created by this FactoryBean
is destroyable.LuceneIndex
,
isDestroy()
public org.apache.geode.cache.lucene.LuceneIndex getObject() throws Exception
getObject
in interface FactoryBean<org.apache.geode.cache.lucene.LuceneIndex>
Exception
public Class<?> getObjectType()
getObjectType
in interface FactoryBean<org.apache.geode.cache.lucene.LuceneIndex>
protected org.apache.geode.cache.GemFireCache resolveCache()
GemFireCache
.GemFireCache
.CacheUtils.resolveGemFireCache()
,
GemFireCache
,
getCache()
protected List<String> resolveFields(List<String> fields)
List
of fields on the object to index.protected org.apache.geode.cache.lucene.LuceneIndexFactory resolveLuceneIndexFactory()
LuceneIndexFactory
from the LuceneService
.LuceneIndexFactory
from the resolved LuceneService
.resolveLuceneService()
protected org.apache.geode.cache.lucene.LuceneService resolveLuceneService()
GemFireCache
, LuceneService
.BeanFactory.getBean(Class)
,
LuceneService
,
AbstractFactoryBeanSupport.getBeanFactory()
,
getLuceneService()
,
resolveCache()
,
resolveLuceneService(GemFireCache)
protected org.apache.geode.cache.lucene.LuceneService resolveLuceneService(org.apache.geode.cache.GemFireCache gemfireCache)
gemfireCache
- GemFireCache
used to resolve the LuceneService
.GemFireCache
LuceneService
.IllegalArgumentException
- if GemFireCache
is null.LuceneService
,
GemFireCache
protected org.apache.geode.cache.Region<?,?> resolveRegion()
GemFireCache
Region
on which the LuceneIndex
will be created.GemFireCache
Region
on which he LuceneIndex
will be created.
Returns null if the Region
cannot be resolved.RegionService.getRegion(String)
,
Region
,
resolveCache()
,
getRegionPath()
protected String resolveRegionPath()
GemFireCache
Region
on which the LuceneIndex
will be created.String
containing the fully-qualified pathname of the GemFireCache
Region
on which the LuceneIndex
will be created.IllegalStateException
- if the Region
pathname could not resolved.resolveRegion()
,
getRegionPath()
public void setBeanName(String name)
AbstractFactoryBeanSupport
bean name
assigned to this FactoryBean
as declared in the Spring container.setBeanName
in interface BeanNameAware
setBeanName
in class AbstractFactoryBeanSupport<org.apache.geode.cache.lucene.LuceneIndex>
name
- bean name
assigned to this FactoryBean
as declared in the Spring container.BeanNameAware.setBeanName(String)
,
String
public void setCache(org.apache.geode.cache.GemFireCache gemfireCache)
GemFireCache
.gemfireCache
- GemFireCache
reference.GemFireCache
protected org.apache.geode.cache.GemFireCache getCache()
GemFireCache
.GemFireCache
.GemFireCache
,
resolveCache()
protected IndexConfigurer getCompositeIndexConfigurer()
IndexConfigurer
used to apply additional configuration
to this LuceneIndexFactoryBean
on Spring container initialization.IndexConfigurer
.IndexConfigurer
public void setDestroy(boolean destroy)
LuceneIndex
on shutdown.destroy
- boolean value indicating whether to destroy the LuceneIndex
on shutdown.protected boolean isDestroy()
LuceneIndex
will be destroyed on shutdown.LuceneIndex
will be destroyed on shutdown.DisposableBean.destroy()
public void setFieldAnalyzers(Map<String,org.apache.lucene.analysis.Analyzer> fieldAnalyzers)
Map
of application domain object field names to Analyzers
used in the construction
of the Lucene Indexes
for each field.protected Map<String,org.apache.lucene.analysis.Analyzer> getFieldAnalyzers()
Map
of application domain object field names to Analyzers
used in
the construction of the Lucene Indexes
for each field.Map
of fields names to Analyzers
.Analyzer
,
Map
,
getFields()
public void setFields(String... fields)
fields
- array of Strings
containing the names of the object fields ot index.setFields(List)
public void setFields(List<String> fields)
protected List<String> getFields()
List
of application domain object fields to be indexed.List
of application domain object fields to be indexed.getFieldAnalyzers()
,
List
public void setIndexConfigurers(IndexConfigurer... indexConfigurers)
IndexConfigurers
used to apply
additional configuration to this LuceneIndexFactoryBean
when using Annotation-based configuration.indexConfigurers
- array of IndexConfigurers
used to apply
additional configuration to this LuceneIndexFactoryBean
.IndexConfigurer
,
setIndexConfigurers(List)
public void setIndexConfigurers(List<IndexConfigurer> indexConfigurers)
Iterable
of IndexConfigurers
used to apply
additional configuration to this LuceneIndexFactoryBean
when using Annotation-based configuration.indexConfigurers
- Iterable
of IndexConfigurers
used to apply
additional configuration to this LuceneIndexFactoryBean
.IndexConfigurer
public void setIndexName(String indexName)
LuceneIndex
as identified in the GemFireCache
.indexName
- String
containing the name of the LuceneIndex
.setBeanName(String)
protected String getIndexName()
LuceneIndex
as identified in the GemFireCache
.String
containing the name of the LuceneIndex
.IllegalStateException
- if the indexName
was not specified.public Optional<org.apache.geode.cache.lucene.LuceneIndex> getLuceneIndex()
Optional
reference to the LuceneIndex
created by this LuceneIndexFactoryBean
.LuceneIndex
,
Optional
public LuceneIndexFactoryBean setLuceneIndex(org.apache.geode.cache.lucene.LuceneIndex luceneIndex)
LuceneIndex
as the index created by this FactoryBean
.
This method is generally used for testing purposes only.
luceneIndex
- LuceneIndex
created by this FactoryBean
.LuceneIndexFactoryBean
.LuceneIndexFactoryBean
,
LuceneIndex
public void setLuceneSerializer(org.apache.geode.cache.lucene.LuceneSerializer<?> luceneSerializer)
LuceneSerializer
used to convert objects
to Lucene documents for the LuceneIndex
created by this LuceneIndexFactoryBean
.luceneSerializer
- LuceneSerializer
used to convert objects
to Lucene documents for the LuceneIndex
.LuceneSerializer
protected org.apache.geode.cache.lucene.LuceneSerializer<?> getLuceneSerializer()
LuceneSerializer
used to convert objects
to Lucene documents for the LuceneIndex
created by this LuceneIndexFactoryBean
.LuceneSerializer
used to convert objects
to Lucene documents for the LuceneIndex
.LuceneSerializer
public void setLuceneService(org.apache.geode.cache.lucene.LuceneService luceneService)
luceneService
- LuceneService
used to create the LuceneIndex
.LuceneService
protected org.apache.geode.cache.lucene.LuceneService getLuceneService()
LuceneService
used to create the LuceneIndex
.LuceneService
,
resolveLuceneService()
public void setRegion(org.apache.geode.cache.Region<?,?> region)
GemFireCache
Region
on which the LuceneIndex
will be created.region
- Region
on which the LuceneIndex
will be created.Region
,
setRegionPath(String)
protected org.apache.geode.cache.Region<?,?> getRegion()
GemFireCache
Region
on which the LuceneIndex
will be created.Region
on which the LuceneIndex
will be created.Region
,
getRegionPath()
,
resolveRegion()
public void setRegionPath(String pathname)
GemFireCache
Region
on which the LuceneIndex
will be created.pathname
- String
containing the fully-qualified pathname to the GemFireCache
Region
on which the LuceneIndex
will be created.setRegion(Region)
protected String getRegionPath()
GemFireCache
Region
on which the LuceneIndex
will be created.String
containing the fully-qualified pathname to the GemFireCache
Region
on which the LuceneIndex
will be created.getRegion()
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.