return newDirectory(absolutePath); "' as '" + key + FOLDER_SUFFIX + "' exists"); return newDirectory(absolutePath); "' as it has contents"); return newDirectory(absolutePath);
@Override public FileStatus getFileStatus(Path f) throws IOException { Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); if (key.length() == 0) { // root always exists return newDirectory(absolutePath); } FileMetadata meta = store.retrieveMetadata(key); if (meta != null) { return newFile(meta, absolutePath); } if (store.retrieveMetadata(key + FOLDER_SUFFIX) != null) { return newDirectory(absolutePath); } PartialListing listing = store.list(key, 1); if (listing.getFiles().length > 0 || listing.getCommonPrefixes().length > 0) { return newDirectory(absolutePath); } throw new FileNotFoundException(absolutePath + ": No such file or directory."); }
@Override public FileStatus getFileStatus(Path f) throws IOException { Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); if (key.length() == 0) { // root always exists return newDirectory(absolutePath); } FileMetadata meta = store.retrieveMetadata(key); if (meta != null) { return newFile(meta, absolutePath); } if (store.retrieveMetadata(key + FOLDER_SUFFIX) != null) { return newDirectory(absolutePath); } PartialListing listing = store.list(key, 1); if (listing.getFiles().length > 0 || listing.getCommonPrefixes().length > 0) { return newDirectory(absolutePath); } throw new FileNotFoundException(absolutePath + ": No such file or directory."); }
String relativePath = pathUri.relativize(subpath.toUri()).getPath(); if (relativePath.endsWith(FOLDER_SUFFIX)) { status.add(newDirectory(new Path(absolutePath, relativePath.substring(0, relativePath.indexOf(FOLDER_SUFFIX))))); Path subpath = keyToPath(commonPrefix); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); status.add(newDirectory(new Path(absolutePath, relativePath)));
status.add(newDirectory(new Path( absolutePath, relativePath.substring(0, relativePath.indexOf(FOLDER_SUFFIX))))); Path subpath = keyToPath(commonPrefix); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); status.add(newDirectory(new Path(absolutePath, relativePath)));
String relativePath = pathUri.relativize(subpath.toUri()).getPath(); if (relativePath.endsWith(FOLDER_SUFFIX)) { status.add(newDirectory(new Path(absolutePath, relativePath.substring(0, relativePath.indexOf(FOLDER_SUFFIX))))); Path subpath = keyToPath(commonPrefix); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); status.add(newDirectory(new Path(absolutePath, relativePath)));