2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.dal.proxy.config;
25 import java.util.Properties;
27 import org.onap.aai.sparky.util.ConfigHelper;
28 import org.onap.aai.sparky.viewandinspect.config.TierSupportUiConstants;
30 public class DataRouterConfig {
33 private String drUriSuffix;
34 private String certName;
35 private String keystorePassword;
36 private String keystore;
37 private int connectTimeout;
38 private int readTimeout;
40 public String getHost() {
44 public void setHost(String host) {
48 public String getPort() {
52 public void setPort(String port) {
56 public String getCertName() {
60 public void setCertName(String certName) {
61 this.certName = certName;
64 public String getKeystorePassword() {
65 return keystorePassword;
68 public void setKeystorePassword(String keystorePassword) {
69 this.keystorePassword = keystorePassword;
72 public String getKeystore() {
76 public void setKeystore(String keystore) {
77 this.keystore = keystore;
80 public int getConnectTimeout() {
81 return connectTimeout;
84 public void setConnectTimeout(int connectTimeout) {
85 this.connectTimeout = connectTimeout;
88 public int getReadTimeout() {
92 public void setReadTimeout(int readTimeout) {
93 this.readTimeout = readTimeout;
96 public String getDrUriSuffix() {
100 public void setDrUriSuffix(String drUriSuffix) {
101 this.drUriSuffix = drUriSuffix;
104 public DataRouterConfig(Properties props) {
110 Properties restProps = ConfigHelper.getConfigWithPrefix("data-router.rest", props);
111 host = restProps.getProperty(TierSupportUiConstants.IP_ADDRESS, "localhost");
112 port = restProps.getProperty(TierSupportUiConstants.PORT, "9502");
113 drUriSuffix = restProps.getProperty(TierSupportUiConstants.DR_URI_SUFFIX, "ui-request");
115 Integer.parseInt(restProps.getProperty(TierSupportUiConstants.DR_CONNECT_TIMEOUT, "5000"));
117 Integer.parseInt(restProps.getProperty(TierSupportUiConstants.DR_READ_TIMEOUT, "1000"));
119 Properties sslProps = ConfigHelper.getConfigWithPrefix("data-router.ssl", props);
120 certName = sslProps.getProperty(TierSupportUiConstants.DR_CERT_NAME, "aai-client-cert.p12");
121 keystorePassword = sslProps.getProperty(TierSupportUiConstants.DR_KEYSTORE_PASSWORD, "");
122 keystore = sslProps.getProperty(TierSupportUiConstants.DR_KEYSTORE, "tomcat_keystore");
126 public String toString() {
127 return "DataRouterConfig [host=" + host + ", port=" + port + ", drUriSuffix=" + drUriSuffix
128 + ", certName=" + certName + ", keystorePassword=" + keystorePassword + ", keystore="
129 + keystore + ", connectTimeout=" + connectTimeout + ", readTimeout=" + readTimeout + "]";