X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fmodelloader%2Fconfig%2FModelLoaderConfig.java;h=01505ba620bac611e7e31a56aefe413f79d1b97c;hb=7e6fe8c29c5a5cfa5caf6ab47b30280e1fc20432;hp=3f03bb563e340e10485891861bae11eb182e2ac9;hpb=6e4f04afea4c2d07fdd9c15eda38438c7baeb308;p=aai%2Fmodel-loader.git diff --git a/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java b/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java index 3f03bb5..01505ba 100644 --- a/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java +++ b/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java @@ -1,5 +1,5 @@ /** - * ============LICENSE_START======================================================= + * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. @@ -21,6 +21,8 @@ package org.onap.aai.modelloader.config; import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -43,6 +45,9 @@ public class ModelLoaderConfig implements IConfiguration { private static final String SUFFIX_KEYSTORE_FILE = "KEYSTORE_FILE"; private static final String SUFFIX_KEYSTORE_PASS = "KEYSTORE_PASSWORD"; + private static final String SUFFIX_TRUSTSTORE_FILE = "TRUSTSTORE_FILE"; + private static final String SUFFIX_TRUSTSTORE_PASS = "TRUSTSTORE_PASSWORD"; + // Configuration file properties protected static final String PROP_ML_DISTRIBUTION_ACTIVE_SERVER_TLS_AUTH = PREFIX_DISTRIBUTION_CLIENT + "ACTIVE_SERVER_TLS_AUTH"; @@ -80,32 +85,21 @@ public class ModelLoaderConfig implements IConfiguration { protected static final String PROP_BABEL_BASE_URL = PREFIX_BABEL + "BASE_URL"; protected static final String PROP_BABEL_KEYSTORE_FILE = PREFIX_BABEL + SUFFIX_KEYSTORE_FILE; protected static final String PROP_BABEL_KEYSTORE_PASSWORD = PREFIX_BABEL + SUFFIX_KEYSTORE_PASS; + protected static final String PROP_BABEL_TRUSTSTORE_FILE = PREFIX_BABEL + SUFFIX_TRUSTSTORE_FILE; + protected static final String PROP_BABEL_TRUSTSTORE_PASSWORD = PREFIX_BABEL + SUFFIX_TRUSTSTORE_PASS; protected static final String PROP_BABEL_GENERATE_RESOURCE_URL = PREFIX_BABEL + "GENERATE_ARTIFACTS_URL"; protected static final String PROP_DEBUG_INGEST_SIMULATOR = PREFIX_DEBUG + "INGEST_SIMULATOR"; - private static String configHome; + protected static final String FILESEP = + (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator"); + private static String configHome; private Properties modelLoaderProperties = null; - private String certLocation = "."; - private List artifactTypes = null; - private List msgBusAddrs = null; - private String modelVersion = null; - protected static final String FILESEP = - (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator"); - - public static void setConfigHome(String configHome) { - ModelLoaderConfig.configHome = configHome; - } - - public static String propertiesFile() { - return configHome + FILESEP + "model-loader.properties"; - } - public ModelLoaderConfig(Properties configProperties) { this(configProperties, ModelLoaderConfig.configHome + FILESEP + "auth" + FILESEP); } @@ -139,11 +133,18 @@ public class ModelLoaderConfig implements IConfiguration { } } + public static void setConfigHome(String configHome) { + ModelLoaderConfig.configHome = configHome; + } + + public static Path propertiesFile() { + return Paths.get(configHome, "model-loader.properties"); + } @Override public boolean activateServerTLSAuth() { String value = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ACTIVE_SERVER_TLS_AUTH); - return value == null ? false : Boolean.parseBoolean(value); + return value != null && Boolean.parseBoolean(value); } @Override @@ -209,7 +210,7 @@ public class ModelLoaderConfig implements IConfiguration { @Override public Boolean isUseHttpsWithDmaap() { String useHTTPS = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_HTTPS_WITH_DMAAP); - return useHTTPS == null ? false : Boolean.valueOf(useHTTPS); + return useHTTPS != null && Boolean.valueOf(useHTTPS); } @Override @@ -227,7 +228,7 @@ public class ModelLoaderConfig implements IConfiguration { return null; } else { return certLocation + File.separator + filename; - } + } } public String getAaiKeyStorePassword() { @@ -238,6 +239,19 @@ public class ModelLoaderConfig implements IConfiguration { return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_BABEL_KEYSTORE_PASSWORD)); } + public String getBabelTrustStorePath() { + String filename = modelLoaderProperties.getProperty(PROP_BABEL_TRUSTSTORE_FILE); + if (filename == null) { + return null; + } else { + return certLocation + File.separator + filename; + } + } + + public String getBabelTrustStorePassword() { + return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_BABEL_TRUSTSTORE_PASSWORD)); + } + public String getAaiBaseUrl() { return modelLoaderProperties.getProperty(PROP_AAI_BASE_URL); }