@Override public RemoteIterator<FileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listStatusIterator(p); } }.resolve(this, absF);
UnresolvedLinkException, IOException { return new RemoteIterator<LocatedFileStatus>() { private RemoteIterator<FileStatus> itor = listStatusIterator(f);
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws IOException, UnresolvedLinkException { return myFs.listStatusIterator(fullPath(f)); }
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<FileStatus> fsIter = res.targetFileSystem.listStatusIterator(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<FileStatus>(res, fsIter, f) { @Override public FileStatus getViewFsFileStatus(FileStatus stat, Path newPath) { return new ViewFsFileStatus(stat, newPath); } }; }
RemoteIterator<FileStatus> list = listStatusIterator(dst); if (list != null && list.hasNext()) { throw new IOException(
@Override public RemoteIterator<FileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listStatusIterator(p); } }.resolve(this, absF);
@Override public RemoteIterator<FileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listStatusIterator(p); } }.resolve(this, absF);
@Override public RemoteIterator<FileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listStatusIterator(p); } }.resolve(this, absF);
@Override public RemoteIterator<FileStatus> next( final AbstractFileSystem fs, final Path p) throws IOException, UnresolvedLinkException { return fs.listStatusIterator(p); } }.resolve(this, absF);
UnresolvedLinkException, IOException { return new RemoteIterator<LocatedFileStatus>() { private RemoteIterator<FileStatus> itor = listStatusIterator(f);
UnresolvedLinkException, IOException { return new RemoteIterator<LocatedFileStatus>() { private RemoteIterator<FileStatus> itor = listStatusIterator(f);
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws IOException, UnresolvedLinkException { return myFs.listStatusIterator(fullPath(f)); }
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws IOException, UnresolvedLinkException { return myFs.listStatusIterator(fullPath(f)); }
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws IOException, UnresolvedLinkException { return myFs.listStatusIterator(fullPath(f)); }
private List<FileStatus> getAllNodeFiles( RemoteIterator<FileStatus> nodeFiles, ApplicationId appId) throws IOException { List<FileStatus> listOfFiles = new ArrayList<>(); while (nodeFiles != null && nodeFiles.hasNext()) { FileStatus thisNodeFile = nodeFiles.next(); String nodeName = thisNodeFile.getPath().getName(); if (nodeName.equals(appId + ".har")) { Path p = new Path("har:///" + thisNodeFile.getPath().toUri().getRawPath()); nodeFiles = HarFs.get(p.toUri(), conf).listStatusIterator(p); continue; } listOfFiles.add(thisNodeFile); } return listOfFiles; }
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<FileStatus> fsIter = res.targetFileSystem.listStatusIterator(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<FileStatus>(res, fsIter, f) { @Override public FileStatus getViewFsFileStatus(FileStatus stat, Path newPath) { return new ViewFsFileStatus(stat, newPath); } }; }
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<FileStatus> fsIter = res.targetFileSystem.listStatusIterator(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<FileStatus>(res, fsIter, f) { @Override public FileStatus getViewFsFileStatus(FileStatus stat, Path newPath) { return new ViewFsFileStatus(stat, newPath); } }; }
@Override public RemoteIterator<FileStatus> listStatusIterator(final Path f) throws AccessControlException, FileNotFoundException, UnresolvedLinkException, IOException { final InodeTree.ResolveResult<AbstractFileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<FileStatus> fsIter = res.targetFileSystem.listStatusIterator(res.remainingPath); if (res.isInternalDir()) { return fsIter; } return new WrappingRemoteIterator<FileStatus>(res, fsIter, f) { @Override public FileStatus getViewFsFileStatus(FileStatus stat, Path newPath) { return new ViewFsFileStatus(stat, newPath); } }; }
@Test public void testListStatusIterator() throws IOException { final Path mockTarget = new Path("mockfs://listStatusIterator/foo"); final Path mountPoint = new Path("/fooMount"); final Configuration newConf = new Configuration(); newConf.setClass("fs.AbstractFileSystem.mockfs.impl", MockFs.class, AbstractFileSystem.class); ConfigUtil.addLink(newConf, mountPoint.toString(), mockTarget.toUri()); FileContext.getFileContext(URI.create("viewfs:///"), newConf) .listStatus(mountPoint); AbstractFileSystem mockFs = MockFs.getMockFs(mockTarget.toUri()); verify(mockFs).listStatusIterator(new Path(mockTarget.toUri().getPath())); verify(mockFs, never()).listStatus(any(Path.class)); }
@Test public void testListLocatedStatus() throws IOException { final Path mockTarget = new Path("mockfs://listLocatedStatus/foo"); final Path mountPoint = new Path("/fooMount"); final Configuration newConf = new Configuration(); newConf.setClass("fs.AbstractFileSystem.mockfs.impl", MockFs.class, AbstractFileSystem.class); ConfigUtil.addLink(newConf, mountPoint.toString(), mockTarget.toUri()); FileContext.getFileContext(URI.create("viewfs:///"), newConf) .listLocatedStatus(mountPoint); AbstractFileSystem mockFs = MockFs.getMockFs(mockTarget.toUri()); verify(mockFs).listLocatedStatus(new Path(mockTarget.toUri().getPath())); verify(mockFs, never()).listStatus(any(Path.class)); verify(mockFs, never()).listStatusIterator(any(Path.class)); }