X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Fcore%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Fconfig%2FConfig.java;h=b94ef86e92d0fe97ca44470c2f0232b8d163e98f;hb=628b7105ce4d9818aac69a082e515f9275fd46fd;hp=245b653990aad6bd0fdd4ddf59448aaa5023c301;hpb=12414fe43077e12d7ef711951b1633ad31d73573;p=aaf%2Fauthz.git 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 245b6539..b94ef86e 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 @@ -147,17 +147,17 @@ public class Config { public static final String AAF_ROOT_NS_DEF = "org.osaaf.aaf"; public static final String AAF_ROOT_COMPANY = "aaf_root_company"; public static final String AAF_LOCATE_URL = "aaf_locate_url"; //URL for AAF locator - private static final String AAF_LOCATE_URL_TAG = "AAF_LOCATE_URL"; // Name of Above for use in Config Variables. + public static final String AAF_LOCATE_URL_TAG = "AAF_LOCATE_URL"; // Name of Above for use in Config Variables. public static final String AAF_DEFAULT_API_VERSION = "2.1"; public static final String AAF_API_VERSION = "aaf_api_version"; public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration - public static final String AAF_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.service:" + AAF_DEFAULT_API_VERSION; - public static final String GUI_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.gui:" + AAF_DEFAULT_API_VERSION; - public static final String CM_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.cm:" + AAF_DEFAULT_API_VERSION; - public static final String FS_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.fs:" + AAF_DEFAULT_API_VERSION; - public static final String HELLO_URL_DEF = "https://AAF_LOCATE_URL/AAF_NS.hello:" + AAF_DEFAULT_API_VERSION; - public static final String OAUTH2_TOKEN_URL = "https://AAF_LOCATE_URL/AAF_NS.token:" + AAF_DEFAULT_API_VERSION; - public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION; + public static final String AAF_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.service:" + AAF_DEFAULT_API_VERSION; + public static final String GUI_URL_DEF = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.gui:" + AAF_DEFAULT_API_VERSION; + 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; + public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/%CNS.%AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION; public static final String AAF_LOCATOR_CLASS = "aaf_locator_class"; // AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability @@ -174,8 +174,9 @@ public class Config { public static final String AAF_LOCATOR_PROTOCOL = "aaf_locator_protocol"; public static final String AAF_LOCATOR_SUBPROTOCOL = "aaf_locator_subprotocol"; public static final String AAF_LOCATOR_NS = "aaf_locator_ns"; - public static final String AAF_LOCATOR_NAMES = "aaf_locator_names"; + public static final String AAF_LOCATOR_ENTRIES = "aaf_locator_entries"; public static final String AAF_LOCATOR_FQDN = "aaf_locator_fqdn"; + public static final String AAF_LOCATOR_NAME = "aaf_locator_name"; public static final String AAF_LOCATOR_PUBLIC_PORT = "aaf_locator_public_port"; public static final String AAF_LOCATOR_PUBLIC_HOSTNAME = "aaf_locator_public_hostname"; @@ -814,28 +815,37 @@ public class Config { if (_url==null) { access.log(Level.INIT,"No URL passed to 'loadLocator'. Disabled"); } else { - String url = _url.replace("/AAF_NS.", "/%C%CID%AAF_NS."); - String root_ns = access.getProperty(Config.AAF_ROOT_NS, null); - 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 url = _url.replace("/AAF_NS.", "/%C%CID%AAF_NS."); +// String root_ns = access.getProperty(Config.AAF_ROOT_NS, null); + String url; + RegistrationPropHolder rph; + try { + rph = new RegistrationPropHolder(access, 0); + url = rph.replacements(_url, null, null); + } catch (UnknownHostException | CadiException e1) { + 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)) {