1 /* 2 * ------------------------------------------------------------------------------ 3 * Hermes FTP Server 4 * Copyright (c) 2005-2007 Lars Behnke 5 * ------------------------------------------------------------------------------ 6 * 7 * This file is part of Hermes FTP Server. 8 * 9 * Hermes FTP Server is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * Hermes FTP Server is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with Hermes FTP Server; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 * ------------------------------------------------------------------------------ 23 */ 24 25 package net.sf.hermesftp.cmd; 26 27 import java.io.IOException; 28 import java.net.Socket; 29 30 /*** 31 * Interface implemented by classes that provide for the data channel in passive or active transfer 32 * mode. 33 * 34 * @author Behnke 35 */ 36 public interface SocketProvider { 37 38 /*** 39 * Initializes the provider. 40 * 41 * @throws IOException Error on initializing the data channel. 42 * @return Information about the data channel is provided. 43 */ 44 DataChannelInfo init() throws IOException; 45 46 /*** 47 * Provides the socket for data transfer. Multiple calls of this method do not result in 48 * multiple socket instance. One instance is created and cached. 49 * 50 * @return The Socket. 51 * @throws IOException Error on creating the data channel. 52 */ 53 Socket provideSocket() throws IOException; 54 55 /*** 56 * Closes the socket, if necessary. 57 */ 58 void closeSocket(); 59 60 }