diff options
author | vasraz <vasyl.razinkov@est.tech> | 2022-02-26 17:22:58 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2022-02-26 18:25:12 +0000 |
commit | 4b978c9cc115c4f4032d5f3dbc4d3cde002449cc (patch) | |
tree | b3986d499eb989c5210a25522258c6678b691dd3 /openecomp-be/lib/openecomp-common-lib | |
parent | d0c2403f1f7088d60b135976c40917302daf8b9e (diff) |
Implement improved MinIo client
Change-Id: Ic9abd6b0bdaa17e9deff2279a64416d81f7ad606
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3886
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib')
-rw-r--r-- | openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java index 46747fb881..92ace445da 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/CommonConfigurationManager.java @@ -19,21 +19,21 @@ */ package org.openecomp.sdc.common; -import org.onap.sdc.tosca.services.YamlUtil; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashMap; import java.util.Map; import java.util.function.BiConsumer; +import org.onap.sdc.tosca.services.YamlUtil; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; /** - * This is a common class that can access the config file given in input to the JVM with the parameter - * -Dconfiguration.yaml=file.yaml. + * This is a common class that can access the config file given in input to the JVM with the parameter -Dconfiguration.yaml=file.yaml. */ public class CommonConfigurationManager { + public static final String JVM_PARAM_CONFIGURATION_FILE = "configuration.yaml"; private static final Logger LOGGER = LoggerFactory.getLogger(CommonConfigurationManager.class); private static CommonConfigurationManager singletonInstance; @@ -57,6 +57,10 @@ public class CommonConfigurationManager { return singletonInstance; } + public void reload() { + initConfiguration(); + } + private void initConfiguration() { YamlUtil yamlUtil = new YamlUtil(); readConfigurationFromStream(yamlUtil, (filename, stream) -> { @@ -106,7 +110,7 @@ public class CommonConfigurationManager { Map<String, Object> section = this.configuration.get(yamlSection); if (section == null) { LOGGER.error("Section " + yamlSection + " is missing in configuration file '" + configFilename + - "'. Using defaults"); + "'. Using defaults"); return defaultValue; } Object value = section.get(name); @@ -114,15 +118,14 @@ public class CommonConfigurationManager { return value == null ? defaultValue : (T) value; } catch (ClassCastException e) { LOGGER.warn( - String.format("Failed to read configuration property '%s' as requested type. Using default '%s'", - name, defaultValue), e); + String.format("Failed to read configuration property '%s' as requested type. Using default '%s'", + name, defaultValue), e); return defaultValue; } } /** - * This method can be used to access a specific configuration parameter in the configuration in the - * yamlSection predefined in the constructor. + * This method can be used to access a specific configuration parameter in the configuration in the yamlSection predefined in the constructor. * * @param name The name of the config * @param defaultValue A default value |