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