    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;
    019import org.apache.commons.net.ftp.FTPClientConfig;
    020import org.apache.commons.net.ftp.FTPFileEntryParser;
    021
    022/**
    023 * The interface describes a factory for creating FTPFileEntryParsers.
    024 * @since 1.2
    025 */
    026public interface FTPFileEntryParserFactory
    027{
    028    /**
    029     * Implementation should be a method that decodes the
    030     * supplied key and creates an object implementing the
    031     * interface FTPFileEntryParser.
    032     *
    033     * @param key    A string that somehow identifies an
    034     *               FTPFileEntryParser to be created.
    035     *
    036     * @return the FTPFileEntryParser created.
    037     * @throws ParserInitializationException
    038     *                   Thrown on any exception in instantiation
    039     */
    040    FTPFileEntryParser createFileEntryParser(String key)
    041        throws ParserInitializationException;
    042
    043    /**
    044     *<p>
    045     * Implementation should be a method that extracts
    046     * a key from the supplied {@link  FTPClientConfig FTPClientConfig}
    047     * parameter and creates an object implementing the
    048     * interface FTPFileEntryParser and uses the supplied configuration
    049     * to configure it.
    050     * </p><p>
    051     * Note that this method will generally not be called in scenarios
    052     * that call for autodetection of parser type but rather, for situations
    053     * where the user knows that the server uses a non-default configuration
    054     * and knows what that configuration is.
    055     * </p>
    056     *
    057     * @param config  A {@link  FTPClientConfig FTPClientConfig}
    058     * used to configure the parser created
    059     *
    060     * @return the @link  FTPFileEntryParser FTPFileEntryParser} so created.
    061     * @throws ParserInitializationException
    062     *                   Thrown on any exception in instantiation
    063     * @since 1.4
    064     */
    065    FTPFileEntryParser createFileEntryParser(FTPClientConfig config)
    066        throws ParserInitializationException;
    067
    068}