Updating Dockerfile
[aai/sparky-be.git] / src / main / java / org / onap / aai / sparky / dal / proxy / config / DataRouterConfig.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
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
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
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=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 package org.onap.aai.sparky.dal.proxy.config;
24
25 import java.util.Properties;
26
27 import org.onap.aai.sparky.util.ConfigHelper;
28 import org.onap.aai.sparky.viewandinspect.config.TierSupportUiConstants;
29
30 public class DataRouterConfig {
31   private String host;
32   private String port;
33   private String drUriSuffix;
34   private String certName;
35   private String keystorePassword;
36   private String keystore;
37   private int connectTimeout;
38   private int readTimeout;
39
40   public String getHost() {
41     return host;
42   }
43
44   public void setHost(String host) {
45     this.host = host;
46   }
47
48   public String getPort() {
49     return port;
50   }
51
52   public void setPort(String port) {
53     this.port = port;
54   }
55
56   public String getCertName() {
57     return certName;
58   }
59
60   public void setCertName(String certName) {
61     this.certName = certName;
62   }
63
64   public String getKeystorePassword() {
65     return keystorePassword;
66   }
67
68   public void setKeystorePassword(String keystorePassword) {
69     this.keystorePassword = keystorePassword;
70   }
71
72   public String getKeystore() {
73     return keystore;
74   }
75
76   public void setKeystore(String keystore) {
77     this.keystore = keystore;
78   }
79
80   public int getConnectTimeout() {
81     return connectTimeout;
82   }
83
84   public void setConnectTimeout(int connectTimeout) {
85     this.connectTimeout = connectTimeout;
86   }
87
88   public int getReadTimeout() {
89     return readTimeout;
90   }
91
92   public void setReadTimeout(int readTimeout) {
93     this.readTimeout = readTimeout;
94   }
95
96   public String getDrUriSuffix() {
97     return drUriSuffix;
98   }
99
100   public void setDrUriSuffix(String drUriSuffix) {
101     this.drUriSuffix = drUriSuffix;
102   }
103
104   public DataRouterConfig(Properties props) {
105
106     if (props == null) {
107       return;
108     }
109
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");
114     connectTimeout =
115         Integer.parseInt(restProps.getProperty(TierSupportUiConstants.DR_CONNECT_TIMEOUT, "5000"));
116     readTimeout =
117         Integer.parseInt(restProps.getProperty(TierSupportUiConstants.DR_READ_TIMEOUT, "1000"));
118
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");
123   }
124
125   @Override
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 + "]";
130   }
131
132 }