From bf3d3075cac610b901c951ae135fcdbcc6ffecb8 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Mon, 18 Feb 2019 14:01:07 -0600 Subject: More refinement, Agent.sh Issue-ID: AAF-667 Change-Id: I3898f3378fffb0ed89ad84cb80942d1ded51b3d4 Signed-off-by: Instrumental --- .../main/java/org/onap/aaf/cadi/config/Config.java | 24 +--------- .../aaf/cadi/config/RegistrationPropHolder.java | 55 ++++++++++++---------- 2 files changed, 32 insertions(+), 47 deletions(-) (limited to 'cadi/core/src') 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 66491959..dc58acc6 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 @@ -156,8 +156,8 @@ public class Config { public static final String CM_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.cm:" + AAF_DEFAULT_API_VERSION; public static final String FS_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.fs:" + AAF_DEFAULT_API_VERSION; public static final String HELLO_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.hello:" + AAF_DEFAULT_API_VERSION; - public static final String OAUTH2_TOKEN_URL = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.token:" + AAF_DEFAULT_API_VERSION +"/token"; - public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION +"/introspect";; + public static final String OAUTH2_TOKEN_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.token:" + AAF_DEFAULT_API_VERSION +"/token"; + public static final String OAUTH2_INTROSPECT_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION +"/introspect";; public static final String AAF_LOCATOR_CLASS = "aaf_locator_class"; // AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability @@ -826,26 +826,6 @@ public class Config { throw new LocatorException(e1); } -// if(url.indexOf('%')>=0) { -// String str = access.getProperty(Config.AAF_LOCATOR_CONTAINER_ID, null); -// if(str==null) { -// url = url.replace("%CID",""); -// } else { -// url = url.replace("%CID",str+'.'); -// } -// str = access.getProperty(Config.AAF_LOCATOR_CONTAINER, null); -// if(str==null) { -// url = url.replace("%C",""); -// } else { -// url = url.replace("%C",str+'.'); -// } -// -// if (root_ns==null) { -// url = url.replace("%AAF_NS",""); -// } else { -// url = url.replace("%AAF_NS",root_ns); -// } -// } String replacement; int idxAAFLocateUrl; if ((idxAAFLocateUrl=url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) { diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java index b6cd533c..aa782313 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java @@ -170,27 +170,6 @@ public class RegistrationPropHolder { } } - if(source.indexOf("%NS")>=0) { - str = getNS(dot_le); - if(str==null || str.isEmpty()) { - source = source.replace("%NS"+'.', str); - } - source = source.replace("%NS", str); - } - - // aaf_root_ns - if(source.indexOf("AAF_NS")>=0) { - str = access.getProperty(Config.AAF_ROOT_NS, null); - if(str!=null) { - String temp = source.replace("%AAF_NS", str); - if(temp == source) { // intended - source = source.replace("AAF_NS", str); // Backward Compatibility - } else { - source = temp; - } - } - } - int atC = source.indexOf("%C"); if(atC>=0) { // aaf_locator_container_ns @@ -207,11 +186,37 @@ public class RegistrationPropHolder { source = source.replace("%C", str); } + if(source.indexOf("%NS")>=0) { + str = getNS(dot_le); + if(str==null || str.isEmpty()) { + source = source.replace("%NS"+'.', str); + } + source = source.replace("%NS", str); + } + + // aaf_root_ns + if(source.indexOf("AAF_NS")>=0) { + str = access.getProperty(Config.AAF_ROOT_NS, Config.AAF_ROOT_NS_DEF); + String temp = source.replace("%AAF_NS", str); + if(temp.equals(source)) { // intended + source = source.replace("AAF_NS", str); // Backward Compatibility + } else { + source = temp; + } + } + + if(source.indexOf('%')>=0) { - // These shouldn't be expected to have dot elements - source = source.replace("%N", name); - source = source.replace("%DF", default_fqdn); - source = source.replace("%PH", public_hostname); + // These shouldn't be expected to have dot elements + if(name!=null) { + source = source.replace("%N", name); + } + if(default_fqdn!=null) { + source = source.replace("%DF", default_fqdn); + } + if(public_hostname!=null) { + source = source.replace("%PH", public_hostname); + } } return source; } -- cgit 1.2.3-korg