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

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

Introduction

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

Prototype

public boolean sendNoOp() throws IOException 

Source Link

Document

Sends a NOOP command to the FTP server.

Usage

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

public boolean validateObject(Object obj) {
    FTPSClient client = (FTPSClient) obj;
    try {// w  ww.  ja v a  2s. c  o m
        return client.sendNoOp();
    } catch (IOException e) {
        return false;
    }
}

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

@Override
public RetryContext validateConnection(RetryContext retryContext) {
    FTPSClient client = null;
    try {/*from   w  w w.  j  av a2 s  .co m*/
        client = connector.createFTPSClient(endpoint);
        client.sendNoOp();
        client.logout();
        client.disconnect();

        retryContext.setOk();
    } catch (Exception ex) {
        retryContext.setFailed(ex);
    } finally {
        try {
            if (client != null) {
                connector.releaseFtp(endpoint.getEndpointURI(), client);
            }
        } catch (Exception e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Failed to release ftp client " + client, e);
            }

        }
    }

    return retryContext;
}

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

@Override
public RetryContext validateConnection(RetryContext retryContext) {
    FTPSClient client = null;
    try {//from w  w  w.  ja va  2s.co  m
        client = connector.createFTPSClient(endpoint);
        client.sendNoOp();
        client.logout();
        client.disconnect();

        retryContext.setOk();
    } catch (Exception ex) {
        retryContext.setFailed(ex);
    } finally {
        try {
            if (client != null) {
                connector.releaseFtp(endpoint.getEndpointURI(), client);
            }
        } catch (Exception e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Failed to release ftp client " + client, e);
            }
        }
    }

    return retryContext;
}