Class ElasticsearchInitialiser

java.lang.Object
org.alfresco.repo.search.impl.elasticsearch.contentmodelsync.ElasticsearchInitialiser
All Implemented Interfaces:
DictionaryListener

public class ElasticsearchInitialiser extends Object implements DictionaryListener
Class responsible for initialising Elasticsearch when the subsystem is started.
  • Field Details

    • LOCK_QNAME

      public static final QName LOCK_QNAME
      The name of the lock used to ensure that Elasticsearch configuration does not run on more than one node at the same time.
    • LOCK_TTL

      public static final long LOCK_TTL
      The time this lock will persist in the database (60 sec but refreshed at regular intervals)
      See Also:
  • Constructor Details

    • ElasticsearchInitialiser

      public ElasticsearchInitialiser(DictionaryDAOImpl dictionary, ElasticsearchIndexService elasticsearchIndexService, ContentModelSynchronizer contentModelSynchronizer, JobLockService jobLockService, int retryAttempts, int retryPeriodSeconds, int lockRetryAttempts, int lockRetryPeriodSeconds, boolean createIndexIfNotExists)
    • ElasticsearchInitialiser

      public ElasticsearchInitialiser()
  • Method Details

    • stop

      public void stop()
      Stop the index initialization. This method is required when the Spring context is reloaded in order to stop the asynchronous initialization.
    • initAsync

      public Thread initAsync()
      Async initialisation method, a lock will be used to avoid multiple initialisation
      Returns:
      the started thread created to execute the asynchronous initialisation.
    • initWithLock

      public void initWithLock()
      Initialisation method, a lock will be used to avoid multiple initialisation
    • init

      public void init()
      Check if the index exists and attempt to create it if the configuration permits. When creating the index then also load the analysers and the basic mappings. Retry periodically on failure, and only return once the index exists. The index will be automatically created only if elasticsearch.createIndexIfNotExists property is true.
    • onDictionaryInit

      public void onDictionaryInit()
      Specified by:
      onDictionaryInit in interface DictionaryListener
    • afterDictionaryDestroy

      public void afterDictionaryDestroy()
      Specified by:
      afterDictionaryDestroy in interface DictionaryListener
    • afterDictionaryInit

      public void afterDictionaryInit()
      Get a lock before mapping models. Reuse the same lock as initWithLock().
      Specified by:
      afterDictionaryInit in interface DictionaryListener
    • getDictionaryDAO

      public DictionaryDAOImpl getDictionaryDAO()
    • setDictionaryDAO

      public void setDictionaryDAO(DictionaryDAOImpl dictionaryDAO)
    • getContentModelSynchronizer

      public ContentModelSynchronizer getContentModelSynchronizer()
    • getElasticsearchIndexService

      public ElasticsearchIndexService getElasticsearchIndexService()
    • isCreateIndexIfNotExists

      public boolean isCreateIndexIfNotExists()
    • getRetryAttempts

      public int getRetryAttempts()
    • getLockRetryAttempts

      public int getLockRetryAttempts()
    • getLockRetryPeriodSeconds

      public int getLockRetryPeriodSeconds()
    • getJobLockService

      public JobLockService getJobLockService()
    • setJobLockService

      public void setJobLockService(JobLockService jobLockService)
    • getRetryPeriodSeconds

      public int getRetryPeriodSeconds()
    • setContentModelSynchronizer

      public void setContentModelSynchronizer(ContentModelSynchronizer contentModelSynchronizer)
    • setElasticsearchIndexService

      public void setElasticsearchIndexService(ElasticsearchIndexService elasticsearchIndexService)
    • setCreateIndexIfNotExists

      public void setCreateIndexIfNotExists(boolean createIndexIfNotExists)
    • setRetryAttempts

      public void setRetryAttempts(int retryAttempts)
    • setLockRetryPeriodSeconds

      public void setLockRetryPeriodSeconds(int lockRetryPeriodSeconds)
    • setRetryPeriodSeconds

      public void setRetryPeriodSeconds(int retryPeriodSeconds)
    • setLockRetryAttempts

      public void setLockRetryAttempts(int lockRetryAttempts)