org.hibernate.search.elasticsearch.schema.impl

## Class Elasticsearch2SchemaValidator

- java.lang.Object
- - org.hibernate.search.elasticsearch.schema.impl.Elasticsearch2SchemaValidator

- All Implemented Interfaces:
    ElasticsearchSchemaValidator
  Direct Known Subclasses:
    Elasticsearch50SchemaValidator

      public class Elasticsearch2SchemaValidator
      extends Object
      implements ElasticsearchSchemaValidator

  An `ElasticsearchSchemaValidator` implementation for Elasticsearch 2.

  Important implementation note: unexpected attributes (i.e. those not mapped to a field in TypeMapping) are totally ignored. This allows users to leverage Elasticsearch features that are not supported in Hibernate Search, by setting those attributes manually.

  Author:
    Yoann Rodiere

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Elasticsearch2SchemaValidator(ElasticsearchSchemaAccessor schemaAccessor)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doValidateJsonPrimitive(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, DataType type, String attributeName, com.google.gson.JsonPrimitive expectedValue, com.google.gson.JsonPrimitive actualValue)`
    `protected String` | `formatContextElement(org.hibernate.search.elasticsearch.schema.impl.ValidationContextType type, String name)`
    `boolean` | `isSettingsValid(IndexMetadata expectedIndexMetadata, ExecutionOptions executionOptions)` Retrieves and validate actual index settings, returning a boolean indicating whether the actual settings are valid or not.
    `void` | `validate(IndexMetadata expectedIndexMetadata, ExecutionOptions executionOptions)` Retrieves and validate actual index metadata, throwing an exception if validation fails.
    `protected <T> void` | `validateAll(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, org.hibernate.search.elasticsearch.schema.impl.ValidationContextType type, String messageIfMissing, org.hibernate.search.elasticsearch.schema.impl.Elasticsearch2SchemaValidator.Validator<T> validator, Map<String,T> expectedMap, Map<String,T> actualMap)`
    `protected void` | `validateAnalysisSettings(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, IndexSettings.Analysis expectedAnalysis, IndexSettings.Analysis actualAnalysis)`
    `protected void` | `validateAnalyzerOptions(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, PropertyMapping expectedMapping, PropertyMapping actualMapping)`
    `protected <T> void` | `validateEqualWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, String attributeName, Double expectedValue, Double actualValue, double delta, Double defaultValueForNulls)`
    `protected <T> void` | `validateEqualWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, String attributeName, Float expectedValue, Float actualValue, float delta, Float defaultValueForNulls)`
    `protected <T> void` | `validateEqualWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, String attributeName, T expectedValue, T actualValue, T defaultValueForNulls)`
    `protected <T> void` | `validateFormatWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, String attributeName, List<String> expectedValue, List<String> actualValue, List<String> defaultValueForNulls)`
    `protected void` | `validateIndexOptions(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, PropertyMapping expectedMapping, PropertyMapping actualMapping)`
    `protected void` | `validateJsonPrimitive(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector, DataType type, String attributeName, com.google.gson.JsonPrimitive expectedValue, com.google.gson.JsonPrimitive actualValue)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Elasticsearch2SchemaValidator

          public Elasticsearch2SchemaValidator(ElasticsearchSchemaAccessor schemaAccessor)

  - ### Method Detail

    - #### validate

          public void validate(IndexMetadata expectedIndexMetadata,
                               ExecutionOptions executionOptions)

      Description copied from interface: `ElasticsearchSchemaValidator`
      Retrieves and validate actual index metadata, throwing an exception if validation fails.

      The metadata mainly contain the type mappings and the index settings.

      Specified by:
        `validate` in interface `ElasticsearchSchemaValidator`
      Parameters:
        `expectedIndexMetadata` - The expected metadata, generated by Hibernate Search.
        `executionOptions` - The execution options, giving more context information.

    - #### isSettingsValid

          public boolean isSettingsValid(IndexMetadata expectedIndexMetadata,
                                         ExecutionOptions executionOptions)

      Description copied from interface: `ElasticsearchSchemaValidator`
      Retrieves and validate actual index settings, returning a boolean indicating whether the actual settings are valid or not.
      Specified by:
        `isSettingsValid` in interface `ElasticsearchSchemaValidator`
      Parameters:
        `expectedIndexMetadata` - The expected metadata, generated by Hibernate Search.
        `executionOptions` - The execution options, giving more context information.
      Returns:
        `true` if the actual settings are valid, `false` otherwise.

    - #### formatContextElement

          protected String formatContextElement(org.hibernate.search.elasticsearch.schema.impl.ValidationContextType type,
                                                String name)

    - #### validateAnalysisSettings

          protected void validateAnalysisSettings(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                  IndexSettings.Analysis expectedAnalysis,
                                                  IndexSettings.Analysis actualAnalysis)

    - #### validateEqualWithDefault

          protected <T> void validateEqualWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                      String attributeName,
                                                      T expectedValue,
                                                      T actualValue,
                                                      T defaultValueForNulls)

    - #### validateEqualWithDefault

          protected <T> void validateEqualWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                      String attributeName,
                                                      Float expectedValue,
                                                      Float actualValue,
                                                      float delta,
                                                      Float defaultValueForNulls)

    - #### validateEqualWithDefault

          protected <T> void validateEqualWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                      String attributeName,
                                                      Double expectedValue,
                                                      Double actualValue,
                                                      double delta,
                                                      Double defaultValueForNulls)

    - #### validateFormatWithDefault

          protected <T> void validateFormatWithDefault(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                       String attributeName,
                                                       List<String> expectedValue,
                                                       List<String> actualValue,
                                                       List<String> defaultValueForNulls)

    - #### validateJsonPrimitive

          protected final void validateJsonPrimitive(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                     DataType type,
                                                     String attributeName,
                                                     com.google.gson.JsonPrimitive expectedValue,
                                                     com.google.gson.JsonPrimitive actualValue)

    - #### doValidateJsonPrimitive

          protected void doValidateJsonPrimitive(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                 DataType type,
                                                 String attributeName,
                                                 com.google.gson.JsonPrimitive expectedValue,
                                                 com.google.gson.JsonPrimitive actualValue)

    - #### validateAll

          protected <T> void validateAll(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                         org.hibernate.search.elasticsearch.schema.impl.ValidationContextType type,
                                         String messageIfMissing,
                                         org.hibernate.search.elasticsearch.schema.impl.Elasticsearch2SchemaValidator.Validator<T> validator,
                                         Map<String,T> expectedMap,
                                         Map<String,T> actualMap)

    - #### validateIndexOptions

          protected void validateIndexOptions(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                              PropertyMapping expectedMapping,
                                              PropertyMapping actualMapping)

    - #### validateAnalyzerOptions

          protected void validateAnalyzerOptions(org.hibernate.search.elasticsearch.schema.impl.ValidationErrorCollector errorCollector,
                                                 PropertyMapping expectedMapping,
                                                 PropertyMapping actualMapping)

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved