org.hibernate.search.backend.elasticsearch.ElasticsearchDistributionName Maven / Gradle / Ivy
Show all versions of hibernate-search-backend-elasticsearch Show documentation
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.search.backend.elasticsearch;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.hibernate.search.backend.elasticsearch.logging.impl.Log;
import org.hibernate.search.engine.cfg.spi.ParseUtils;
import org.hibernate.search.util.common.logging.impl.LoggerFactory;
public enum ElasticsearchDistributionName {
/**
* The Elasticsearch distribution from Elastic.
*
* See: https://www.elastic.co/elasticsearch/.
*/
ELASTIC("elastic"),
/**
* The OpenSearch distribution from the OpenSearch organization.
*
* See: https://www.opensearch.org/.
*/
OPENSEARCH("opensearch");
private static final Log log = LoggerFactory.make( Log.class, MethodHandles.lookup() );
// This method conforms to the MicroProfile Config specification. Do not change its signature.
public static ElasticsearchDistributionName of(String value) {
return ParseUtils.parseDiscreteValues(
ElasticsearchDistributionName.values(),
ElasticsearchDistributionName::externalRepresentation,
log::invalidElasticsearchDistributionName,
value
);
}
static List allowedExternalRepresentations() {
return Arrays.stream( ElasticsearchDistributionName.values() )
.map( ElasticsearchDistributionName::externalRepresentation )
.collect( Collectors.toList() );
}
static ElasticsearchDistributionName defaultValue() {
return ElasticsearchDistributionName.ELASTIC;
}
private final String externalRepresentation;
ElasticsearchDistributionName(String externalRepresentation) {
this.externalRepresentation = externalRepresentation;
}
@Override
public String toString() {
return externalRepresentation;
}
/**
* @return The expected string representation in configuration properties.
*/
public String externalRepresentation() {
return externalRepresentation;
}
}