org.apache.commons.net.ProtocolCommandEvent Java Examples
The following examples show how to use
org.apache.commons.net.ProtocolCommandEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FtpClient.java From netbeans with Apache License 2.0 | 6 votes |
private void processEvent(ProtocolCommandEvent event) { String message = event.getMessage(); if (message.startsWith("PASS ")) { // NOI18N // hide password message = "PASS ******"; // NOI18N } OutputWriter writer = null; if (event.isReply() && (FTPReply.isNegativeTransient(event.getReplyCode()) || FTPReply.isNegativePermanent(event.getReplyCode()))) { writer = io.getErr(); } else { writer = io.getOut(); } writer.println(message.trim()); writer.flush(); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Command listener: {0}", message.trim()); } }
Example #2
Source File: SynchronizationFtpTransferListener.java From ats-framework with Apache License 2.0 | 6 votes |
@Override public void protocolCommandSent( ProtocolCommandEvent event ) { /* because we can only pause a file upload, we check if the event has a STOR command */ if (event.getCommand().equals(FTPCmd.STOR.getCommand())) { // Check only progress events so the transfer be paused when the // transfer is taking place not before or after it. log.debug("Progress event #" + (currentProgessEvent)); if (currentProgessEvent++ == progressEventNumber && Thread.holdsLock(owner)) { try { log.debug("Waiting for the transfer to be resumed..."); // Release the monitor and wait to be notified to continue the transfer. owner.wait(); } catch (InterruptedException e) { log.error("Transfer thread interrupted while paused. Continue transfer.", e); } } } }
Example #3
Source File: BuildLogCommandListener.java From teamcity-deployer-plugin with Apache License 2.0 | 6 votes |
public void protocolCommandSent(ProtocolCommandEvent event) { final StringBuilder sb = new StringBuilder("> "); String cmd = event.getCommand(); if(!"PASS".equalsIgnoreCase(cmd) && !"USER".equalsIgnoreCase(cmd)) { if("LOGIN".equalsIgnoreCase(cmd)) { String msg = event.getMessage(); msg = msg.substring(0, msg.indexOf("LOGIN") + "LOGIN".length()); sb.append(msg).append(" *******"); } else { sb.append(event.getMessage()); } } else { sb.append(cmd).append(" *******"); } logInternalMessage(sb.toString()); }
Example #4
Source File: LoggingProtocolCommandListener.java From cyberduck with GNU General Public License v3.0 | 5 votes |
@Override public void protocolCommandSent(final ProtocolCommandEvent event) { final String message = StringUtils.chomp(event.getMessage()); if(message.startsWith(FTPCmd.PASS.name())) { this.log(Type.request, String.format("%s %s", FTPCmd.PASS.name(), StringUtils.repeat("*", StringUtils.length(StringUtils.removeStart(message, FTPCmd.PASS.name()))))); } else { this.log(Type.request, message); } }
Example #5
Source File: PrintCommandListener.java From nutch-htmlunit with Apache License 2.0 | 5 votes |
private void __logIt(ProtocolCommandEvent event) throws IOException { if (!__logger.isInfoEnabled()) { return; } BufferedReader br = new BufferedReader(new StringReader(event.getMessage())); String line; while ((line = br.readLine()) != null) { __logger.info("ftp> "+line); } }
Example #6
Source File: PrintCommandListener.java From nutch-htmlunit with Apache License 2.0 | 5 votes |
public void protocolReplyReceived(ProtocolCommandEvent event) { try { __logIt(event); } catch (IOException e) { if (__logger.isInfoEnabled()) { __logger.info("PrintCommandListener.protocolReplyReceived(): "+e); } } }
Example #7
Source File: PrintCommandListener.java From nutch-htmlunit with Apache License 2.0 | 5 votes |
public void protocolCommandSent(ProtocolCommandEvent event) { try { __logIt(event); } catch (IOException e) { if (__logger.isInfoEnabled()) { __logger.info("PrintCommandListener.protocolCommandSent(): "+e); } } }
Example #8
Source File: PrintCommandListener.java From anthelion with Apache License 2.0 | 5 votes |
private void __logIt(ProtocolCommandEvent event) throws IOException { if (!__logger.isInfoEnabled()) { return; } BufferedReader br = new BufferedReader(new StringReader(event.getMessage())); String line; while ((line = br.readLine()) != null) { __logger.info("ftp> "+line); } }
Example #9
Source File: PrintCommandListener.java From anthelion with Apache License 2.0 | 5 votes |
public void protocolReplyReceived(ProtocolCommandEvent event) { try { __logIt(event); } catch (IOException e) { if (__logger.isInfoEnabled()) { __logger.info("PrintCommandListener.protocolReplyReceived(): "+e); } } }
Example #10
Source File: PrintCommandListener.java From anthelion with Apache License 2.0 | 5 votes |
public void protocolCommandSent(ProtocolCommandEvent event) { try { __logIt(event); } catch (IOException e) { if (__logger.isInfoEnabled()) { __logger.info("PrintCommandListener.protocolCommandSent(): "+e); } } }
Example #11
Source File: FTPUtils.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public void protocolCommandSent(final ProtocolCommandEvent event) { if (logger.isDebugEnabled()) { logger.debug(processor + " : " + event.getMessage().trim()); } }
Example #12
Source File: LoggingProtocolCommandListener.java From cyberduck with GNU General Public License v3.0 | 4 votes |
@Override public void protocolReplyReceived(final ProtocolCommandEvent event) { this.log(Type.response, StringUtils.chomp(event.getMessage())); }
Example #13
Source File: FtpResponseListener.java From ats-framework with Apache License 2.0 | 4 votes |
@Override public void protocolCommandSent( ProtocolCommandEvent event ) { }
Example #14
Source File: BuildLogCommandListener.java From teamcity-deployer-plugin with Apache License 2.0 | 4 votes |
public void protocolReplyReceived(ProtocolCommandEvent event) { logInternalMessage("< " + event.getMessage()); }
Example #15
Source File: SynchronizationFtpTransferListener.java From ats-framework with Apache License 2.0 | 4 votes |
@Override public void protocolReplyReceived( ProtocolCommandEvent event ) { }
Example #16
Source File: FTPUtils.java From nifi with Apache License 2.0 | 4 votes |
@Override public void protocolCommandSent(final ProtocolCommandEvent event) { if (logger.isDebugEnabled()) { logger.debug(processor + " : " + event.getMessage().trim()); } }
Example #17
Source File: FTPUtils.java From nifi with Apache License 2.0 | 4 votes |
@Override public void protocolReplyReceived(final ProtocolCommandEvent event) { if (logger.isDebugEnabled()) { logger.debug(processor + " : " + event.getMessage().trim()); } }
Example #18
Source File: FtpClient.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void protocolReplyReceived(ProtocolCommandEvent event) { processEvent(event); }
Example #19
Source File: FtpClient.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void protocolCommandSent(ProtocolCommandEvent event) { processEvent(event); }
Example #20
Source File: FTPUtils.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public void protocolReplyReceived(final ProtocolCommandEvent event) { if (logger.isDebugEnabled()) { logger.debug(processor + " : " + event.getMessage().trim()); } }
Example #21
Source File: FtpResponseListener.java From ats-framework with Apache License 2.0 | 3 votes |
@Override public void protocolReplyReceived( ProtocolCommandEvent event ) { responses.add(event.getMessage()); }
Example #22
Source File: FtpListener.java From ats-framework with Apache License 2.0 | 3 votes |
@Override public void protocolReplyReceived( ProtocolCommandEvent event ) { log.debug("Receiving the following reply: " + event.getMessage()); }
Example #23
Source File: FtpListener.java From ats-framework with Apache License 2.0 | 3 votes |
@Override public void protocolCommandSent( ProtocolCommandEvent event ) { log.debug("Sending the following command: " + event.getMessage()); }