aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dcae/ApplicationSettings.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/dcae/ApplicationSettings.java')
-rw-r--r--src/main/java/org/onap/dcae/ApplicationSettings.java34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/main/java/org/onap/dcae/ApplicationSettings.java b/src/main/java/org/onap/dcae/ApplicationSettings.java
index 7d52c5e8..7a2bff97 100644
--- a/src/main/java/org/onap/dcae/ApplicationSettings.java
+++ b/src/main/java/org/onap/dcae/ApplicationSettings.java
@@ -69,11 +69,21 @@ public class ApplicationSettings {
Map<String, String> parsedArgs = argsParser.apply(args);
configurationFileLocation = findOutConfigurationFileLocation(parsedArgs);
loadPropertiesFromFile();
- parsedArgs.filterKeys(k -> !"c".equals(k)).forEach(this::updateProperty);
+ parsedArgs.filterKeys(k -> !"c".equals(k)).forEach(this::addOrUpdate);
loadedJsonSchemas = loadJsonSchemas();
}
- private void loadPropertiesFromFile() {
+
+ public void reloadProperties() {
+ try {
+ properties.load(configurationFileLocation);
+ properties.refresh();
+ } catch (ConfigurationException ex) {
+ log.error("Cannot load properties cause:", ex);
+ throw new ApplicationException(ex);
+ }
+ }
+ public void loadPropertiesFromFile() {
try {
properties.load(configurationFileLocation);
} catch (ConfigurationException ex) {
@@ -169,10 +179,6 @@ public class ApplicationSettings {
return httpsEnabled() && properties.getInt("collector.service.secure.clientauth", 0) > 0;
}
- public String keystoreAlias() {
- return properties.getString("collector.keystore.alias", "tomcat");
- }
-
public String truststorePasswordFileLocation() {
return prependWithUserDirOnRelative(properties.getString("collector.truststore.passwordfile", "etc/trustpasswordfile"));
}
@@ -198,6 +204,14 @@ public class ApplicationSettings {
}
}
+ public void addOrUpdate(String key, String value) {
+ if (properties.containsKey(key)) {
+ properties.setProperty(key, value);
+ } else {
+ properties.addProperty(key, value);
+ }
+ }
+
private JSONObject jsonSchema() {
return new JSONObject(properties.getString("collector.schema.file",
format("{\"%s\":\"etc/CommonEventFormat_28.4.1.json\"}", FALLBACK_VES_VERSION)));
@@ -214,14 +228,6 @@ public class ApplicationSettings {
return HashMap.ofAll(domainToStreamIdsMapping);
}
- private void updateProperty(String key, String value) {
- if (properties.containsKey(key)) {
- properties.setProperty(key, value);
- } else {
- properties.addProperty(key, value);
- }
- }
-
private String prependWithUserDirOnRelative(String filePath) {
if (!Paths.get(filePath).isAbsolute()) {
filePath = Paths.get(appInvocationDir, filePath).toString();