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