summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTian Lee <TianL@amdocs.com>2019-04-10 13:40:08 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-10 13:40:08 +0000
commit5a68aeb30038d6d1b2795e44c461b84486e4520a (patch)
treee5bd7694d50ac0153248a6f29666baaeee9e26fa
parentd5e399e0438c77a080ac70112dceedf4e16f89de (diff)
parent27bfb89b0879b1bda93b3b55a418154ea366509e (diff)
Merge "Provide the ability to set the truststore properties during model-loader startup"1.4.0
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java
index 35d8ada..c338e5b 100644
--- a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java
+++ b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java
@@ -83,6 +83,21 @@ public class ModelLoaderService implements ModelLoaderInterface {
try {
configProperties.load(Files.newInputStream(Paths.get(configDir, "model-loader.properties")));
config = new ModelLoaderConfig(configProperties);
+
+ // Set the truststore for SDC Client to connect to Dmaap central bus if applicable (as in case of TI)
+ if (config.isUseHttpsWithDmaap()) {
+ String trustStorePath = config.getKeyStorePath();
+ String trustStorePassword = config.getKeyStorePassword();
+ if (trustStorePath != null && Paths.get(trustStorePath).toFile().isFile() && trustStorePassword != null
+ && !trustStorePassword.isEmpty()) {
+ System.setProperty("javax.net.ssl.trustStore", trustStorePath);
+ System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
+ } else {
+ throw new IllegalArgumentException("Model Loader property ml.distribution.KEYSTORE_FILE "
+ + "or ml.distribution.KEYSTORE_PASSWORD not set or invalid");
+ }
+ }
+
if (!config.getASDCConnectionDisabled()) {
initSdcClient();
}