Class AbstractOpenSearchFactory<T extends AutoCloseable>

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.craftercms.deployer.utils.opensearch.legacy.AbstractOpenSearchFactory<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:
OpenSearchAdminServiceFactory

public abstract class AbstractOpenSearchFactory<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 OpenSearch services
Since:
3.1.5
Author:
joseross
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The OpenSearch configuration
    protected String
    The name of the bean

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected T
     
    protected void
    destroyInstance(T instance)
     
    protected abstract T
    doCreateMultiInstance(org.opensearch.client.RestHighLevelClient readClient, org.opensearch.client.RestHighLevelClient[] writeClients)
    Creates a service instance for a multiple cluster
    protected abstract T
    doCreateSingleInstance(org.opensearch.client.RestHighLevelClient client)
    Creates a service instance for a single cluster
    void
     

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, getObjectType, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      protected String name
      The name of the bean
    • config

      protected OpenSearchConfig config
      The OpenSearch configuration
  • Constructor Details

    • AbstractOpenSearchFactory

      public AbstractOpenSearchFactory(OpenSearchConfig config)
  • Method Details

    • setBeanName

      public void setBeanName(String name)
      Specified by:
      setBeanName in interface org.springframework.beans.factory.BeanNameAware
    • createInstance

      protected T createInstance()
      Specified by:
      createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<T extends AutoCloseable>
    • doCreateSingleInstance

      protected abstract T doCreateSingleInstance(org.opensearch.client.RestHighLevelClient client)
      Creates a service instance for a single cluster
      Parameters:
      client - the OpenSearch client
      Returns:
      the service instance
    • doCreateMultiInstance

      protected abstract T doCreateMultiInstance(org.opensearch.client.RestHighLevelClient readClient, org.opensearch.client.RestHighLevelClient[] writeClients)
      Creates a service instance for a multiple cluster
      Parameters:
      readClient - the OpenSearch client for read-related operations
      writeClients - the OpenSearch clients for write-related operations
      Returns:
      the service instance
    • destroyInstance

      protected void destroyInstance(T instance) throws Exception
      Overrides:
      destroyInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<T extends AutoCloseable>
      Throws:
      Exception