Java 类org.apache.commons.net.ftp.Configurable 实例源码

项目:aos-FileCoreLibrary    文件:ConfigurableFTPFileEntryParserImpl.java   
/**
     * 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);
            }
        }
    }
项目:xdman    文件:ConfigurableFTPFileEntryParserImpl.java   
/**
 * 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.
 */
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);
        }
    }
}
项目:xdm    文件:ConfigurableFTPFileEntryParserImpl.java   
public void configure(FTPClientConfig config) {
   if(this.timestampParser instanceof Configurable) {
      FTPClientConfig defaultCfg = this.getDefaultConfiguration();
      if(config != null) {
         if(config.getDefaultDateFormatStr() == null) {
            config.setDefaultDateFormatStr(defaultCfg.getDefaultDateFormatStr());
         }

         if(config.getRecentDateFormatStr() == null) {
            config.setRecentDateFormatStr(defaultCfg.getRecentDateFormatStr());
         }

         ((Configurable)this.timestampParser).configure(config);
      } else {
         ((Configurable)this.timestampParser).configure(defaultCfg);
      }
   }

}
项目:Aria    文件:ConfigurableFTPFileEntryParserImpl.java   
/**
 * 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);
    }
  }
}
项目:aos-FileCoreLibrary    文件:NTFTPEntryParser.java   
/**
 * 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.
 * @exception 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);
    configure(config);
    FTPClientConfig config2 = new FTPClientConfig(
            FTPClientConfig.SYST_NT,
            DEFAULT_DATE_FORMAT2,
            null, null, null, null);
    config2.setDefaultDateFormatStr(DEFAULT_DATE_FORMAT2);
    this.timestampParser = new FTPTimestampParserImpl();
    ((Configurable)this.timestampParser).configure(config2);
}
项目:cyberduck    文件:CompositeFileEntryParser.java   
@Override
public void configure(final FTPClientConfig config) {
    for(FTPFileEntryParser parser : parsers) {
        if(parser instanceof Configurable) {
            ((Configurable) parser).configure(config);
        }
    }
}
项目:xdman    文件:NTFTPEntryParser.java   
/**
 * 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.
 * @exception 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);
    configure(config);
    FTPClientConfig config2 = new FTPClientConfig(
            FTPClientConfig.SYST_NT,
            DEFAULT_DATE_FORMAT2,
            null, null, null, null);
    config2.setDefaultDateFormatStr(DEFAULT_DATE_FORMAT2);
    this.timestampParser = new FTPTimestampParserImpl();
    ((Configurable)this.timestampParser).configure(config2);
}
项目:xdm    文件:NTFTPEntryParser.java   
public NTFTPEntryParser(FTPClientConfig config) {
   super("(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
   this.configure(config);
   FTPClientConfig config2 = new FTPClientConfig("WINDOWS", "MM-dd-yy kk:mm", (String)null, (String)null, (String)null, (String)null);
   config2.setDefaultDateFormatStr("MM-dd-yy kk:mm");
   this.timestampParser = new FTPTimestampParserImpl();
   ((Configurable)this.timestampParser).configure(config2);
}
项目:Aria    文件:NTFTPEntryParser.java   
/**
 * 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);
}