@Override protected FTPClientConfig getDefaultConfiguration() { return new FTPClientConfig(FTPClientConfig.SYST_MVS, DEFAULT_DATE_FORMAT, null); }
/** * Implementation of the {@link Configurable Configurable} * interface. Configures this parser by delegating to the * underlying Configurable FTPTimestampParser implementation, ' * passing it the supplied {@link FTPClientConfig FTPClientConfig} * if that is non-null or a default configuration defined by * each concrete subclass. * * @param config the configuration to be used to configure this parser. * If it is null, a default configuration defined by * each concrete subclass is used instead. */ @Override 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); } } }
/** * Creates an NT FTP parser: if the config exists, and the system key equals * {@link FTPClientConfig.SYST_NT} then a plain {@link NTFTPEntryParser} is used, * otherwise a composite of {@link NTFTPEntryParser} and {@link UnixFTPEntryParser} is used. * @param config the config to use, may be {@code null} * @return the parser */ private FTPFileEntryParser createNTFTPEntryParser(FTPClientConfig config) { if (config != null && FTPClientConfig.SYST_NT.equals( config.getServerSystemKey())) { return new NTFTPEntryParser(config); } else { // clone the config as it may be changed by the parsers (NET-602) final FTPClientConfig config2 = (config != null) ? new FTPClientConfig(config) : null; return new CompositeFileEntryParser(new FTPFileEntryParser[] { new NTFTPEntryParser(config), new UnixFTPEntryParser(config2, config2 != null && FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(config2.getServerSystemKey())) }); } }
/** * This constructor allows the creation of an NTFTPEntryParser object * with something other than the default configuration. * * @param config The {@link FTPClientConfig configuration} object used to * configure this parser. * @throws IllegalArgumentException * Thrown if the regular expression is unparseable. Should not be seen * under normal conditions. It it is seen, this is a sign that * <code>REGEX</code> is not a valid regular expression. * @since 1.4 */ public NTFTPEntryParser(FTPClientConfig config) { super(REGEX, Pattern.DOTALL); configure(config); FTPClientConfig config2 = new FTPClientConfig( FTPClientConfig.SYST_NT, DEFAULT_DATE_FORMAT2, null); config2.setDefaultDateFormatStr(DEFAULT_DATE_FORMAT2); this.timestampParser = new FTPTimestampParserImpl(); ((Configurable)this.timestampParser).configure(config2); }
private void configureClient(final FileSystemOptions fileSystemOptions, final C client) { final String key = builder.getEntryParser(fileSystemOptions); if (key != null) { final FTPClientConfig config = new FTPClientConfig(key); config.setServerLanguageCode(serverLanguageCode); config.setDefaultDateFormatStr(defaultDateFormat); config.setRecentDateFormatStr(recentDateFormat); config.setServerTimeZoneId(serverTimeZoneId); config.setShortMonthNames(shortMonthNamesStr.toString());
ftpClientConfig = new FTPClientConfig(systemKey); ftpClientConfig.setServerLanguageCode(serverLanguageCode); ftpClientConfig.setServerTimeZoneId(serverTimeZoneId);
@Override protected FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = super.getDefaultConfiguration(); config.setServerTimeZoneId(timezone.getID()); return config; } }
DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); FTPClientConfig config = new FTPClientConfig(); config.setServerTimeZoneId("America/New_York");
/** * Defines a default configuration to be used when this class is * instantiated without a {@link FTPClientConfig FTPClientConfig} * parameter being specified. * * @return the default configuration for this parser. */ @Override protected FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = new FTPClientConfig( FTPClientConfig.SYST_UNIX, FTPTimestampParser.DEFAULT_SDF, FTPTimestampParser.DEFAULT_RECENT_SDF, null, null, null); config.setLenientFutureDates(true); return config; }
/** * <p>Implementation extracts a key from the supplied * {@link FTPClientConfig FTPClientConfig} * parameter and creates an object implementing the * interface FTPFileEntryParser and uses the supplied configuration * to configure it. * </p><p> * Note that this method will generally not be called in scenarios * that call for autodetection of parser type but rather, for situations * where the user knows that the server uses a non-default configuration * and knows what that configuration is. * </p> * @param config A {@link FTPClientConfig FTPClientConfig} * used to configure the parser created * * @return the @link FTPFileEntryParser FTPFileEntryParser} so created. * @throws ParserInitializationException * Thrown on any exception in instantiation * @throws NullPointerException if {@code config} is {@code null} * @since 1.4 */ @Override public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) throws ParserInitializationException { String key = config.getServerSystemKey(); return createFileEntryParser(key, config); }
public CompositeFileEntryParser createFileEntryParser(final FTPClientConfig config) throws ParserInitializationException { return this.createFileEntryParser(config.getServerSystemKey(), TimeZone.getTimeZone(config.getServerTimeZoneId())); }
private void configureClient(final FileSystemOptions fileSystemOptions, final C client) { final String key = builder.getEntryParser(fileSystemOptions); if (key != null) { final FTPClientConfig config = new FTPClientConfig(key); config.setServerLanguageCode(serverLanguageCode); config.setDefaultDateFormatStr(defaultDateFormat); config.setRecentDateFormatStr(recentDateFormat); config.setServerTimeZoneId(serverTimeZoneId); config.setShortMonthNames(shortMonthNamesStr.toString());
ftpClientConfig = new FTPClientConfig(systemKey); ftpClientConfig.setServerLanguageCode(serverLanguageCode); ftpClientConfig.setServerTimeZoneId(serverTimeZoneId);
@Override protected FTPClientConfig getDefaultConfiguration() { final FTPClientConfig config = super.getDefaultConfiguration(); config.setServerTimeZoneId(timezone.getID()); return config; } },
} else if (listFiles) { if (lenient) { FTPClientConfig config = new FTPClientConfig(); config.setLenientFutureDates(true); ftp.configure(config);
@Override public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) throws ParserInitializationException { String key = config.getServerSystemKey(); return createFileEntryParser(key, config); }
private void configureClient(final FileSystemOptions fileSystemOptions, final C client) { final String key = builder.getEntryParser(fileSystemOptions); if (key != null) { final FTPClientConfig config = new FTPClientConfig(key); config.setServerLanguageCode(serverLanguageCode); config.setDefaultDateFormatStr(defaultDateFormat); config.setRecentDateFormatStr(recentDateFormat); config.setServerTimeZoneId(serverTimeZoneId); config.setShortMonthNames(shortMonthNamesStr.toString());
/** * Defines a default configuration to be used when this class is * instantiated without a {@link FTPClientConfig FTPClientConfig} * parameter being specified. * @return the default configuration for this parser. */ @Override protected FTPClientConfig getDefaultConfiguration() { return new FTPClientConfig(FTPClientConfig.SYST_NETWARE, DEFAULT_DATE_FORMAT, DEFAULT_RECENT_DATE_FORMAT); }
/** * Implementation of the {@link Configurable Configurable} * interface. Configures this parser by delegating to the * underlying Configurable FTPTimestampParser implementation, ' * passing it the supplied {@link FTPClientConfig FTPClientConfig} * if that is non-null or a default configuration defined by * each concrete subclass. * </p> * @param config the configuration to be used to configure this parser. * If it is null, a default configuration defined by * 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); } } }
/** * Creates an OS400 FTP parser: if the config exists, and the system key equals * {@link FTPClientConfig.SYST_OS400} then a plain {@link OS400FTPEntryParser} is used, * otherwise a composite of {@link OS400FTPEntryParser} and {@link UnixFTPEntryParser} is used. * @param config the config to use, may be {@code null} * @return the parser */ private FTPFileEntryParser createOS400FTPEntryParser(FTPClientConfig config) { if (config != null && FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) { return new OS400FTPEntryParser(config); } else { // clone the config as it may be changed by the parsers (NET-602) final FTPClientConfig config2 = (config != null) ? new FTPClientConfig(config) : null; return new CompositeFileEntryParser(new FTPFileEntryParser[] { new OS400FTPEntryParser(config), new UnixFTPEntryParser(config2, config2 != null && FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(config2.getServerSystemKey())) }); } }