Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClientConfig


     * configure the client
     * @return the client as configured.
     */
    static FTPClient configure(FTPClient client, FTP task) {
        task.log("custom configuration", Project.MSG_VERBOSE);
        FTPClientConfig config;
        String systemTypeKey = task.getSystemTypeKey();
        if (systemTypeKey != null && !"".equals(systemTypeKey)) {
            config = new FTPClientConfig(systemTypeKey);
            task.log("custom config: system key = "
                    + systemTypeKey, Project.MSG_VERBOSE);
        } else {
            config = new FTPClientConfig();
            task.log("custom config: system key = default (UNIX)",
                    Project.MSG_VERBOSE);
        }

        String defaultDateFormatConfig = task.getDefaultDateFormatConfig();
        if (defaultDateFormatConfig != null) {
            config.setDefaultDateFormatStr(defaultDateFormatConfig);
            task.log("custom config: default date format = "
                    + defaultDateFormatConfig, Project.MSG_VERBOSE);
        }

        String recentDateFormatConfig = task.getRecentDateFormatConfig();
        if (recentDateFormatConfig != null) {
            config.setRecentDateFormatStr(recentDateFormatConfig);
            task.log("custom config: recent date format = "
                    + recentDateFormatConfig, Project.MSG_VERBOSE);
        }

        String serverLanguageCodeConfig = task.getServerLanguageCodeConfig();
        if (serverLanguageCodeConfig != null) {
            config.setServerLanguageCode(serverLanguageCodeConfig);
            task.log("custom config: server language code = "
                    + serverLanguageCodeConfig, Project.MSG_VERBOSE);
        }

        String serverTimeZoneConfig = task.getServerTimeZoneConfig();
        if (serverTimeZoneConfig != null) {
            config.setServerTimeZoneId(serverTimeZoneConfig);
            task.log("custom config: server time zone ID = "
                    + serverTimeZoneConfig, Project.MSG_VERBOSE);
        }

        String shortMonthNamesConfig = task.getShortMonthNamesConfig();
        if (shortMonthNamesConfig != null) {
            config.setShortMonthNames(shortMonthNamesConfig);
            task.log("custom config: short month names = "
                    + shortMonthNamesConfig, Project.MSG_VERBOSE);
        }
        client.configure(config);
        return client;
View Full Code Here


        }

        if (ftpClientConfigParameters != null) {
            // client config is optional so create a new one if we have parameter for it
            if (ftpClientConfig == null) {
                ftpClientConfig = new FTPClientConfig();
            }
            IntrospectionSupport.setProperties(ftpClientConfig, ftpClientConfigParameters);
        }

        if (dataTimeout > 0) {
View Full Code Here

        ftp = mockFTPClient;
      } else {
        ftp = new FTPClient();
      }

      FTPClientConfig config = new FTPClientConfig(FTPClientConfig.SYST_MVS);
      ftp.configure(config);

      if (conf.getBoolean(JobBase.PROPERTY_VERBOSE, false)) {
        ftp.addProtocolCommandListener(new PrintCommandListener(
            new PrintWriter(System.out), true));
View Full Code Here

                input.close();
            }
            else if (listFiles)
            {
                if (lenient) {
                    FTPClientConfig config = new FTPClientConfig();
                    config.setLenientFutureDates(true);
                    ftp.configure(config );
                }

                for (FTPFile f : ftp.listFiles(remote)) {
                    System.out.println(f.getRawListing());
View Full Code Here

    /*
     * @return
     */
    @Override
    protected FTPClientConfig getDefaultConfiguration() {
        return new FTPClientConfig(FTPClientConfig.SYST_MVS,
                DEFAULT_DATE_FORMAT, null, null, null, null);
    }
View Full Code Here

     * parameter being specified.
     * @return the default configuration for this parser.
     */
    @Override
    protected FTPClientConfig getDefaultConfiguration() {
        return new FTPClientConfig(
                FTPClientConfig.SYST_UNIX,
                DEFAULT_DATE_FORMAT,
                DEFAULT_RECENT_DATE_FORMAT,
                null, null, null);
    }
View Full Code Here

     * each concrete subclass is used instead.
     */
    public void configure(FTPClientConfig config)
    {
        if (this.timestampParser instanceof Configurable) {
            FTPClientConfig defaultCfg = getDefaultConfiguration();
            if (config != null) {
                if (null == config.getDefaultDateFormatStr()) {
                    config.setDefaultDateFormatStr(defaultCfg.getDefaultDateFormatStr());
                }
                if (null == config.getRecentDateFormatStr()) {
                    config.setRecentDateFormatStr(defaultCfg.getRecentDateFormatStr());
                }
                ((Configurable)this.timestampParser).configure(config);
            } else {
                ((Configurable)this.timestampParser).configure(defaultCfg);
            }
View Full Code Here

        }
       
        if (ftpClientConfigParameters != null) {
            // client config is optional so create a new one if we have parameter for it
            if (ftpClientConfig == null) {
                ftpClientConfig = new FTPClientConfig();
            }
            Map<String, Object> localConfigParameters = new HashMap<String, Object>(ftpClientConfigParameters);
            setProperties(ftpClientConfig, localConfigParameters);
        }
View Full Code Here

        }

        if (ftpClientConfigParameters != null) {
            // client config is optional so create a new one if we have parameter for it
            if (ftpClientConfig == null) {
                ftpClientConfig = new FTPClientConfig();
            }
            Map<String, Object> localConfigParameters = new HashMap<String, Object>(ftpClientConfigParameters);
            setProperties(ftpClientConfig, localConfigParameters);
        }
View Full Code Here

  private SimpleDateFormat df = new SimpleDateFormat();

  public void testParseFieldsOnAIX() {
   
    // Set a date format for this server type
    FTPClientConfig config = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
    config.setDefaultDateFormatStr("dd MMM HH:mm");

    UnixFTPEntryParser parser = new UnixFTPEntryParser();
    parser.configure(config);

    FTPFile f = parser.parseFTPEntry("-rw-r-----   1 ravensm  sca          814 02 Mar 16:27 ZMIR2.m");
View Full Code Here

TOP

Related Classes of org.apache.commons.net.ftp.FTPClientConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.