protected String myhostname;
protected int myport;
protected final String aaf_locator_host;
- protected final URI aaf_locator_uri;
+ protected URI aaf_locator_uri;
private long earliest;
private final long refreshWait;
public AbsAAFLocator(Access access, String name, final long refreshMin) throws LocatorException {
- RegistrationPropHolder rph;
- try {
- rph = new RegistrationPropHolder(access, 0);
- } catch (UnknownHostException | CadiException e1) {
- throw new LocatorException(e1);
- }
+ RegistrationPropHolder rph;
try {
- aaf_locator_host = rph.replacements("https://"+Config.AAF_LOCATE_URL_TAG,null,null);
- aaf_locator_uri = new URI(aaf_locator_host);
+ rph = new RegistrationPropHolder(access, 0);
+ } catch (UnknownHostException | CadiException e1) {
+ throw new LocatorException(e1);
+ }
+ URI aaf_locator_uri;
+ try {
+ aaf_locator_host = rph.replacements(getClass().getSimpleName(),"https://"+Config.AAF_LOCATE_URL_TAG,null,null);
+ if(aaf_locator_host.endsWith("/locate")) {
+ aaf_locator_uri = new URI(aaf_locator_host);
+ } else {
+ aaf_locator_uri = new URI(aaf_locator_host+"/locate");
+ }
access.printf(Level.INFO, "AbsAAFLocator AAF URI is %s",aaf_locator_uri);
} catch (URISyntaxException e) {
throw new LocatorException(e);
}
- name = rph.replacements(name, null,null);
+ name = rph.replacements(getClass().getSimpleName(),name, null,null);
access.printf(Level.INFO, "AbsAAFLocator name is %s",aaf_locator_uri);
epList = new LinkedList<>();
this.name = split[0];
this.version = (split.length > 1) ? split[1] : access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION);
}
-
}
-
+
/**
* This is the way to setup specialized AAFLocators ahead of time.
* @param preload
}
public static Locator<URI> create(final String name, final String version) throws LocatorException {
+ if(locatorCreator==null) {
+ throw new LocatorException("LocatorCreator is not set");
+ }
return locatorCreator.create(name, version);
}
if (path.length>1 && "locate".equals(path[1])) {
return path[2];
} else if(path.length>1) {
- return path[1];
+ return path[1];
} else {
return locatorURI.toString();
}
@Override
public Item best() throws LocatorException {
if (!hasItems()) {
- throw new LocatorException("No Entries found for '" + aaf_locator_uri.toString() + "/locate/" + name + ':' + version + '\'');
+ throw new LocatorException(String.format("No Entries found for '%s/%s:%s'",
+ (aaf_locator_uri==null?aaf_locator_host:aaf_locator_uri.toString()),
+ name,
+ version));
}
List<EP> lep = new ArrayList<>();
EP first = null;
}
return null;
}
-
+
protected static class AAFLItem implements Item {
private Iterator<EP> iter;
private URI uri;
return rv;
}
+ protected void clear() {
+ epList.clear();
+ earliest=0L;
+ }
+
}