Example usage for org.apache.commons.net.ftp FTPSClient enterLocalActiveMode

List of usage examples for org.apache.commons.net.ftp FTPSClient enterLocalActiveMode

Introduction

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

Prototype

public void enterLocalActiveMode() 

Source Link

Document

Set the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.

Usage

From source file:org.mule.transport.ftps.FtpsConnector.java

/**
 * Passive mode is OFF by default. The value is taken from the connector
 * settings. In case there are any overriding properties set on the endpoint,
 * those will be used.//  ww w .  j  a  va2 s . c  o m
 *
 * @see #setPassive(boolean)
 */
public void enterActiveOrPassiveMode(FTPSClient client, ImmutableEndpoint endpoint) {
    // well, no endpoint URI here, as we have to use the most common denominator
    // in API :(
    final String passiveString = (String) endpoint.getProperty(FtpsConnector.PROPERTY_PASSIVE_MODE);
    if (passiveString == null) {
        // try the connector properties then
        if (isPassive()) {
            if (logger.isTraceEnabled()) {
                logger.trace("Entering FTP passive mode");
            }
            client.enterLocalPassiveMode();
        } else {
            if (logger.isTraceEnabled()) {
                logger.trace("Entering FTP active mode");
            }
            client.enterLocalActiveMode();
        }
    } else {
        // override with endpoint's definition
        final boolean passiveMode = Boolean.valueOf(passiveString).booleanValue();
        if (passiveMode) {
            if (logger.isTraceEnabled()) {
                logger.trace("Entering FTP passive mode (endpoint override)");
            }
            client.enterLocalPassiveMode();
        } else {
            if (logger.isTraceEnabled()) {
                logger.trace("Entering FTP active mode (endpoint override)");
            }
            client.enterLocalActiveMode();
        }
    }
}