public final String default_name;
public final String lentries;
public final String lcontainer;
+ public final String default_container;
public RegistrationPropHolder(final Access access, final int port) throws UnknownHostException, CadiException {
this.access = access;
lentries=access.getProperty(Config.AAF_LOCATOR_ENTRIES,"");
- str = access.getProperty(Config.AAF_LOCATOR_CONTAINER, "");
- if(!str.isEmpty()) {
- lcontainer=',' + str; // "" makes a blank default Public Entry
- str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_PORT+'.'+str, null);
+ default_container = access.getProperty(Config.AAF_LOCATOR_CONTAINER, "");
+ if(!default_container.isEmpty()) {
+ lcontainer=',' + default_container; // "" makes a blank default Public Entry
+ str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_PORT+'.'+default_container, null);
if(str==null) {
str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_PORT, null);
}
} else {
- lcontainer=str;
+ lcontainer=default_container;
str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_PORT, null);
}
if(str!=null) {
}
- public String replacements(String source, final String name, final String dot_le) {
+ public String replacements(String source, final String name, final String _dot_le) {
if(source == null) {
return "";
} else if(source.isEmpty()) {
return source;
}
- String str;
- // aaf_locate_url
- if(source.indexOf(Config.AAF_LOCATE_URL_TAG)>=0) {
- str = access.getProperty(Config.AAF_LOCATE_URL, null);
- if(str!=null) {
- if(!str.endsWith("/")) {
- str+='/';
- }
- if(!str.endsWith("/locate/")) {
- str+="locate/";
- }
- source = source.replace("https://AAF_LOCATE_URL/", str);
- }
+
+ String dot_le;
+ if(_dot_le==null) {
+ dot_le = default_container.isEmpty()?"":'.'+default_container;
+ } else {
+ dot_le = _dot_le;
}
- if(source.indexOf("%NS")>=0) {
- str = getNS(dot_le);
- if(str==null || str.isEmpty()) {
- source = source.replace("%NS"+'.', str);
- }
- source = source.replace("%NS", str);
- }
+ String aaf_locator_host = access.getProperty(Config.AAF_LOCATE_URL+dot_le,null);
+ if(aaf_locator_host==null) {
+ aaf_locator_host = access.getProperty(Config.AAF_LOCATE_URL,null);
+ }
- // 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;
+ String str;
+ if(aaf_locator_host!=null) {
+ if("https://AAF_LOCATE_URL".equals(source)) {
+ source = aaf_locator_host;
+ } else {
+ str = aaf_locator_host;
+ if(source.indexOf(Config.AAF_LOCATE_URL_TAG)>=0) {
+ if(!str.endsWith("/")) {
+ str+='/';
+ }
+ if(!str.endsWith("/locate/")) {
+ str+="locate/";
+ }
+ source = source.replace("https://AAF_LOCATE_URL/", str);
}
}
- }
+ }
int atC = source.indexOf("%C");
if(atC>=0) {
}
source = source.replace("%CNS", str);
- str = access.getProperty(Config.AAF_LOCATOR_CONTAINER+dot_le, "");
+ str = access.getProperty(Config.AAF_LOCATOR_CONTAINER+dot_le,default_container);
if(str.isEmpty()) {
source = source.replace("%C"+'.', str);
}
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;
}
public_port:
port;
}
+
+ public Access access() {
+ return access;
+ }
}
\ No newline at end of file