/**
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
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;
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";
protected static final String PROP_AAI_VNF_IMAGE_RESOURCE_URL = PREFIX_AAI + "VNF_IMAGE_URL";
protected static final String PROP_AAI_AUTHENTICATION_USER = PREFIX_AAI + "AUTH_USER";
protected static final String PROP_AAI_AUTHENTICATION_PASSWORD = PREFIX_AAI + "AUTH_PASSWORD";
+ protected static final String PROP_AAI_USE_GIZMO = PREFIX_AAI + "USE_GIZMO";
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<String> artifactTypes = null;
-
private List<String> 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);
}
}
}
+ 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
@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
return null;
} else {
return certLocation + File.separator + filename;
- }
+ }
}
public String getAaiKeyStorePassword() {
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);
}
this.modelVersion = modelVersion;
}
+ public boolean useGizmo() {
+ String useGizmo = modelLoaderProperties.getProperty(PROP_AAI_USE_GIZMO);
+
+ if ( (useGizmo == null) || (!useGizmo.equalsIgnoreCase("true")) ) {
+ return false;
+ }
+
+ return true;
+ }
+
/**
* @return password for AAI authentication that has been reverse-engineered from its obfuscated form.
*/