throw ex2;
}
XRIAuthority authorityPath = new GCSAuthority(utf8Namespace);
Authority parentAuthority;
try {
parentAuthority = this.store.localLookup(authorityPath);
if (parentAuthority == null) throw new ServerNotFoundException("Namespace authority " + namespace + " not found.");
} catch (StoreException ex) {
ServerException ex2 = new ServerInternalException("Error while finding namespace authority " + namespace + ": " + ex.getMessage(), ex);
log.warn(ex2);
throw ex2;
}
// the big goal is to make an XRDS, consisting of one or more XRDs
XRDS xrds = new XRDS();
boolean ret;
// give subclasses a chance to init the XRDS before we begin
ret = this.initXRDS(
xrds,
query,
signed);
// if a subclass returned true, it doesn't want us to do any more work
if (ret == true) {
log.debug("Subclass handled XRDS completely. Returning it without any more work.");
return(xrds);
}
// generate XRDs for all subsegments in the request
String utf8Query;
try {
utf8Query = IRIUtils.IRItoXRI(IRIUtils.URItoIRI(query));
} catch (Exception ex) {
ServerException ex2 = new ServerInternalException("Unsupported encoding in query: " + ex.getMessage(), ex);
log.warn(ex2);
throw ex2;
}
XRISegment segment = new XRISegment(utf8Query);
for (int i=0; i<segment.getNumSubSegments(); i++) {
String subSegmentName = segment.getSubSegmentAt(i).toString();
try {
// create a fresh XRD
XRD xrd = new XRD();
// using the parent authority and subsegment name, find the subsegment and the authority we are describing now
// we must be prepared to have null values here, since not all pipeline configurations
// may use objects from the store
SubSegment subSegment = null;
Authority authority = null;
if (parentAuthority != null) subSegment = this.store.findSubSegment(parentAuthority, subSegmentName);
if (subSegment != null) authority = this.store.getSubSegmentAuthority(subSegment);
// give subclasses a chance to init the XRD