Class IndexManagerImpl

java.lang.Object
com.flowable.indexing.IndexManagerImpl
All Implemented Interfaces:
IndexManager, InitializingBean, Lifecycle, Phased, SmartLifecycle

public class IndexManagerImpl extends Object implements IndexManager, SmartLifecycle, InitializingBean
  • Field Details

  • Constructor Details

  • Method Details

    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface Phased
      Specified by:
      getPhase in interface SmartLifecycle
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
    • processResources

      protected void processResources()
    • processMappingExtensionResources

      protected Map<String,List<com.fasterxml.jackson.databind.JsonNode>> processMappingExtensionResources()
    • validateMappingExtensionJson

      protected boolean validateMappingExtensionJson(Resource mappingExtensionResource, com.fasterxml.jackson.databind.JsonNode mappingExtensionJson)
    • processMappingResources

      protected void processMappingResources(Map<String,List<com.fasterxml.jackson.databind.JsonNode>> mappingExtensionConfigurations)
    • processVariableMappings

      protected void processVariableMappings(CustomIndexMapping indexMapping, com.fasterxml.jackson.databind.JsonNode jsonNode)
    • enhanceMappingWithExtension

      protected void enhanceMappingWithExtension(Map<String,List<com.fasterxml.jackson.databind.JsonNode>> mappingExtensionConfigurations, CustomIndexConfiguration customIndexConfiguration, String indexName)
    • enhanceProperties

      protected void enhanceProperties(Map<String,List<com.fasterxml.jackson.databind.JsonNode>> mappingExtensionConfigurations, CustomIndexConfiguration customIndexConfiguration, String indexName)
    • enhanceVariableProperties

      protected void enhanceVariableProperties(Map<String,List<com.fasterxml.jackson.databind.JsonNode>> mappingExtensionConfigurations, CustomIndexConfiguration customIndexConfiguration, String indexName)
    • enhanceSettings

      protected void enhanceSettings(Map<String,List<com.fasterxml.jackson.databind.JsonNode>> mappingExtensionConfigurations, CustomIndexConfiguration customIndexConfiguration, String indexName)
    • getIndexNamePrefix

      public String getIndexNamePrefix()
      Description copied from interface: IndexManager
      Returns the prefix that is added to all indices. Empty by default.
      Specified by:
      getIndexNamePrefix in interface IndexManager
    • setIndexNamePrefix

      public void setIndexNamePrefix(String indexNamePrefix)
    • getESIndexName

      public String getESIndexName(String indexName)
      Description copied from interface: IndexManager
      Returns the internal index name for the provided raw index name. As there might be an index-prefix in place, the index name towards the Elasticsearch client needs to use the internal name though which is returned using this method.
      Specified by:
      getESIndexName in interface IndexManager
      Parameters:
      indexName - the index name as being used in configuration, query DSL and API
      Returns:
      the index name as being used towards Elasticsearch (might have a prefix)
    • createIndexWithAlias

      public com.fasterxml.jackson.databind.JsonNode createIndexWithAlias(String indexName)
      Description copied from interface: IndexManager
      Creates an index. The index mapping that is used will need to have as 'name' the passed index name. In fact, creates both an alias with the given name and the actual index, prefixed with the project name and with a timestamp. This allows later to change indices, but keep the alias and reindex.
      Specified by:
      createIndexWithAlias in interface IndexManager
    • createIndexWithoutAlias

      public String createIndexWithoutAlias(String indexName)
      Description copied from interface: IndexManager
      Similar to IndexManager.createIndexWithAlias(String), but doesn't create an alias, only the index with the mapping. Note that the index will still follow the aliasName-timeStamp pattern. Note that the mapping will be looked up based on the name passed.
      Specified by:
      createIndexWithoutAlias in interface IndexManager
    • createIndexAndAlias

      public com.fasterxml.jackson.databind.JsonNode createIndexAndAlias(String alias, String indexMapping)
    • getCustomQueryMapping

      public IndexMapping getCustomQueryMapping(String indexName, String mappingName)
      Description copied from interface: IndexManager
      Get custom query mapping for given index if exists.
      Specified by:
      getCustomQueryMapping in interface IndexManager
    • deleteAliasAndRelatedIndices

      public void deleteAliasAndRelatedIndices(String indexName)
      Description copied from interface: IndexManager
      Deletes the given index and all its aliases. Or, when the name is an alias, deletes the alias and all indices.
      Specified by:
      deleteAliasAndRelatedIndices in interface IndexManager
    • deleteIndex

      public void deleteIndex(String indexName)
      Description copied from interface: IndexManager
      Deletes the index with the given name. Does not delete the alias, if one exists.
      Specified by:
      deleteIndex in interface IndexManager
    • deleteAllKnownIndices

      public void deleteAllKnownIndices()
      Description copied from interface: IndexManager
      Deletes all indices registered in the system
      Specified by:
      deleteAllKnownIndices in interface IndexManager
    • enhanceIndexName

      protected String enhanceIndexName(String indexName)
    • isKnownIndex

      public boolean isKnownIndex(String index)
      Description copied from interface: IndexManager
      Returns whether the index is a known mapped index. This is useful when parsing queries.
      Specified by:
      isKnownIndex in interface IndexManager
    • findMatchingIndexMappings

      public List<IndexMapping> findMatchingIndexMappings(com.fasterxml.jackson.databind.node.ObjectNode objectNode)
      Description copied from interface: IndexManager
      Returns a list of IndexMapping instances that are applicable for the provided data.
      Specified by:
      findMatchingIndexMappings in interface IndexManager
    • findMatchingIndexMappings

      public List<IndexMapping> findMatchingIndexMappings(String mappingType)
      Description copied from interface: IndexManager
      Returns a list of IndexMapping(s) that are applicable for the provided mapping type.
      Specified by:
      findMatchingIndexMappings in interface IndexManager
    • findMatchingCustomMappings

      public List<IndexMapping> findMatchingCustomMappings(String indexName)
      Description copied from interface: IndexManager
      Returns a list of IndexMapping(s) that are applicable for the provided index name.
      Specified by:
      findMatchingCustomMappings in interface IndexManager
    • findIndexMapping

      public IndexMapping findIndexMapping(String indexName)
      Specified by:
      findIndexMapping in interface IndexManager
    • getIndexConfiguration

      public CustomIndexConfiguration getIndexConfiguration(String indexName)
      Description copied from interface: IndexManager
      Returns the mapping information for the given index.
      Specified by:
      getIndexConfiguration in interface IndexManager
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      Exception
    • createIndexesAndCustomAliasesFromMappings

      public void createIndexesAndCustomAliasesFromMappings()
      Specified by:
      createIndexesAndCustomAliasesFromMappings in interface IndexManager
    • updateIndexMetaData

      protected void updateIndexMetaData(Map<String,com.fasterxml.jackson.databind.JsonNode> indicesMetaData, Map<String,List<com.fasterxml.jackson.databind.JsonNode>> aliasesMetaData)
    • updateIndexAndMappingMetaData

      protected void updateIndexAndMappingMetaData(String index, com.fasterxml.jackson.databind.JsonNode metaData)
    • createCustomMappings

      protected void createCustomMappings()
    • recreateMapping

      public IndexMapping recreateMapping(IndexMapping indexMapping)
      Description copied from interface: IndexManager
      Used to recreate mapping if CustomIndexConfiguration changed.
      Specified by:
      recreateMapping in interface IndexManager
      Returns:
      Updated indexMapping
    • createCustomAliasesFromMappings

      protected Map<String,List<com.fasterxml.jackson.databind.JsonNode>> createCustomAliasesFromMappings(Map<String,com.fasterxml.jackson.databind.JsonNode> indexMetaData)
    • updateExistingAliasMapping

      protected void updateExistingAliasMapping(IndexMapping customMapping)
    • createIndexesFromMappings

      public Map<String,com.fasterxml.jackson.databind.JsonNode> createIndexesFromMappings()
      Description copied from interface: IndexManager
      Creates the indices for all known mappings
      Specified by:
      createIndexesFromMappings in interface IndexManager
    • updateExistingMappingIfNeeded

      protected com.fasterxml.jackson.databind.JsonNode updateExistingMappingIfNeeded(String indexName, IndexMapping indexMapping)
    • compareExtensionMetadata

      protected boolean compareExtensionMetadata(com.fasterxml.jackson.databind.JsonNode currentMapping, com.fasterxml.jackson.databind.JsonNode updateMapping)
    • getMappingDelta

      protected com.fasterxml.jackson.databind.node.ObjectNode getMappingDelta(com.fasterxml.jackson.databind.JsonNode currentMapping, com.fasterxml.jackson.databind.JsonNode updateMapping, String currentType)
    • createCustomAlias

      protected void createCustomAlias(String alias, String indexMapping)
    • logElasticsearchVersionInformation

      protected void logElasticsearchVersionInformation()
    • reloadIndices

      public boolean reloadIndices()
      Description copied from interface: IndexManager
      Reloads all indexes
      Specified by:
      reloadIndices in interface IndexManager
    • reloadIndex

      public boolean reloadIndex(String indexName)
      Description copied from interface: IndexManager
      Reloads selected index
      Specified by:
      reloadIndex in interface IndexManager
    • getLockManagerProvider

      public Function<String,LockManager> getLockManagerProvider()
    • setLockManagerProvider

      public void setLockManagerProvider(Function<String,LockManager> lockManagerProvider)
    • getMappingResources

      public Resource[] getMappingResources()
    • setMappingResources

      public void setMappingResources(Resource[] mappingResources)
    • getMappingExtensionResources

      public Resource[] getMappingExtensionResources()
    • setMappingExtensionResources

      public void setMappingExtensionResources(Resource[] mappingExtensionResources)