1 /* 2 * Copyright 2004-2005 The Apache Software Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.commons.net.ftp.parser; 17 import org.apache.commons.net.ftp.FTPClientConfig; 18 import org.apache.commons.net.ftp.FTPFileEntryParser; 19 20 /** 21 * The interface describes a factory for creating FTPFileEntryParsers. 22 * @since 1.2 23 */ 24 public interface FTPFileEntryParserFactory 25 { 26 /** 27 * Implementation should be a method that decodes the 28 * supplied key and creates an object implementing the 29 * interface FTPFileEntryParser. 30 * 31 * @param key A string that somehow identifies an 32 * FTPFileEntryParser to be created. 33 * 34 * @return the FTPFileEntryParser created. 35 * @exception ParserInitializationException 36 * Thrown on any exception in instantiation 37 */ 38 public FTPFileEntryParser createFileEntryParser(String key) 39 throws ParserInitializationException; 40 41 /** 42 *<p> 43 * Implementation should be a method that extracts 44 * a key from the supplied {@link FTPClientConfig FTPClientConfig} 45 * parameter and creates an object implementing the 46 * interface FTPFileEntryParser and uses the supplied configuration 47 * to configure it. 48 * </p><p> 49 * Note that this method will generally not be called in scenarios 50 * that call for autodetection of parser type but rather, for situations 51 * where the user knows that the server uses a non-default configuration 52 * and knows what that configuration is. 53 * </p> 54 * 55 * @param config A {@link FTPClientConfig FTPClientConfig} 56 * used to configure the parser created 57 * 58 * @return the @link FTPFileEntryParser FTPFileEntryParser} so created. 59 * @exception ParserInitializationException 60 * Thrown on any exception in instantiation 61 * @since 1.4 62 */ 63 public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) 64 throws ParserInitializationException; 65 66 } 67