001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.net.ftp;
020
021import java.io.IOException;
022
023import lucee.runtime.exp.PageException;
024// FUTURE make this interface independent from org.apache so that the loader no longer need the apache.commons... jar
025
026import org.apache.commons.net.ftp.FTPClient;
027
028/**
029 * FTP Pool
030 */
031public interface FTPPool {
032
033    /**
034     * returns a FTPClient from the pool, if no matching exist, create a new one
035     * @param conn
036     * @return Matching FTP Client
037     * @throws IOException
038     * @throws PageException
039     */
040    public abstract FTPClient get(FTPConnection conn) throws IOException, PageException;
041
042    /**
043     * removes a FTPConnectionPro from pool andreturn it (disconnected)
044     * @param conn 
045     * @return disconnetd Client
046     */
047    public abstract FTPClient remove(FTPConnection conn);
048
049    /**
050     * removes a FTPConnectionPro from pool andreturn it (disconnected)
051     * @param name Name of the connection to remove
052     * @return disconnetd Client
053     */
054    public abstract FTPClient remove(String name);
055
056    /**
057     * clears all connection from pool
058     */
059    public abstract void clear();
060
061}