collection = context.getBroker().openCollection(resourceURI.removeLastSegment(), Lock.READ_LOCK);
if (collection == null) {
LOG.warn("collection not found: " + resourceURI.getCollectionPath());
return Sequence.EMPTY_SEQUENCE;
}
doc = collection.getDocumentWithLock(context.getBroker(), resourceURI.lastSegment(), Lock.READ_LOCK);
if (doc == null)
return Sequence.EMPTY_SEQUENCE;
if (doc.getResourceType() != DocumentImpl.BINARY_FILE ||
!doc.getMetadata().getMimeType().equals("application/xquery")) {
throw new XPathException(this, "XQuery resource: " + uri + " is not an XQuery or " +