@Test public void testListDefaultFlag() throws Exception { final ListService list = new FTPDefaultListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser())), FTPListService.Command.lista); 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()); }
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { if(!session.getClient().changeWorkingDirectory(directory.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().setFileType(FTPClient.ASCII_FILE_TYPE)) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } final List<String> list = new DataConnectionActionExecutor(session).data(new DataConnectionAction<List<String>>() { @Override public List<String> execute() throws BackgroundException { try { return session.getClient().list(command.getCommand(), command.getArg()); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } }, listener); return reader.read(directory, list, listener); } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } }
FTPDefaultListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { if(!session.getClient().changeWorkingDirectory(directory.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().setFileType(FTPClient.ASCII_FILE_TYPE)) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } final List<String> list = new DataConnectionActionExecutor(session).data(new DataConnectionAction<List<String>>() { @Override public List<String> execute() throws BackgroundException { try { return session.getClient().list(command.getCommand(), command.getArg()); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } }, listener); return reader.read(directory, list, listener); } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } }
FTPDefaultListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { if(!session.getClient().changeWorkingDirectory(directory.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().setFileType(FTPClient.ASCII_FILE_TYPE)) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } final List<String> list = new DataConnectionActionExecutor(session).data(new DataConnectionAction<List<String>>() { @Override public List<String> execute() throws BackgroundException { try { return session.getClient().list(command.getCommand(), command.getArg()); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } }, listener); return reader.read(directory, list, listener); } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } FTPDefaultListService(final FTPSession session,
                                 final CompositeFileEntryParser parser, final FTPListService.Command command); }
FTPDefaultListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { if(!session.getClient().changeWorkingDirectory(directory.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().setFileType(FTPClient.ASCII_FILE_TYPE)) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } final List<String> list = new DataConnectionActionExecutor(session).data(new DataConnectionAction<List<String>>() { @Override public List<String> execute() throws BackgroundException { try { return session.getClient().list(command.getCommand(), command.getArg()); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } }, listener); return reader.read(directory, list, listener); } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } FTPDefaultListService(final FTPSession session,
                                 final CompositeFileEntryParser parser, final FTPListService.Command command); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener); }
FTPDefaultListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { if(!session.getClient().changeWorkingDirectory(directory.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().setFileType(FTPClient.ASCII_FILE_TYPE)) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } final List<String> list = new DataConnectionActionExecutor(session).data(new DataConnectionAction<List<String>>() { @Override public List<String> execute() throws BackgroundException { try { return session.getClient().list(command.getCommand(), command.getArg()); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } }, listener); return reader.read(directory, list, listener); } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } FTPDefaultListService(final FTPSession session,
                                 final CompositeFileEntryParser parser, final FTPListService.Command command); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener);  }