@Test public void testSend() throws Exception { final StringBuilder t = new StringBuilder(); new FTPCommandFeature(session).send("HELP", new ProgressListener() { @Override public void message(final String message) { assertEquals("HELP", message); } }, new TranscriptListener() { @Override public void log(final Type request, final String message) { switch(request) { case response: t.append(message); } } }); assertNotNull(t.toString()); }
@Override public void send(final String command, final ProgressListener progress, final TranscriptListener transcript) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Send command %s", command)); } progress.message(command); final ProtocolCommandListener listener = new LoggingProtocolCommandListener(transcript); try { session.getClient().addProtocolCommandListener(listener); session.getClient().sendSiteCommand(command); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } finally { session.getClient().removeProtocolCommandListener(listener); } }
FTPCommandFeature implements Command { @Override public void send(final String command, final ProgressListener progress, final TranscriptListener transcript) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Send command %s", command)); } progress.message(command); final ProtocolCommandListener listener = new LoggingProtocolCommandListener(transcript); try { session.getClient().addProtocolCommandListener(listener); session.getClient().sendSiteCommand(command); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } finally { session.getClient().removeProtocolCommandListener(listener); } } }
FTPCommandFeature implements Command { @Override public void send(final String command, final ProgressListener progress, final TranscriptListener transcript) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Send command %s", command)); } progress.message(command); final ProtocolCommandListener listener = new LoggingProtocolCommandListener(transcript); try { session.getClient().addProtocolCommandListener(listener); session.getClient().sendSiteCommand(command); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } finally { session.getClient().removeProtocolCommandListener(listener); } } FTPCommandFeature(final FTPSession session); }
FTPCommandFeature implements Command { @Override public void send(final String command, final ProgressListener progress, final TranscriptListener transcript) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Send command %s", command)); } progress.message(command); final ProtocolCommandListener listener = new LoggingProtocolCommandListener(transcript); try { session.getClient().addProtocolCommandListener(listener); session.getClient().sendSiteCommand(command); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } finally { session.getClient().removeProtocolCommandListener(listener); } } FTPCommandFeature(final FTPSession session); @Override void send(final String command, final ProgressListener progress, final TranscriptListener transcript); }
FTPCommandFeature implements Command { @Override public void send(final String command, final ProgressListener progress, final TranscriptListener transcript) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Send command %s", command)); } progress.message(command); final ProtocolCommandListener listener = new LoggingProtocolCommandListener(transcript); try { session.getClient().addProtocolCommandListener(listener); session.getClient().sendSiteCommand(command); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } finally { session.getClient().removeProtocolCommandListener(listener); } } FTPCommandFeature(final FTPSession session); @Override void send(final String command, final ProgressListener progress, final TranscriptListener transcript);  }