summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dcae/ApplicationSettings.java
diff options
context:
space:
mode:
authorZlatko Murgoski <zlatko.murgoski@nokia.com>2019-02-04 09:27:00 +0100
committerZlatko Murgoski <zlatko.murgoski@nokia.com>2019-03-01 07:50:28 +0100
commite7360f7e7e77672b885087af68a3d96ebbc8c313 (patch)
tree8316d86334ec400b48f5a7a6a862fe7ffd9b9867 /src/main/java/org/onap/dcae/ApplicationSettings.java
parent8971ae1e6ccc99811663652819206231065b1755 (diff)
Restart Issue
Restart Issue Issue-ID: DCAEGEN2-1104 Change-Id: Iac1ee2f79be00084f5c0cd963503d54d7d6e6cb9 Signed-off-by: Zlatko Murgoski <zlatko.murgoski@nokia.com>
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();