001/*
002 * (C) Copyright 2016 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Funsho David
018 */
019
020package org.nuxeo.elasticsearch.api;
021
022import org.elasticsearch.client.transport.TransportClient;
023import org.elasticsearch.common.settings.Settings;
024import org.nuxeo.elasticsearch.config.ElasticSearchRemoteConfig;
025
026/**
027 * This service enables the initialization of the Elasticsearch transport client and his settings
028 * @since 9.1
029 */
030public interface ESClientInitializationService {
031
032    /**
033     * Initialize Elasticsearch client settings
034     *
035     * @param config the cluster configuration
036     * @return the client settings
037     */
038    Settings initializeSettings(ElasticSearchRemoteConfig config);
039
040    /**
041     * Initialize Elasticsearch client
042     *
043     * @param settings the client settings
044     * @return the client
045     */
046    TransportClient initializeClient(Settings settings);
047
048    /**
049     * Get username if authentication is required
050     * 
051     * @return the username
052     */
053    String getUsername();
054
055    /**
056     * Set username for authentication
057     * 
058     * @param username the username
059     */
060    void setUsername(String username);
061
062    /**
063     * Get password if authentication is required
064     * 
065     * @return the password
066     */
067    String getPassword();
068
069    /**
070     * Set password for authentication
071     * 
072     * @param password the password
073     */
074    void setPassword(String password);
075
076}