From ff1417ff60baee231a28272f9a16ef2c9c8ea0a2 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Wed, 29 May 2019 04:58:50 -0500 Subject: Post Init Service Starter minor fixes Remove JU generated garbage files Issue-ID: AAF-835 Change-Id: I476291f1f1140f0640ed49452f8a5dabb28d9c30 Signed-off-by: Instrumental --- .../java/org/onap/aaf/cadi/register/Registrar.java | 1 + .../aaf/cadi/register/RegistrationCreator.java | 26 ++++++++---- .../main/java/org/onap/aaf/cadi/sso/AAFSSO.java | 2 +- .../main/java/org/onap/aaf/cadi/PropAccess.java | 49 +++++++++++++--------- .../main/java/org/onap/aaf/cadi/config/Config.java | 8 ++++ 5 files changed, 57 insertions(+), 29 deletions(-) (limited to 'cadi') diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java index 4ae1b97f..c3dc4f6a 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java @@ -71,6 +71,7 @@ public class Registrar { erroringTimer = null; } } else { + env.error().log(rv.toString()); // Account for different Registrations not being to same place if (erroringTimer==null) { erroringTimer = new Timer(REGISTRAR + " error re-check ",true); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java index ac715163..5221d8ea 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java @@ -98,15 +98,25 @@ public class RegistrationCreator { String protocol = access.getProperty(Config.AAF_LOCATOR_PROTOCOL + dot_le, null); if (protocol!=null) { locate.setProtocol(protocol); - String subprotocols = access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL + dot_le, null); - if(subprotocols!=null) { - List ls = locate.getSubprotocol(); - for (String s : Split.split(',', subprotocols)) { - ls.add(s); - } - } + List ls = locate.getSubprotocol(); + if(ls==null || ls.isEmpty()) { + String subprotocols = access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL + dot_le, null); + if(subprotocols==null) { + subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null); + } + if(subprotocols!=null) { + for (String s : Split.split(',', subprotocols)) { + ls.add(s); + } + } else { + access.printf(Level.ERROR, "%s is required for Locator Registration of %s", + Config.AAF_LOCATOR_SUBPROTOCOL,Config.AAF_LOCATOR_PROTOCOL); + } + } + lme.add(locate); + } else { + access.printf(Level.ERROR, "%s is required for Locator Registration",Config.AAF_LOCATOR_PROTOCOL); } - lme.add(locate); } } } catch (NumberFormatException | UnknownHostException e) { diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java index c9b8b4ee..7c589ae3 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java @@ -319,7 +319,7 @@ public class AAFSSO { if(aaf_root_ns==null) { locateRoot=Defaults.AAF_ROOT; } else { - locateRoot = Defaults.AAF_LOCATE_CONST + "/%CNS.%" + aaf_root_ns; + locateRoot = Defaults.AAF_LOCATE_CONST + "/%CNS." + aaf_root_ns; } if(access.getProperty(Config.AAF_URL)==null) { 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 2fe5f41c..d6b8d56d 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 @@ -28,6 +28,7 @@ import java.io.InputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; +import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -149,6 +150,7 @@ public class PropAccess implements Access { name = props.getProperty(Config.CADI_LOGNAME, name); SecurityInfo.setHTTPProtocols(this); + } @@ -260,27 +262,34 @@ public class PropAccess implements Access { return buildMsg(name,iso8601,level,elements); } - public static StringBuilder buildMsg(final String name, final SimpleDateFormat sdf, Level level, Object[] elements) { - StringBuilder sb = new StringBuilder(sdf.format(new Date())); - sb.append(' '); - sb.append(level.name()); - sb.append(" ["); - sb.append(name); - + public static StringBuilder buildMsg(final String name, final DateFormat sdf, Level level, Object[] elements) { + final StringBuilder sb; int end = elements.length; - if (end<=0) { - sb.append("] "); - } else { - int idx = 0; - if(elements[idx]!=null && - elements[idx] instanceof Integer) { - sb.append('-'); - sb.append(elements[idx]); - ++idx; - } - sb.append("] "); - write(true,sb,elements); - } + if(sdf==null) { + sb = new StringBuilder(); + write(true,sb,elements); + } else { + sb = new StringBuilder( + sdf.format(new Date()) + ); + sb.append(' '); + sb.append(level.name()); + sb.append(" ["); + sb.append(name); + if (end<=0) { + sb.append("] "); + } else { + int idx = 0; + if(elements[idx]!=null && + elements[idx] instanceof Integer) { + sb.append('-'); + sb.append(elements[idx]); + ++idx; + } + sb.append("] "); + write(true,sb,elements); + } + } return sb; } diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java index ff1f3955..8cb1045b 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java @@ -88,6 +88,9 @@ public class Config { public static final String CADI_LOGDIR = "cadi_log_dir"; public static final String CADI_ETCDIR = "cadi_etc_dir"; public static final String CADI_LOGNAME = "cadi_logname"; +// public static final String CADI_LOGFMT="cad_logging_format"; +// public static final String CADI_LOGFMT_UTC="UTC"; +// public static final String CADI_LOGFMT_ISO8601="ISO-8601"; public static final String CADI_KEYFILE = "cadi_keyfile"; public static final String CADI_KEYSTORE = "cadi_keystore"; public static final String CADI_KEYSTORE_PASSWORD = "cadi_keystore_password"; @@ -174,6 +177,11 @@ public class Config { public static final String AAF_LOCATOR_PUBLIC_PORT = "aaf_locator_public_port"; public static final String AAF_LOCATOR_PUBLIC_FQDN = "aaf_locator_public_fqdn"; public static final String AAF_LOCATOR_PUBLIC_NAME = "aaf_locator_public_name"; + + // AAF Service will write to the Audit Log if a past due AAF stored Password + // is being used within # of days specified. + public static final String AAF_CRED_WARN_DAYS="aaf_cred_warn_days"; + public static final String AAF_CRED_WARN_DAYS_DFT="7"; public static final String AAF_APPID = "aaf_id"; public static final String AAF_APPPASS = "aaf_password"; -- cgit 1.2.3-korg