2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
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 at
13 * http://www.apache.org/licenses/LICENSE-2.0
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=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 package org.openecomp.sparky.dal.sas.config;
28 import java.util.Properties;
30 import org.openecomp.sparky.util.ConfigHelper;
31 import org.openecomp.sparky.viewandinspect.config.TierSupportUiConstants;
34 * The Class ElasticSearchConfig.
36 public class SearchServiceConfig {
38 public static final String CONFIG_FILE =
39 TierSupportUiConstants.DYNAMIC_CONFIG_APP_LOCATION + "search-service.properties";
41 private static SearchServiceConfig instance;
43 private String ipAddress;
45 private String httpPort;
47 private String indexName;
49 private String auditIndexName;
51 private String topographicalSearchIndex;
53 private String entityCountHistoryIndex;
55 private String version;
59 private String certName;
61 private String keystorePassword;
63 private String keystore;
65 private static final String IP_ADDRESS_DEFAULT = "localhost";
67 private static final String HTTP_PORT_DEFAULT = "9509";
69 private static final String INDEX_NAME_DEFAULT = "entitySearchIndex-localhost";
71 private static final String AUDIT_INDEX_NAME_DEFAULT = "di-violations";
73 private static final String TOPOGRAPHICAL_INDEX_NAME_DEFAULT =
74 "topographicalsearchindex-localhost";
76 private static final String ENTITY_COUNT_HISTORY_INDEX_NAME_DEFAULT =
77 "entitycounthistoryindex-localhost";
79 private static final String VERSION_DEFAULT = "v1";
81 public static SearchServiceConfig getConfig() throws Exception {
83 if (instance == null) {
84 instance = new SearchServiceConfig();
85 instance.initializeProperties();
91 public static void setConfig(SearchServiceConfig config) {
92 SearchServiceConfig.instance = config;
96 * Instantiates a new search service config.
98 public SearchServiceConfig() {
103 * Initialize properties.
105 private void initializeProperties() {
106 Properties props = ConfigHelper.loadConfigFromExplicitPath(CONFIG_FILE);
108 Properties sasProps = ConfigHelper.getConfigWithPrefix("search-service", props);
110 ipAddress = sasProps.getProperty("ipAddress", IP_ADDRESS_DEFAULT);
111 httpPort = sasProps.getProperty("httpPort", "" + HTTP_PORT_DEFAULT);
112 version = sasProps.getProperty("version", "" + VERSION_DEFAULT);
113 indexName = sasProps.getProperty("indexName", INDEX_NAME_DEFAULT);
114 auditIndexName = sasProps.getProperty("auditIndexName", AUDIT_INDEX_NAME_DEFAULT);
115 topographicalSearchIndex = sasProps.getProperty("topographicalIndexName",
116 TOPOGRAPHICAL_INDEX_NAME_DEFAULT);
117 entityCountHistoryIndex = sasProps.getProperty("entityCountHistoryIndexName",
118 ENTITY_COUNT_HISTORY_INDEX_NAME_DEFAULT);
120 sasProps.getProperty("ssl.cert-name", "aai-client-cert.p12");
121 keystorePassword = sasProps.getProperty("ssl.keystore-password",
122 "OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o");
123 keystore = sasProps.getProperty("ssl.keystore", "tomcat_keystore");
126 public String getIpAddress() {
130 public void setIpAddress(String ipAddress) {
131 this.ipAddress = ipAddress;
134 public String getHttpPort() {
138 public void setHttpPort(String httpPort) {
139 this.httpPort = httpPort;
142 public String getIndexName() {
146 public void setIndexName(String indexName) {
147 this.indexName = indexName;
150 public String getVersion() {
154 public void setVersion(String version) {
155 this.version = version;
158 public String getAuditIndexName() {
159 return auditIndexName;
162 public void setAuditIndexName(String auditIndexName) {
163 this.auditIndexName = auditIndexName;
166 public String getTopographicalSearchIndex() {
167 return topographicalSearchIndex;
170 public void setTopographicalSearchIndex(String topographicalSearchIndex) {
171 this.topographicalSearchIndex = topographicalSearchIndex;
174 public String getEntityCountHistoryIndex() {
175 return entityCountHistoryIndex;
178 public void setEntityCountHistoryIndex(String entityCountHistoryIndex) {
179 this.entityCountHistoryIndex = entityCountHistoryIndex;
182 public String getType() {
186 public void setType(String type) {
191 public String getCertName() {
195 public void setCertName(String certName) {
196 this.certName = certName;
199 public String getKeystorePassword() {
200 return keystorePassword;
203 public void setKeystorePassword(String keystorePassword) {
204 this.keystorePassword = keystorePassword;
207 public String getKeystore() {
211 public void setKeystore(String keystore) {
212 this.keystore = keystore;
216 public String toString() {
217 return "SearchServiceConfig [ipAddress=" + ipAddress + ", httpPort=" + httpPort + ", indexName="
218 + indexName + ", auditIndexName=" + auditIndexName + ", topographicalSearchIndex="
219 + topographicalSearchIndex + ", entityCountHistoryIndex=" + entityCountHistoryIndex
220 + ", version=" + version + ", type=" + type + "]";