@Override public void chunk(final Path folder, final AttributedList<Path> list) { cache.put(folder, list); } }
@Override public void cleanup(final AttributedList<Path> list) { // Update the working directory if listing is successful if(!(AttributedList.<Path>emptyList() == list)) { // Cache directory listing cache.put(directory, list); } }
@Override public void cleanup(final List<TransferItem> list) { cache.put(directory, new AttributedList<TransferItem>(list)); filter(); } }
@Override public AttributedList<T> put(final T reference, final AttributedList<T> children) { for(T f : children) { final CacheReference key = proxy.key(f); reverse.remove(key); reverse.put(key, reference); } return proxy.put(reference, children); }
@Override public Transfer withCache(final Cache<Path> cache) { this.cache = cache; // Populate cache for root items. See #8712 for(TransferItem root : roots) { if(!root.remote.isRoot()) { cache.put(root.remote.getParent(), new AttributedList<Path>(Collections.singletonList(root.remote))); } } upload.withCache(cache); download.withCache(cache); return this; }
@Override public List<TransferItem> list(final Session<?> session, final Path directory, final Local local, final ListProgressListener listener) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("List children for %s", directory)); } if(directory.isSymbolicLink() && new DownloadSymlinkResolver(roots).resolve(directory)) { if(log.isDebugEnabled()) { log.debug(String.format("Do not list children for symbolic link %s", directory)); } return Collections.emptyList(); } else { final AttributedList<Path> list; if(cache.isCached(directory)) { list = cache.get(directory); } else { list = session.getFeature(ListService.class).list(directory, listener); cache.put(directory, list); } final List<TransferItem> children = new ArrayList<TransferItem>(); // Return copy with filtered result only for(Path f : new AttributedList<Path>(list.filter(comparator, filter))) { children.add(new TransferItem(f, LocalFactory.get(local, f.getName()))); } return children; } }
@Override public AttributedList<Path> put(final Path folder, final AttributedList<Path> encrypted) { final AttributedList<Path> list = new AttributedList<>(); // Swap with decrypted paths for(int i = 0; i < encrypted.size(); i++) { final Path f = encrypted.get(i); list.add(i, this.toDecrypted(f)); } return delegate.put(this.toDecrypted(folder), list); }
protected Path list(final Session<?> session) throws BackgroundException { Path home; AttributedList<Path> list; try { home = session.getFeature(Home.class).find(); // Remove cached home to force error if repeated attempt to mount fails cache.invalidate(home); // Retrieve directory listing of default path final SessionListWorker worker = new SessionListWorker(cache, home, listener); listener.message(worker.getActivity()); list = worker.run(session); } catch(NotfoundException e) { log.warn(String.format("Mount failed with %s", e.getMessage())); // The default path does not exist or is not readable due to possible permission issues. Fallback // to default working directory home = new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)); // Remove cached home to force error if repeated attempt to mount fails cache.invalidate(home); // Retrieve directory listing of working directory final SessionListWorker worker = new SessionListWorker(cache, home, listener); listener.message(worker.getActivity()); list = worker.run(session); } cache.put(home, list); return home; }
cache.put(item, new AttributedList<TransferItem>(children));
protected AttributedList<TransferItem> children(final TransferItem directory) { if(null == directory) { // Root if(!cache.isCached(null)) { cache.put(null, new AttributedList<TransferItem>(transfer.getRoots())); this.filter(); } } else if(!cache.isCached(directory)) { controller.background(new WorkerBackgroundAction<List<TransferItem>>(controller, source, new TransferPromptListWorker(transfer, directory.remote, directory.local, controller) { @Override public void cleanup(final List<TransferItem> list) { cache.put(directory, new AttributedList<TransferItem>(list)); filter(); } } )); } return this.get(directory); }
cache.put(file.getParent(), list); final Path found = list.find(new SimplePathPredicate(file)); if(null == found) {