jet.server.api.custom.ftp
Interface FTPHandler


public interface FTPHandler

This interface provides the generic FTP connections and operations. Users can provide customized FTP-client handler to implement this interface. Fill the fully-qualified class name of the customized class into the "Handler Class" on the "Schedule->Publish->To FTP" page and add the class into the class path of JReport Server.


Field Summary
static int FTP
          Scheme type FTP.
static int FTPS
          Scheme type FTPS.
static java.lang.String[] SCHEMES
          Contains the schemes "FTP", "SFTP", "SCP", "FTPS", "FTP", "Unknown".
static int SCP
          Scheme type SCP.
static int SFTP
          Scheme type SFPT.
 
Method Summary
 boolean changeDirectory(java.lang.String dirName)
          Changes the current working directory to another directory specified by dirName on the remote FTP site.
 void connect(java.lang.String hostName)
          Connects to the remote FTP site using the specified host and default FTP port.
 void connect(java.lang.String hostName, int port)
          Connects to the remote FTP site using the specified host and port.
 boolean deleteFile(java.lang.String fileName)
          Deletes a file specified by the fileName on the remote FTP site.
 void disconnect()
          Disconnects from the remote FTP site for terminating the connection.
 boolean downloadFile(java.lang.String fileName)
          DownLoads a file specified by the fileName from the remote FTP site, and saves it as the same fileName under the current path.
 boolean downloadFile(java.lang.String fileName, java.lang.String localPath)
          DownLoads a file specified by the fileName from the remote FTP site, and saves it as the same fileName under the specified localPath.
 boolean downloadFile(java.lang.String remoteFileName, java.lang.String localPath, java.lang.String localFileName)
          DownLoads a file specified by the remoteFileName from the remote FTP site, and names it as localFileName under the specified localPath.
 java.lang.String getCurrentDirectory()
          Gets the current working directory on the remote FTP site.
 java.lang.String getScheme()
          Gets the protocol type of current connection.
 boolean login(java.lang.String userName, java.lang.String password)
          Logins to the remote FTP site with the specified userName and password.
 boolean login(java.lang.String userName, java.lang.String password, java.lang.String account)
          Logs in to the remote FTP site using the specified userName, password and account if there is.
 boolean logout()
          Logs out from the remote FTP site for terminating the session.
 boolean makeDirectory(java.lang.String dirName)
          Creates a new directory using the specified dirName under the current working directory on the remote FTP site.
 boolean parentDirectory()
          Changes the current working directory to the parent directory on the remote FTP site.
 void setConnectTimeout(int timeout)
          Sets the connecting timeout on the connection.
 void setReadTimeout(int timeout)
          Sets the read timeout on the connection.
 boolean uploadFile(java.lang.String fileName)
          Uploads a local file specified by the fileName under the current directory to the remote FTP site, and names it as the same fileName.
 boolean uploadFile(java.lang.String localPath, java.lang.String fileName)
          Uploads a local file specified by the fileName under the specified localPath to the remote FTP site, and names it as the same fileName.
 boolean uploadFile(java.lang.String localPath, java.lang.String localFileName, java.lang.String remoteFileName)
          Uploads a local file specified by the localFileName under the specified localPath to the remote FTP site, and names it as remoteFileName.
 

Field Detail

SCHEMES

static final java.lang.String[] SCHEMES
Contains the schemes "FTP", "SFTP", "SCP", "FTPS", "FTP", "Unknown".


FTP

static final int FTP
Scheme type FTP.

See Also:
Constant Field Values

SFTP

static final int SFTP
Scheme type SFPT.

See Also:
Constant Field Values

SCP

static final int SCP
Scheme type SCP.

See Also:
Constant Field Values

FTPS

static final int FTPS
Scheme type FTPS.

See Also:
Constant Field Values
Method Detail

uploadFile

boolean uploadFile(java.lang.String fileName)
                   throws java.io.IOException
Uploads a local file specified by the fileName under the current directory to the remote FTP site, and names it as the same fileName.

Throws:
java.io.IOException

uploadFile

boolean uploadFile(java.lang.String localPath,
                   java.lang.String fileName)
                   throws java.io.IOException
Uploads a local file specified by the fileName under the specified localPath to the remote FTP site, and names it as the same fileName.

Throws:
java.io.IOException

uploadFile

boolean uploadFile(java.lang.String localPath,
                   java.lang.String localFileName,
                   java.lang.String remoteFileName)
                   throws java.io.IOException
Uploads a local file specified by the localFileName under the specified localPath to the remote FTP site, and names it as remoteFileName.

Throws:
java.io.IOException

downloadFile

boolean downloadFile(java.lang.String fileName)
                     throws java.io.IOException
DownLoads a file specified by the fileName from the remote FTP site, and saves it as the same fileName under the current path.

Throws:
java.io.IOException

downloadFile

boolean downloadFile(java.lang.String fileName,
                     java.lang.String localPath)
                     throws java.io.IOException
DownLoads a file specified by the fileName from the remote FTP site, and saves it as the same fileName under the specified localPath.

Throws:
java.io.IOException

downloadFile

boolean downloadFile(java.lang.String remoteFileName,
                     java.lang.String localPath,
                     java.lang.String localFileName)
                     throws java.io.IOException
DownLoads a file specified by the remoteFileName from the remote FTP site, and names it as localFileName under the specified localPath.

Throws:
java.io.IOException

deleteFile

boolean deleteFile(java.lang.String fileName)
                   throws java.io.IOException
Deletes a file specified by the fileName on the remote FTP site.

Throws:
java.io.IOException

makeDirectory

boolean makeDirectory(java.lang.String dirName)
                      throws java.io.IOException
Creates a new directory using the specified dirName under the current working directory on the remote FTP site.

Throws:
java.io.IOException

changeDirectory

boolean changeDirectory(java.lang.String dirName)
                        throws java.io.IOException
Changes the current working directory to another directory specified by dirName on the remote FTP site.

Throws:
java.io.IOException

parentDirectory

boolean parentDirectory()
                        throws java.io.IOException
Changes the current working directory to the parent directory on the remote FTP site.

Throws:
java.io.IOException

getCurrentDirectory

java.lang.String getCurrentDirectory()
                                     throws java.io.IOException
Gets the current working directory on the remote FTP site.

Throws:
java.io.IOException

connect

void connect(java.lang.String hostName)
             throws java.io.IOException
Connects to the remote FTP site using the specified host and default FTP port.

Throws:
java.io.IOException

connect

void connect(java.lang.String hostName,
             int port)
             throws java.io.IOException
Connects to the remote FTP site using the specified host and port.

Throws:
java.io.IOException

login

boolean login(java.lang.String userName,
              java.lang.String password)
              throws java.io.IOException
Logins to the remote FTP site with the specified userName and password.

Throws:
java.io.IOException

login

boolean login(java.lang.String userName,
              java.lang.String password,
              java.lang.String account)
              throws java.io.IOException
Logs in to the remote FTP site using the specified userName, password and account if there is.

Throws:
java.io.IOException

logout

boolean logout()
               throws java.io.IOException
Logs out from the remote FTP site for terminating the session.

Throws:
java.io.IOException

disconnect

void disconnect()
                throws java.io.IOException
Disconnects from the remote FTP site for terminating the connection.

Throws:
java.io.IOException

setReadTimeout

void setReadTimeout(int timeout)
Sets the read timeout on the connection.


setConnectTimeout

void setConnectTimeout(int timeout)
Sets the connecting timeout on the connection.


getScheme

java.lang.String getScheme()
Gets the protocol type of current connection.