net.sf.hermesftp.cmd
Class ActiveModeSocketProvider

java.lang.Object
  extended by net.sf.hermesftp.cmd.ActiveModeSocketProvider
All Implemented Interfaces:
SocketProvider

public class ActiveModeSocketProvider
extends java.lang.Object
implements SocketProvider

Provider for the client socket (active transfer). The creation of the socket is deferred until it is needed.

Author:
Behnke

Constructor Summary
ActiveModeSocketProvider(FtpSessionContext ctx, DataChannelInfo info)
          Constructor.
 
Method Summary
 void closeSocket()
          Closes the socket, if necessary.
 DataChannelInfo init()
          Initializes the provider.
 java.net.Socket provideSocket()
          Provides the socket for data transfer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveModeSocketProvider

public ActiveModeSocketProvider(FtpSessionContext ctx,
                                DataChannelInfo info)
Constructor.

Parameters:
ctx - Session context.
info - Channel about the data channel to open.
Method Detail

init

public DataChannelInfo init()
                     throws java.io.IOException
Initializes the provider.

Specified by:
init in interface SocketProvider
Returns:
Information about the data channel is provided.
Throws:
java.io.IOException - Error on initializing the data channel.

provideSocket

public java.net.Socket provideSocket()
                              throws java.io.IOException
Provides the socket for data transfer. Multiple calls of this method do not result in multiple socket instance. One instance is created and cached.

Specified by:
provideSocket in interface SocketProvider
Returns:
The Socket.
Throws:
java.io.IOException - Error on creating the data channel.

closeSocket

public void closeSocket()
Closes the socket, if necessary.

Specified by:
closeSocket in interface SocketProvider


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.