import java.net.UnknownHostException;
import org.onap.aaf.cadi.Access;
-import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.Access.Level;
+import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.util.Split;
public class RegistrationPropHolder {
private final Access access;
public String hostname;
private int port;
- public String public_hostname;
+ public String public_fqdn;
private Integer public_port;
public Float latitude;
public Float longitude;
access.printf(Level.INIT, REGI,"hostname",hostname);
}
- public_hostname = access.getProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME, hostname);
+ public_fqdn = access.getProperty(Config.AAF_LOCATOR_PUBLIC_FQDN, hostname);
if(firstlog) {
- access.printf(Level.INIT, REGI,"public_hostname",public_hostname);
+ access.printf(Level.INIT, REGI,"public_fqdn",public_fqdn);
+ }
+
+ // Allow Container to reset the standard name for public
+ String container_public_name = access.getProperty(Config.AAF_LOCATOR_PUBLIC_NAME+'.'+default_container, null);
+ if(container_public_name==null) {
+ container_public_name = access.getProperty(Config.AAF_LOCATOR_PUBLIC_NAME, null);
+ if(container_public_name==null) {
+ container_public_name = access.getProperty(Config.AAF_LOCATOR_NAME, PUBLIC_NAME);
+ }
}
-
- default_name = access.getProperty(Config.AAF_LOCATOR_NAME, PUBLIC_NAME);
+ default_name = container_public_name;
+
if(firstlog) {
access.printf(Level.INIT, REGI,"default_name",default_name);
}
// Note: only one of the ports can be public... Therefore, only the last
for(String le : Split.splitTrim(',', lcontainer)) {
dot_le = le.isEmpty()?le :"."+le;
- str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME+dot_le,null);
+ str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_FQDN+dot_le,null);
if( str != null && !str.isEmpty()) {
- public_hostname=str;
+ public_fqdn=str;
if(firstlog) {
- access.printf(Level.INIT, "RegistrationProperty: public_hostname(overloaded by %s)='%s'",dot_le,public_hostname);
+ access.printf(Level.INIT, "RegistrationProperty: public_hostname(overloaded by %s)='%s'",dot_le,public_fqdn);
}
}
}
public String getEntryFQDN(final String entry, final String dot_le) {
String str;
- if(public_hostname!=null && dot_le.isEmpty()) {
- str = public_hostname;
+ if(public_fqdn!=null && dot_le.isEmpty()) {
+ str = public_fqdn;
} else {
str = access.getProperty(Config.AAF_LOCATOR_FQDN+dot_le, default_fqdn);
}
public String getEntryName(final String entry, final String dot_le) {
String str;
if(dot_le.isEmpty()) {
- str = PUBLIC_NAME;
+ str = default_name;
} else {
str = access.getProperty(Config.AAF_LOCATOR_NAME+dot_le, default_name);
}
return replacements("RegistrationPropHolder.getEntryName",str,entry,dot_le);
}
+ public String getPublicEntryName(final String entry, final String dot_le) {
+ String str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_NAME+dot_le, null);
+ if(str==null) {
+ str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_NAME,null);
+ }
+ if(str==null) {
+ str = default_name;
+ }
+ return replacements("RegistrationPropHolder.getEntryName",str,entry,dot_le);
+ }
+
private String getNS(String dot_le) {
String ns;
ns = access.getProperty(Config.AAF_LOCATOR_APP_NS+dot_le,null);
if(ns==null) {
- ns = access.getProperty(Config.AAF_LOCATOR_APP_NS, "");
+ ns = access.getProperty(Config.AAF_LOCATOR_APP_NS, "AAF_NS");
}
return ns;
}
if(!str.endsWith("/locate/")) {
str+="locate/";
}
- value = value.replace("https://AAF_LOCATE_URL/", str);
+ if(value.startsWith("http:")) {
+ value = value.replace("http://AAF_LOCATE_URL/", str);
+ } else {
+ value = value.replace("https://AAF_LOCATE_URL/", str);
+
+ }
}
}
}
// aaf_root_ns
if(value.indexOf("AAF_NS")>=0) {
- str = access.getProperty(Config.AAF_ROOT_NS, Config.AAF_ROOT_NS_DEF);
- String temp = value.replace("%AAF_NS", str);
+ str = access.getProperty(Config.AAF_ROOT_NS, Config.AAF_ROOT_NS_DEF) + '.';
+ String temp = value.replace("%AAF_NS.", str);
if(temp.equals(value)) { // intended
- value = value.replace("AAF_NS", str); // Backward Compatibility
+ value = value.replace("AAF_NS.", str); // Backward Compatibility
} else {
value = temp;
}
if(default_fqdn!=null) {
value = value.replace("%DF", default_fqdn);
}
- if(public_hostname!=null) {
- value = value.replace("%PH", public_hostname);
+ if(public_fqdn!=null) {
+ value = value.replace("%PH", public_fqdn);
}
}
access.printf(Level.DEBUG,