X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fservice%2FModelLoaderService.java;fp=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fservice%2FModelLoaderService.java;h=c338e5b90b42472d699104b74a8e2625c85ed60f;hb=27bfb89b0879b1bda93b3b55a418154ea366509e;hp=35d8adad7f41775d308bac9818d138f875fbcbf5;hpb=b4da0587a12a4649007b7fbbd36b7f47399cd63c;p=aai%2Fmodel-loader.git 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(); }