diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-02-22 01:18:51 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-02-22 01:24:27 -0600 |
commit | f54a4aad8cdff00f2bbac984b1e98fb1add038be (patch) | |
tree | 2cfb8efaaf083441e67369b0461c9cf2956aff52 /cadi/core | |
parent | 8da0163b75076832417ee9b255f63b4c789e3c12 (diff) |
Refine Local Agent.sh use
Issue-ID: AAF-770
Change-Id: Ic6593bde1e16db35cf538cb1d2caa152016f3a82
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi/core')
-rw-r--r-- | cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java index 461ef43c..bbc3086a 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java @@ -93,20 +93,10 @@ public class PropAccess implements Access { int eq; for (String arg : args) { if ((eq=arg.indexOf('='))>0) { - String key = arg.substring(0, eq); - if(Config.CADI_PROP_FILES.equals(key)) { - nprops.setProperty(key,arg.substring(eq+1)); - } + nprops.setProperty(arg.substring(0, eq),arg.substring(eq+1)); } } init(nprops); - - // Re-overlay Args - for (String arg : args) { - if ((eq=arg.indexOf('='))>0) { - props.setProperty(arg.substring(0, eq),arg.substring(eq+1)); - } - } } protected void init(Properties p) { @@ -115,16 +105,15 @@ public class PropAccess implements Access { level=DEFAULT.maskOf(); props = new Properties(); - - // Find the "cadi_prop_files" - // First in VM Args + // First, load related System Properties for (Entry<Object,Object> es : System.getProperties().entrySet()) { String key = es.getKey().toString(); - if(Config.CADI_PROP_FILES.equals(key)) { - props.put(key,es.getValue().toString()); - } + for (String start : new String[] {"cadi_","aaf_","cm_"}) { + if (key.startsWith(start)) { + props.put(key, es.getValue()); + } + } } - // Second, overlay or fill in with Passed in Props if (p!=null) { props.putAll(p); @@ -133,16 +122,6 @@ public class PropAccess implements Access { // Third, load any Chained Property Files load(props.getProperty(Config.CADI_PROP_FILES)); - // Fourth, System.getProperties takes precedence over Files - for (Entry<Object,Object> es : System.getProperties().entrySet()) { - String key = es.getKey().toString(); - for (String start : new String[] {"HOSTNAME","cadi_","aaf_","cm_"}) { - if (key.startsWith(start)) { - props.put(key, es.getValue()); - } - } - } - String sLevel = props.getProperty(Config.CADI_LOGLEVEL); if (sLevel!=null) { level=Level.valueOf(sLevel).maskOf(); @@ -162,7 +141,8 @@ public class PropAccess implements Access { specialConversions(); } - + + private void specialConversions() { // Critical - if no Security Protocols set, then set it. We'll just get messed up if not if (props.get(Config.CADI_PROTOCOLS)==null) { |