boolean sameDocumentReference = uri.startsWith("#");
// What if this is a directory?
URI baseURI = URI.create(base);
if (!sameDocumentReference && "file".equalsIgnoreCase(baseURI.resolve(uri).getScheme())) {
final DataStore store = runtime.getDataStore();
store.infoEntry(uri, base, "*/*", new DataInfo() {
public void list(URI id, String media, long lastModified)
throws IOException {
final String accept = pattern == null ? ACCEPT_XML : "*/*";
final DataReader handler = new DataReader() {
public void load(URI id, String media,
InputStream content, long len)
throws IOException {
content.close();
String name = new File(id).getName();
if (pattern == null || pattern.matcher(name).matches()) {
documents.add(parse(id.toASCIIString(), base));
}
}
};
String entry = id.toASCIIString();
if (media == null) {
store.listEachEntry(entry, entry, accept, new DataInfo() {
public void list(URI id, String media, long lastModified)
throws IOException {
String entry = id.toASCIIString();
store.readEntry(entry, entry, accept, null, handler);
}