Example usage for org.apache.commons.net.ftp FTPClientConfig SYST_OS2

List of usage examples for org.apache.commons.net.ftp FTPClientConfig SYST_OS2

Introduction

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

Prototype

String SYST_OS2

To view the source code for org.apache.commons.net.ftp FTPClientConfig SYST_OS2.

Click Source Link

Document

Identifier by which an OS/2-based ftp server is known throughout the commons-net ftp system.

Usage

From source file:ch.cyberduck.core.ftp.FTPParserFactory.java

public CompositeFileEntryParser createFileEntryParser(final String system, final TimeZone timezone)
        throws ParserInitializationException {
    if (null != system) {
        String ukey = system.toUpperCase(Locale.ROOT);
        if (ukey.contains(FTPClientConfig.SYST_UNIX)) {
            return this.createUnixFTPEntryParser(timezone);
        } else if (ukey.contains(FTPClientConfig.SYST_VMS)) {
            throw new ParserInitializationException(
                    String.format("\"%s\" is not currently a supported system.", system));
        } else if (ukey.contains(FTPClientConfig.SYST_NETWARE)) {
            return this.createNetwareFTPEntryParser(timezone);
        } else if (ukey.contains(FTPClientConfig.SYST_NT)) {
            return this.createNTFTPEntryParser(timezone);
        } else if (ukey.contains(FTPClientConfig.SYST_OS2)) {
            return this.createOS2FTPEntryParser(timezone);
        } else if (ukey.contains(FTPClientConfig.SYST_OS400)) {
            return this.createOS400FTPEntryParser(timezone);
        } else if (ukey.contains(FTPClientConfig.SYST_MVS)) {
            return this.createUnixFTPEntryParser(timezone);
        }//  ww w.j  a v  a 2 s  .  co  m
    }
    // Defaulting to UNIX parser
    return this.createUnixFTPEntryParser(timezone);
}

From source file:it.greenvulcano.util.remotefs.ftp.FTPManager.java

/**
 * @see it.greenvulcano.util.remotefs.RemoteManager#init(Node)
 *//*from ww w  .  j  a  va  2s.  co m*/
@Override
public void init(Node node) throws RemoteManagerException {
    super.init(node);
    try {
        hostType = TargetType.valueOf(XMLConfig.get(node, "@hostType"));
        logger.debug("host-type          : " + hostType);

        FTPClientConfig conf = null;

        switch (hostType) {
        case MVS: {
            conf = new FTPClientConfig(FTPClientConfig.SYST_MVS);
            break;
        }
        case NT: {
            conf = new FTPClientConfig(FTPClientConfig.SYST_NT);
            break;
        }
        case OS2: {
            conf = new FTPClientConfig(FTPClientConfig.SYST_OS2);
            break;
        }
        case OS400: {
            conf = new FTPClientConfig(FTPClientConfig.SYST_OS400);
            break;
        }
        case UNIX: {
            conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
            break;
        }
        case VMS: {
            conf = new FTPClientConfig(FTPClientConfig.SYST_VMS);
            break;
        }
        }

        ftpClient.configure(conf);
        ftpClient.setDefaultTimeout(connectTimeout);
        ftpClient.setDataTimeout(dataTimeout);
    } catch (Exception exc) {
        throw new RemoteManagerException("Initialization error", exc);
    }
}

From source file:org.openo.nfvo.emsdriver.commons.ftp.ExtendsDefaultFTPFileEntryParserFactory.java

/**
* This default implementation of the FTPFileEntryParserFactory
* interface works according to the following logic:
* First it attempts to interpret the supplied key as a fully
* qualified classname of a class implementing the
* FTPFileEntryParser interface.  If that succeeds, a parser
* object of this class is instantiated and is returned; 
* otherwise it attempts to interpret the key as an identirier
* commonly used by the FTP SYST command to identify systems.
* <p/>//w ww .  j  a v  a2s .  c o  m
* If <code>key</code> is not recognized as a fully qualified
* classname known to the system, this method will then attempt
* to see whether it <b>contains</b> a string identifying one of
* the known parsers.  This comparison is <b>case-insensitive</b>.
* The intent here is where possible, to select as keys strings
* which are returned by the SYST command on the systems which
* the corresponding parser successfully parses.  This enables
* this factory to be used in the auto-detection system.
* <p/>
*
* @param key    should be a fully qualified classname corresponding to
*               a class implementing the FTPFileEntryParser interface<br/>
*               OR<br/>
*               a string containing (case-insensitively) one of the
*               following keywords:
*               <ul>
*               <li>{@link FTPClientConfig#SYST_UNIX UNIX}</li>
*               <li>{@link FTPClientConfig#SYST_NT WINDOWS}</li>
*               <li>{@link FTPClientConfig#SYST_OS2 OS/2}</li>
*               <li>{@link FTPClientConfig#SYST_OS400 OS/400}</li>
*               <li>{@link FTPClientConfig#SYST_VMS VMS}</li>
*               <li>{@link FTPClientConfig#SYST_MVS MVS}</li>
*               </ul>
* @return the FTPFileEntryParser corresponding to the supplied key.
* @throws ParserInitializationException thrown if for any reason the factory cannot resolve
*                   the supplied key into an FTPFileEntryParser.
* @see FTPFileEntryParser
*/
public FTPFileEntryParser createFileEntryParser(String key) {
    @SuppressWarnings("rawtypes")
    Class parserClass = null;
    FTPFileEntryParser parser = null;
    try {
        parserClass = Class.forName(key);
        parser = (FTPFileEntryParser) parserClass.newInstance();
    } catch (ClassNotFoundException e) {
        String ukey = null;
        if (null != key) {
            ukey = key.toUpperCase();
        }
        if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0) {
            parser = createUnixFTPEntryParser();
        } else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0) {
            parser = createVMSVersioningFTPEntryParser();
        } else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0 || ukey.indexOf("DOPRA") >= 0
                || ukey.indexOf("MSDOS") >= 0) {
            parser = createNTFTPEntryParser();
        } else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0) {
            parser = createOS2FTPEntryParser();
        } else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0) {
            parser = createOS400FTPEntryParser();
        } else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0) {
            parser = createMVSEntryParser();
        } else {
            throw new ParserInitializationException("Unknown parser type: " + key);
        }
    } catch (ClassCastException e) {
        throw new ParserInitializationException(parserClass.getName() + " does not implement the interface "
                + "org.apache.commons.net.ftp.FTPFileEntryParser.", e);
    } catch (Throwable e) {
        throw new ParserInitializationException("Error initializing parser", e);
    }

    if (parser instanceof Configurable) {
        ((Configurable) parser).configure(this.config);
    }
    return parser;
}