001 /*
002 * Copyright 2004-2005 The Apache Software Foundation
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.apache.commons.net.ftp.parser;
017 import org.apache.commons.net.ftp.FTPClientConfig;
018 import org.apache.commons.net.ftp.FTPFileEntryParser;
019
020 /**
021 * The interface describes a factory for creating FTPFileEntryParsers.
022 * @since 1.2
023 */
024 public interface FTPFileEntryParserFactory
025 {
026 /**
027 * Implementation should be a method that decodes the
028 * supplied key and creates an object implementing the
029 * interface FTPFileEntryParser.
030 *
031 * @param key A string that somehow identifies an
032 * FTPFileEntryParser to be created.
033 *
034 * @return the FTPFileEntryParser created.
035 * @exception ParserInitializationException
036 * Thrown on any exception in instantiation
037 */
038 public FTPFileEntryParser createFileEntryParser(String key)
039 throws ParserInitializationException;
040
041 /**
042 *<p>
043 * Implementation should be a method that extracts
044 * a key from the supplied {@link FTPClientConfig FTPClientConfig}
045 * parameter and creates an object implementing the
046 * interface FTPFileEntryParser and uses the supplied configuration
047 * to configure it.
048 * </p><p>
049 * Note that this method will generally not be called in scenarios
050 * that call for autodetection of parser type but rather, for situations
051 * where the user knows that the server uses a non-default configuration
052 * and knows what that configuration is.
053 * </p>
054 *
055 * @param config A {@link FTPClientConfig FTPClientConfig}
056 * used to configure the parser created
057 *
058 * @return the @link FTPFileEntryParser FTPFileEntryParser} so created.
059 * @exception ParserInitializationException
060 * Thrown on any exception in instantiation
061 * @since 1.4
062 */
063 public FTPFileEntryParser createFileEntryParser(FTPClientConfig config)
064 throws ParserInitializationException;
065
066 }