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
,
LuceneService
,
LuceneServiceProvider
,
Analyzer
,
DisposableBean
,
FactoryBean
,
InitializingBean
,
IndexConfigurer
,
AbstractFactoryBeanSupport
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEFAULT_DESTROY |
DEFAULT_SINGLETON
Constructor and Description |
---|
LuceneIndexFactoryBean() |
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 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 |
getCompositeRegionConfigurer()
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.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.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.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 |
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, getLog, isSingleton, logDebug, logDebug, logInfo, logInfo, newLog, 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
.RegionConfigurer
,
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
.RegionConfigurer
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()
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.createIndex(String, String, Map)
,
LuceneService.createIndex(String, String, String...)
,
LuceneService.getIndex(String, String)
,
resolveLuceneService()
,
getFieldAnalyzers()
,
getFields()
,
resolveFields(List)
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.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 getCompositeRegionConfigurer()
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 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–2017 Pivotal Software, Inc.. All rights reserved.