use of ch.cyberduck.core.ListService in project cyberduck by iterate-ch.
the class SessionListWorker method run.
@Override
public AttributedList<Path> run(final Session<?> session) throws BackgroundException {
try {
if (this.isCached()) {
final AttributedList<Path> list = cache.get(directory);
listener.chunk(directory, list);
return list;
}
final ListService service = session.getFeature(ListService.class);
if (log.isDebugEnabled()) {
log.debug(String.format("Run with feature %s", service));
}
return service.list(directory, listener);
} catch (ListCanceledException e) {
return e.getChunk();
}
}
use of ch.cyberduck.core.ListService in project cyberduck by iterate-ch.
the class AbstractSharepointListService method list.
@Override
public final AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
if ((!session.isSingleSite() && directory.isRoot()) || (session.isSingleSite() && session.isHome(directory))) {
return getRoot(directory, listener);
}
final AttributedList<Path> result = processList(directory, listener);
if (result != AttributedList.<Path>emptyList()) {
return result;
}
final GraphSession.ContainerItem container = session.getContainer(directory);
if (container.getCollectionPath().map(p -> container.isContainerInCollection() && SITES_CONTAINER.equals(p.getName())).orElse(false)) {
return addSiteItems(directory, listener);
}
final Optional<ListService> collectionListService = container.getCollectionPath().map(p -> {
if (SITES_CONTAINER.equals(p.getName())) {
return new SitesListService(session, fileid);
} else if (DRIVES_CONTAINER.equals(p.getName())) {
return new SiteDrivesListService(session, fileid);
}
return null;
});
if (collectionListService.isPresent() && (!container.isDefined() || container.isCollectionInContainer())) {
return collectionListService.get().list(directory, listener);
}
return new GraphItemListService(session, fileid).list(directory, listener);
}
use of ch.cyberduck.core.ListService in project cyberduck by iterate-ch.
the class SharepointListServiceTest method testListDefaultDriveOverwrite.
@Test
public void testListDefaultDriveOverwrite() throws Exception {
final ListService list = new SharepointListService(session, fileid);
final AttributedList<Path> drives = list.list(new Path(SharepointListService.DEFAULT_NAME, "Drives", EnumSet.of(Path.Type.directory)), new DisabledListProgressListener());
final Path drive = drives.get(0);
new PathAttributesHomeFeature(session, () -> drive, new GraphAttributesFinderFeature(session, fileid), new RootPathContainerService()).find();
list.list(drive, new DisabledListProgressListener());
}
use of ch.cyberduck.core.ListService in project cyberduck by iterate-ch.
the class FTPDefaultListServiceTest method testListDefault.
@Test
public void testListDefault() throws Exception {
final ListService list = new FTPDefaultListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser())), FTPListService.Command.list);
final Path directory = new FTPWorkdirService(session).find();
final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new FTPTouchFeature(session).touch(file, new TransferStatus());
assertTrue(list.list(directory, new DisabledListProgressListener()).contains(file));
new FTPDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
use of ch.cyberduck.core.ListService in project cyberduck by iterate-ch.
the class FTPListServiceTest method testList.
@Test
public void testList() throws Exception {
final ListService service = new FTPListService(session, null, TimeZone.getDefault());
final Path directory = new FTPWorkdirService(session).find();
final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
new FTPTouchFeature(session).touch(file, new TransferStatus());
final Permission permission = new Permission(Permission.Action.read_write, Permission.Action.read_write, Permission.Action.read_write);
final AttributedList<Path> list = service.list(directory, new DisabledListProgressListener() {
@Override
public void chunk(final Path parent, AttributedList<Path> list) {
assertFalse(list.isEmpty());
}
});
assertTrue(list.contains(file));
new FTPDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Aggregations