summaryrefslogtreecommitdiffstats
path: root/plugins/properties-node/provider/src
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-02-17 15:25:45 -0500
committerDan Timoney <dtimoney@att.com>2021-02-18 16:05:55 -0500
commit69e393da4cce52a0491fffff2dc81fbe59aeca08 (patch)
tree404cc750fa69ba2a89c7a2fce921da34db5edda4 /plugins/properties-node/provider/src
parent56c27daf1656fd6436f8c818c771cf803079e1ea (diff)
Add new EnvProperties class
Added new class EnvProperties, which extends java.util.Properties and supports property values containing embedded environment variable references. Updated code to use this class to load svclogic.properties, and updated dmaap listener to use that class to load dmaap listener configuration. Issue-ID: SDNC-1482 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: I7538b719631d8c10c27d059aeb4f70ce92760ebd
Diffstat (limited to 'plugins/properties-node/provider/src')
-rw-r--r--plugins/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java b/plugins/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java
index b4bc84747..d5bf4d1dc 100644
--- a/plugins/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java
+++ b/plugins/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java
@@ -32,6 +32,7 @@ import java.util.Set;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
+import org.onap.ccsdk.sli.core.utils.common.EnvProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,7 +42,7 @@ public class PropertiesNode implements SvcLogicJavaPlugin {
public void readProperties(Map<String, String> paramMap, SvcLogicContext ctx) throws SvcLogicException {
Parameters param = getParameters(paramMap);
- Properties prop = new Properties();
+ Properties prop = new EnvProperties();
try {
File file = new File(param.fileName);
try (InputStream in = new FileInputStream(file)) {
@@ -63,14 +64,14 @@ public class PropertiesNode implements SvcLogicJavaPlugin {
String name = (String) key;
String value = prop.getProperty(name);
if (value != null && value.trim().length() > 0) {
- ctx.setAttribute(pfx + name, getObfuscatedVal(value.trim()));
+ ctx.setAttribute(pfx + name, EnvProperties.resolveValue(value.trim()));
log.info("+++ " + pfx + name + ": [" + maskPassword(pfx + name, value) + "]");
}
}
}
if (mm != null) {
for (Map.Entry<String, String> entry : mm.entrySet()) {
- ctx.setAttribute(pfx + entry.getKey(), getObfuscatedVal(entry.getValue()));
+ ctx.setAttribute(pfx + entry.getKey(), EnvProperties.resolveValue(entry.getValue()));
log.info("+++ " + pfx + entry.getKey() + ": ["
+ maskPassword(pfx + entry.getKey(), entry.getValue()) + "]");
}
@@ -81,7 +82,7 @@ public class PropertiesNode implements SvcLogicJavaPlugin {
String name = (String) key;
String value = prop.getProperty(name);
if (value != null && value.trim().length() > 0) {
- ctx.setAttribute(pfx + name, getObfuscatedVal(value.trim()));
+ ctx.setAttribute(pfx + name, EnvProperties.resolveValue(value.trim()));
log.info("+++ " + pfx + name + ": [" + maskPassword(pfx + name, value) + "]");
}
}
@@ -92,7 +93,8 @@ public class PropertiesNode implements SvcLogicJavaPlugin {
}
}
- /* Unobfuscate param value */
+ /* Unobfuscate param value
+ * No longer needed - use EnvProperties.resolveValue instead
private static String getObfuscatedVal(String paramValue) {
String resValue = paramValue;
if (paramValue != null && paramValue.startsWith("${") && paramValue.endsWith("}"))
@@ -110,6 +112,7 @@ public class PropertiesNode implements SvcLogicJavaPlugin {
}
return resValue;
}
+ */
/*
* Getting extension has to do the following "" --> "" "name" --> "" "name.txt" --> "txt"