Initial search service commit
[aai/search-data-service.git] / src / main / java / org / openecomp / sa / searchdbabstraction / elasticsearch / config / ElasticSearchConfig.java
1 /**
2  * ============LICENSE_START=======================================================
3  * Search Data Service
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License ati
12  *
13  *    http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25 package org.openecomp.sa.searchdbabstraction.elasticsearch.config;
26
27 import java.util.Properties;
28
29 public class ElasticSearchConfig {
30   private String ipAddress;
31   private String httpPort;
32   private String javaApiPort;
33   private String clusterName;
34
35   public static final String ES_CLUSTER_NAME = "es.cluster-name";
36   public static final String ES_IP_ADDRESS = "es.ip-address";
37   public static final String ES_HTTP_PORT = "es.http-port";
38
39   private static final String JAVA_API_PORT_DEFAULT = "9300";
40
41   public ElasticSearchConfig(Properties props) {
42
43     setClusterName(props.getProperty(ES_CLUSTER_NAME));
44     setIpAddress(props.getProperty(ES_IP_ADDRESS));
45     setHttpPort(props.getProperty(ES_HTTP_PORT));
46     setJavaApiPort(JAVA_API_PORT_DEFAULT);
47   }
48
49   public String getIpAddress() {
50     return ipAddress;
51   }
52
53   public void setIpAddress(String ipAddress) {
54     this.ipAddress = ipAddress;
55   }
56
57   public String getHttpPort() {
58     return httpPort;
59   }
60
61   public void setHttpPort(String httpPort) {
62     this.httpPort = httpPort;
63   }
64
65   public String getJavaApiPort() {
66     return javaApiPort;
67   }
68
69   public void setJavaApiPort(String javaApiPort) {
70     this.javaApiPort = javaApiPort;
71   }
72
73   public String getClusterName() {
74     return clusterName;
75   }
76
77   public void setClusterName(String clusterName) {
78     this.clusterName = clusterName;
79   }
80
81   @Override
82   public String toString() {
83     return "ElasticSearchConfig [ipAddress=" + ipAddress + ", httpPort=" + httpPort
84         + ", javaApiPort=" + javaApiPort + ", clusterName=" + clusterName + "]";
85   }
86
87 }