2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.config;
21 import java.io.FileInputStream;
22 import java.io.IOException;
23 import java.util.Properties;
25 public class AaiClientPropertiesFile {
27 private final File mFile;
28 private String mPCKS12CertFilename;
29 private String mPCKS12Passphrase;
30 private boolean mTrustInsecureSSL;
31 private String mApplicationIdentifier;
32 private String mRemoteUrl;
33 private int mConnectionTimeout;
34 private int mReadTimeout;
36 public String getFilename() {
37 return this.mFile.getAbsolutePath();
40 public String getPCKS12CertFilename() {
41 return this.mPCKS12CertFilename;
44 public String getPCKS12Passphrase() {
45 return this.mPCKS12Passphrase;
48 public boolean trustInsecureSSL() {
49 return this.mTrustInsecureSSL;
52 public String getApplicationIdentifier() {
53 return this.mApplicationIdentifier;
56 public String getRemoteUrl() {
57 return this.mRemoteUrl;
60 public int getConnectionTimeout() {
61 return this.mConnectionTimeout;
64 public int getReadTimeout() {
65 return this.mReadTimeout;
68 public boolean exists() {
69 return this.mFile.exists();
72 public AaiClientPropertiesFile(String filename) {
73 this.mFile = new File(filename);
76 public void load() throws IOException, NumberFormatException {
77 Properties defaultProps = new Properties();
78 FileInputStream in = new FileInputStream(this.mFile);
79 defaultProps.load(in);
80 this.mPCKS12CertFilename = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key", null);
81 this.mPCKS12Passphrase = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd", null);
82 this.mTrustInsecureSSL = defaultProps
83 .getProperty("org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore", "false").equals("true");
84 this.mApplicationIdentifier = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.application", null);
85 this.mRemoteUrl = defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.uri", null);
86 this.mConnectionTimeout = Integer.parseInt(defaultProps.getProperty("connection.timeout", "60000"));
87 this.mReadTimeout = Integer.parseInt(defaultProps.getProperty("read.timeout", "60000"));