it.sauronsoftware.ftp4j.connectors
Class FTPProxyConnector

java.lang.Object
  extended by it.sauronsoftware.ftp4j.connectors.FTPProxyConnector
All Implemented Interfaces:
FTPConnector

public class FTPProxyConnector
extends java.lang.Object
implements FTPConnector

This one connects a remote host via a FTP proxy which supports the SITE or the OPEN proxy method.

Author:
Carlo Pelliccia

Field Summary
 int style
          The style used by the proxy.
static int STYLE_OPEN_COMMAND
          Requires the connection to the remote host through a OPEN command without proxy authentication.
static int STYLE_SITE_COMMAND
          Requires the connection to the remote host through a SITE command after proxy authentication.
 
Constructor Summary
FTPProxyConnector(java.lang.String proxyHost, int proxyPort)
          Builds the connector.
FTPProxyConnector(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUser, java.lang.String proxyPass)
          Builds the connector.
 
Method Summary
 FTPConnection connectForCommunicationChannel(java.lang.String host, int port)
          This methods returns an established connection to a remote host, suitable for a FTP communication channel.
 FTPConnection connectForDataTransferChannel(java.lang.String host, int port)
          This methods returns an established connection to a remote host, suitable for a FTP data transfer channel.
 void setStyle(int style)
          Sets the style used by the proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_SITE_COMMAND

public static int STYLE_SITE_COMMAND
Requires the connection to the remote host through a SITE command after proxy authentication. Default one.


STYLE_OPEN_COMMAND

public static int STYLE_OPEN_COMMAND
Requires the connection to the remote host through a OPEN command without proxy authentication.


style

public int style
The style used by the proxy.

Constructor Detail

FTPProxyConnector

public FTPProxyConnector(java.lang.String proxyHost,
                         int proxyPort,
                         java.lang.String proxyUser,
                         java.lang.String proxyPass)
Builds the connector. Default value for the style is STYLE_SITE_COMMAND.

Parameters:
proxyHost - The proxy host name.
proxyPort - The proxy port.
proxyUser - The username for proxy authentication.
proxyPass - The password for proxy authentication.

FTPProxyConnector

public FTPProxyConnector(java.lang.String proxyHost,
                         int proxyPort)
Builds the connector. Default value for the style is STYLE_SITE_COMMAND.

Parameters:
proxyHost - The proxy host name.
proxyPort - The proxy port.
Method Detail

setStyle

public void setStyle(int style)
Sets the style used by the proxy. STYLE_SITE_COMMAND - Requires the connection to the remote host through a SITE command after proxy authentication. STYLE_OPEN_COMMAND - Requires the connection to the remote host through a OPEN command without proxy authentication. Default value for the style is STYLE_SITE_COMMAND.

Parameters:
style - The style.
See Also:
STYLE_SITE_COMMAND, STYLE_OPEN_COMMAND

connectForCommunicationChannel

public FTPConnection connectForCommunicationChannel(java.lang.String host,
                                                    int port)
                                             throws java.io.IOException
Description copied from interface: FTPConnector
This methods returns an established connection to a remote host, suitable for a FTP communication channel.

Specified by:
connectForCommunicationChannel in interface FTPConnector
Parameters:
host - The remote host name or address.
port - The remote port.
Returns:
The connection with the remote host.
Throws:
java.io.IOException - If the connection cannot be established.

connectForDataTransferChannel

public FTPConnection connectForDataTransferChannel(java.lang.String host,
                                                   int port)
                                            throws java.io.IOException
Description copied from interface: FTPConnector
This methods returns an established connection to a remote host, suitable for a FTP data transfer channel.

Specified by:
connectForDataTransferChannel in interface FTPConnector
Parameters:
host - The remote host name or address.
port - The remote port.
Returns:
The connection with the remote host.
Throws:
java.io.IOException - If the connection cannot be established.