Class AbstractElasticsearchFactory<T extends AutoCloseable>
- java.lang.Object
-
- org.springframework.beans.factory.config.AbstractFactoryBean<T>
-
- org.craftercms.deployer.utils.elasticsearch.legacy.AbstractElasticsearchFactory<T>
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.FactoryBean<T>
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
ElasticsearchAdminServiceFactory
public abstract class AbstractElasticsearchFactory<T extends AutoCloseable> extends org.springframework.beans.factory.config.AbstractFactoryBean<T> implements org.springframework.beans.factory.BeanNameAware
Base implementation for factories capable of build single or multi-cluster Elasticsearch services- Since:
- 3.1.5
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected ElasticsearchConfig
config
The Elasticsearch configurationprotected String
name
The name of the bean
-
Constructor Summary
Constructors Constructor Description AbstractElasticsearchFactory(ElasticsearchConfig config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected T
createInstance()
protected void
destroyInstance(T instance)
protected abstract T
doCreateMultiInstance(org.elasticsearch.client.RestHighLevelClient readClient, org.elasticsearch.client.RestHighLevelClient[] writeClients)
Creates a service instance for a multiple clusterprotected abstract T
doCreateSingleInstance(org.elasticsearch.client.RestHighLevelClient client)
Creates a service instance for a single clustervoid
setBeanName(String name)
-
-
-
Field Detail
-
name
protected String name
The name of the bean
-
config
protected ElasticsearchConfig config
The Elasticsearch configuration
-
-
Constructor Detail
-
AbstractElasticsearchFactory
public AbstractElasticsearchFactory(ElasticsearchConfig config)
-
-
Method Detail
-
setBeanName
public void setBeanName(String name)
- Specified by:
setBeanName
in interfaceorg.springframework.beans.factory.BeanNameAware
-
createInstance
protected T createInstance()
- Specified by:
createInstance
in classorg.springframework.beans.factory.config.AbstractFactoryBean<T extends AutoCloseable>
-
doCreateSingleInstance
protected abstract T doCreateSingleInstance(org.elasticsearch.client.RestHighLevelClient client)
Creates a service instance for a single cluster- Parameters:
client
- the Elasticsearch client- Returns:
- the service instance
-
doCreateMultiInstance
protected abstract T doCreateMultiInstance(org.elasticsearch.client.RestHighLevelClient readClient, org.elasticsearch.client.RestHighLevelClient[] writeClients)
Creates a service instance for a multiple cluster- Parameters:
readClient
- the Elasticsearch client for read-related operationswriteClients
- the Elasticsearch clients for write-related operations- Returns:
- the service instance
-
destroyInstance
protected void destroyInstance(T instance) throws Exception
- Overrides:
destroyInstance
in classorg.springframework.beans.factory.config.AbstractFactoryBean<T extends AutoCloseable>
- Throws:
Exception
-
-