1 package org.opendaylight.mwtn.config.impl;
4 import java.io.FileInputStream;
5 import java.io.IOException;
6 import java.util.Properties;
8 public class AaiClientPropertiesFile{
10 private final File mFile;
11 private String mPCKS12CertFilename;
12 private String mPCKS12Passphrase;
13 private boolean mTrustInsecureSSL;
14 private String mApplicationIdentifier;
15 private String mRemoteUrl;
16 private int mConnectionTimeout;
17 private int mReadTimeout;
19 public String getFilename()
20 { return this.mFile.getAbsolutePath(); }
21 public String getPCKS12CertFilename()
22 {return this.mPCKS12CertFilename;}
23 public String getPCKS12Passphrase()
24 {return this.mPCKS12Passphrase; }
25 public boolean trustInsecureSSL()
26 {return this.mTrustInsecureSSL;}
27 public String getApplicationIdentifier()
28 {return this.mApplicationIdentifier;}
29 public String getRemoteUrl()
30 {return this.mRemoteUrl;}
31 public int getConnectionTimeout()
32 {return this.mConnectionTimeout;}
33 public int getReadTimeout()
34 {return this.mReadTimeout;}
36 public boolean exists()
37 {return this.mFile.exists();}
38 public AaiClientPropertiesFile(String filename)
40 this.mFile=new File(filename);
42 public void load() throws IOException,NumberFormatException
44 Properties defaultProps = new Properties();
45 FileInputStream in = new FileInputStream(this.mFile);
46 defaultProps.load(in);
47 this.mPCKS12CertFilename=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key",null);
48 this.mPCKS12Passphrase=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd",null);
49 this.mTrustInsecureSSL=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore","false").equals("true");
50 this.mApplicationIdentifier=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.application",null);
51 this.mRemoteUrl=defaultProps.getProperty("org.onap.ccsdk.sli.adaptors.aai.uri",null);
52 this.mConnectionTimeout=Integer.parseInt(defaultProps.getProperty("connection.timeout","60000"));
53 this.mReadTimeout=Integer.parseInt(defaultProps.getProperty("read.timeout","60000"));