Package org.apache.commons.net.ftp

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


            final FTPClient client = new FTPClient();

            String key = FtpFileSystemConfigBuilder.getInstance().getEntryParser(fileSystemOptions);
            if (key != null)
            {
              FTPClientConfig config = new FTPClientConfig(key);
             
              String serverLanguageCode = FtpFileSystemConfigBuilder.getInstance().getServerLanguageCode(fileSystemOptions);
              if (serverLanguageCode != null)
              {
                config.setServerLanguageCode(serverLanguageCode);
              }
              String defaultDateFormat = FtpFileSystemConfigBuilder.getInstance().getDefaultDateFormat(fileSystemOptions);
              if (defaultDateFormat != null)
              {
                config.setDefaultDateFormatStr(defaultDateFormat);
              }
              String recentDateFormat = FtpFileSystemConfigBuilder.getInstance().getRecentDateFormat(fileSystemOptions);
              if (recentDateFormat != null)
              {
                config.setRecentDateFormatStr(recentDateFormat);
              }
              String serverTimeZoneId = FtpFileSystemConfigBuilder.getInstance().getServerTimeZoneId(fileSystemOptions);
              if (serverTimeZoneId != null)
              {
                config.setServerTimeZoneId(serverTimeZoneId);
              }
              String[] shortMonthNames = FtpFileSystemConfigBuilder.getInstance().getShortMonthNames(fileSystemOptions);
              if (shortMonthNames != null)
              {
                StringBuffer shortMonthNamesStr = new StringBuffer(40);
                for (int i = 0; i<shortMonthNames.length; i++)
                {
                  if (shortMonthNamesStr.length()>0)
                  {
                    shortMonthNamesStr.append("|");
                  }
                  shortMonthNamesStr.append(shortMonthNames[i]);                 
                }
                config.setShortMonthNames(shortMonthNamesStr.toString());
              }
             
              client.configure(config);
            }
           
View Full Code Here


        jndi.bind("myConfig", createConfig());
        return jndi;
    }

    private FTPClientConfig createConfig() {
        FTPClientConfig config = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
        config.setServerTimeZoneId("Europe/Paris");
        return config;
    }
View Full Code Here

    private void configureFTPClientConfig(Map parameters, RemoteFileEndpoint endpoint) {
        // lookup client config in registry if provided
        String ref = getAndRemoveParameter(parameters, "ftpClientConfig", String.class);
        if (ref != null) {
            FTPClientConfig ftpClientConfig = this.getCamelContext().getRegistry().lookup(ref, FTPClientConfig.class);
            if (ftpClientConfig == null) {
                throw new IllegalArgumentException("FTPClientConfig " + ref + " not found in registry.");
            }
            endpoint.getConfiguration().setFtpClientConfig(ftpClientConfig);
        }
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

     * 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

    private static void configureClient(FileSystemOptions fileSystemOptions, FTPClient client)
    {
        String key = FtpFileSystemConfigBuilder.getInstance().getEntryParser(fileSystemOptions);
        if (key != null)
        {
            FTPClientConfig config = new FTPClientConfig(key);

            String serverLanguageCode =
                FtpFileSystemConfigBuilder.getInstance().getServerLanguageCode(fileSystemOptions);
            if (serverLanguageCode != null)
            {
                config.setServerLanguageCode(serverLanguageCode);
            }
            String defaultDateFormat =
                FtpFileSystemConfigBuilder.getInstance().getDefaultDateFormat(fileSystemOptions);
            if (defaultDateFormat != null)
            {
                config.setDefaultDateFormatStr(defaultDateFormat);
            }
            String recentDateFormat =
                FtpFileSystemConfigBuilder.getInstance().getRecentDateFormat(fileSystemOptions);
            if (recentDateFormat != null)
            {
                config.setRecentDateFormatStr(recentDateFormat);
            }
            String serverTimeZoneId =
                FtpFileSystemConfigBuilder.getInstance().getServerTimeZoneId(fileSystemOptions);
            if (serverTimeZoneId != null)
            {
                config.setServerTimeZoneId(serverTimeZoneId);
            }
            String[] shortMonthNames =
                FtpFileSystemConfigBuilder.getInstance().getShortMonthNames(fileSystemOptions);
            if (shortMonthNames != null)
            {
                StringBuilder shortMonthNamesStr = new StringBuilder(BUFSZ);
                for (int i = 0; i < shortMonthNames.length; i++)
                {
                    if (shortMonthNamesStr.length() > 0)
                    {
                        shortMonthNamesStr.append("|");
                    }
                    shortMonthNamesStr.append(shortMonthNames[i]);
                }
                config.setShortMonthNames(shortMonthNamesStr.toString());
            }

            client.configure(config);
        }
    }
View Full Code Here

            }

                String key = FtpsFileSystemConfigBuilder.getInstance().getEntryParser(fileSystemOptions);
                if (key != null)
                {
                    FTPClientConfig config = new FTPClientConfig(key);

                    String serverLanguageCode = FtpsFileSystemConfigBuilder.getInstance().getServerLanguageCode(
                        fileSystemOptions);
                    if (serverLanguageCode != null)
                    {
                        config.setServerLanguageCode(serverLanguageCode);
                    }
                    String defaultDateFormat = FtpsFileSystemConfigBuilder.getInstance().getDefaultDateFormat(
                        fileSystemOptions);
                    if (defaultDateFormat != null)
                    {
                        config.setDefaultDateFormatStr(defaultDateFormat);
                    }
                    String recentDateFormat = FtpsFileSystemConfigBuilder.getInstance().getRecentDateFormat(
                        fileSystemOptions);
                    if (recentDateFormat != null)
                    {
                        config.setRecentDateFormatStr(recentDateFormat);
                    }
                    String serverTimeZoneId = FtpsFileSystemConfigBuilder.getInstance().getServerTimeZoneId(
                        fileSystemOptions);
                    if (serverTimeZoneId != null)
                    {
                        config.setServerTimeZoneId(serverTimeZoneId);
                    }
                    String[] shortMonthNames = FtpsFileSystemConfigBuilder.getInstance().getShortMonthNames(
                        fileSystemOptions);
                    if (shortMonthNames != null)
                    {
                        StringBuilder shortMonthNamesStr = new StringBuilder(40);
                        for (int i = 0; i < shortMonthNames.length; i++)
                        {
                            if (shortMonthNamesStr.length() > 0)
                            {
                                shortMonthNamesStr.append("|");
                            }
                            shortMonthNamesStr.append(shortMonthNames[i]);
                        }
                        config.setShortMonthNames(shortMonthNamesStr.toString());
                    }

                    client.configure(config);
                }
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

        }
       
        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

        FTPTimestampParserImpl parser = new FTPTimestampParserImpl();

        // assume we are FTPing a server in Chicago, two hours ahead of
        // L. A.
        FTPClientConfig config =
            new FTPClientConfig(FTPClientConfig.SYST_UNIX);
        config.setDefaultDateFormatStr(FTPTimestampParser.DEFAULT_SDF);
        config.setRecentDateFormatStr(FTPTimestampParser.DEFAULT_RECENT_SDF);
        // 2 hours difference
        config.setServerTimeZoneId("America/Chicago");
        config.setLenientFutureDates(false); // NET-407
        parser.configure(config);

        SimpleDateFormat sdf = (SimpleDateFormat)
            parser.getRecentDateFormat().clone();
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.