Example usage for org.apache.commons.net.ftp FTPClient removeProtocolCommandListener

List of usage examples for org.apache.commons.net.ftp FTPClient removeProtocolCommandListener

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPClient removeProtocolCommandListener.

Prototype

public void removeProtocolCommandListener(ProtocolCommandListener listener) 

Source Link

Document

Removes a ProtocolCommandListener.

Usage

From source file:jenkins.plugins.publish_over_ftp.BapFtpHostConfiguration.java

private void login(final BapFtpClient client, final PrintCommandListener commandListener) throws IOException {
    final FTPClient ftpClient = client.getFtpClient();
    final BPBuildInfo buildInfo = client.getBuildInfo();
    if (commandListener != null) {
        buildInfo.println(Messages.console_logInHidingCommunication());
        ftpClient.removeProtocolCommandListener(commandListener);
    }// w  w  w  .java 2 s  . c o m
    final BapFtpCredentials overrideCredentials = (BapFtpCredentials) buildInfo
            .get(BPBuildInfo.OVERRIDE_CREDENTIALS_CONTEXT_KEY);
    final String username = overrideCredentials == null ? getUsername() : overrideCredentials.getUsername();
    final String password = overrideCredentials == null ? getPassword()
            : Secret.toString(overrideCredentials.getPassword());
    if (!ftpClient.login(username, password)) {
        exception(client, Messages.exception_logInFailed(username));
    }
    if (commandListener != null) {
        buildInfo.println(Messages.console_loggedInShowingCommunication());
        ftpClient.addProtocolCommandListener(commandListener);
    }
}