org.apache.ftpserver.ftplet
Interface Ftplet

All Known Implementing Classes:
DefaultFtplet

public interface Ftplet

Defines methods that all ftplets must implement. A ftplet is a small Java program that runs within a FTP server. Ftplets receive and respond to requests from FTP clients. This interface defines methods to initialize a ftplet, to service requests, and to remove a ftplet from the server. These are known as life-cycle methods and are called in the following sequence:

  1. The ftplet is constructed.
  2. Then initialized with the init method.
  3. All the callback methods will be invoked.
  4. The ftplet is taken out of service, then destroyed with the destroy method.
  5. Then garbage collected and finalized.
All the callback methods return FtpletEnum. If it returns null FtpletEnum.RET_DEFAULT will be assumed. If any ftplet callback method throws exception, that particular connection will be disconnected.


Method Summary
 void destroy()
          Called by the servlet container to indicate to a ftplet that the ftplet is being taken out of service.
 void init(FtpletContext ftpletContext)
          Called by the ftplet container to indicate to a ftplet that the ftplet is being placed into service.
 FtpletEnum onAppendEnd(FtpSession session, FtpRequest request)
          File append success notification method.
 FtpletEnum onAppendStart(FtpSession session, FtpRequest request)
          File append request notification method.
 FtpletEnum onConnect(FtpSession session)
          Client connect notification method.
 FtpletEnum onDeleteEnd(FtpSession session, FtpRequest request)
          File delete success notification method.
 FtpletEnum onDeleteStart(FtpSession session, FtpRequest request)
          File delete request notification method.
 FtpletEnum onDisconnect(FtpSession session)
          Client disconnect notification method.
 FtpletEnum onDownloadEnd(FtpSession session, FtpRequest request)
          File download success notification method.
 FtpletEnum onDownloadStart(FtpSession session, FtpRequest request)
          File download request notification method.
 FtpletEnum onLogin(FtpSession session, FtpRequest request)
          Client successful login notification method.
 FtpletEnum onMkdirEnd(FtpSession session, FtpRequest request)
          Directory creation success notification method.
 FtpletEnum onMkdirStart(FtpSession session, FtpRequest request)
          Directory creation request notification method.
 FtpletEnum onRenameEnd(FtpSession session, FtpRequest request)
          Rename end notification method.
 FtpletEnum onRenameStart(FtpSession session, FtpRequest request)
          Rename start notification method.
 FtpletEnum onRmdirEnd(FtpSession session, FtpRequest request)
          Directory removal success notification method.
 FtpletEnum onRmdirStart(FtpSession session, FtpRequest request)
          Remove directory request notification method.
 FtpletEnum onSite(FtpSession session, FtpRequest request)
          SITE command notification method.
 FtpletEnum onUploadEnd(FtpSession session, FtpRequest request)
          File upload success notification method.
 FtpletEnum onUploadStart(FtpSession session, FtpRequest request)
          File upload request notification method.
 FtpletEnum onUploadUniqueEnd(FtpSession session, FtpRequest request)
          Unique file create success notification method.
 FtpletEnum onUploadUniqueStart(FtpSession session, FtpRequest request)
          Unique file create request notification method.
 

Method Detail

init

void init(FtpletContext ftpletContext)
          throws FtpException
Called by the ftplet container to indicate to a ftplet that the ftplet is being placed into service. The ftplet container calls the init method exactly once after instantiating the ftplet. The init method must complete successfully before the ftplet can receive any requests.

Throws:
FtpException

destroy

void destroy()
Called by the servlet container to indicate to a ftplet that the ftplet is being taken out of service. This method is only called once all threads within the ftplet's service method have exited. After the ftplet container calls this method, callback methods will not be executed. If the ftplet initialization method fails, this method will not be called.


onConnect

FtpletEnum onConnect(FtpSession session)
                     throws FtpException,
                            java.io.IOException
Client connect notification method.

Throws:
FtpException
java.io.IOException

onDisconnect

FtpletEnum onDisconnect(FtpSession session)
                        throws FtpException,
                               java.io.IOException
Client disconnect notification method. This is the last callback method.

Throws:
FtpException
java.io.IOException

onLogin

FtpletEnum onLogin(FtpSession session,
                   FtpRequest request)
                   throws FtpException,
                          java.io.IOException
Client successful login notification method. If the user has successfully authenticated, the FtpSession.getUser() method will return the user, otherwise it will return null.

Throws:
FtpException
java.io.IOException

onDeleteStart

FtpletEnum onDeleteStart(FtpSession session,
                         FtpRequest request)
                         throws FtpException,
                                java.io.IOException
File delete request notification method.

Throws:
FtpException
java.io.IOException

onDeleteEnd

FtpletEnum onDeleteEnd(FtpSession session,
                       FtpRequest request)
                       throws FtpException,
                              java.io.IOException
File delete success notification method.

Throws:
FtpException
java.io.IOException

onUploadStart

FtpletEnum onUploadStart(FtpSession session,
                         FtpRequest request)
                         throws FtpException,
                                java.io.IOException
File upload request notification method.

Throws:
FtpException
java.io.IOException

onUploadEnd

FtpletEnum onUploadEnd(FtpSession session,
                       FtpRequest request)
                       throws FtpException,
                              java.io.IOException
File upload success notification method.

Throws:
FtpException
java.io.IOException

onDownloadStart

FtpletEnum onDownloadStart(FtpSession session,
                           FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
File download request notification method.

Throws:
FtpException
java.io.IOException

onDownloadEnd

FtpletEnum onDownloadEnd(FtpSession session,
                         FtpRequest request)
                         throws FtpException,
                                java.io.IOException
File download success notification method.

Throws:
FtpException
java.io.IOException

onRmdirStart

FtpletEnum onRmdirStart(FtpSession session,
                        FtpRequest request)
                        throws FtpException,
                               java.io.IOException
Remove directory request notification method.

Throws:
FtpException
java.io.IOException

onRmdirEnd

FtpletEnum onRmdirEnd(FtpSession session,
                      FtpRequest request)
                      throws FtpException,
                             java.io.IOException
Directory removal success notification method.

Throws:
FtpException
java.io.IOException

onMkdirStart

FtpletEnum onMkdirStart(FtpSession session,
                        FtpRequest request)
                        throws FtpException,
                               java.io.IOException
Directory creation request notification method.

Throws:
FtpException
java.io.IOException

onMkdirEnd

FtpletEnum onMkdirEnd(FtpSession session,
                      FtpRequest request)
                      throws FtpException,
                             java.io.IOException
Directory creation success notification method.

Throws:
FtpException
java.io.IOException

onAppendStart

FtpletEnum onAppendStart(FtpSession session,
                         FtpRequest request)
                         throws FtpException,
                                java.io.IOException
File append request notification method.

Throws:
FtpException
java.io.IOException

onAppendEnd

FtpletEnum onAppendEnd(FtpSession session,
                       FtpRequest request)
                       throws FtpException,
                              java.io.IOException
File append success notification method.

Throws:
FtpException
java.io.IOException

onUploadUniqueStart

FtpletEnum onUploadUniqueStart(FtpSession session,
                               FtpRequest request)
                               throws FtpException,
                                      java.io.IOException
Unique file create request notification method.

Throws:
FtpException
java.io.IOException

onUploadUniqueEnd

FtpletEnum onUploadUniqueEnd(FtpSession session,
                             FtpRequest request)
                             throws FtpException,
                                    java.io.IOException
Unique file create success notification method.

Throws:
FtpException
java.io.IOException

onRenameStart

FtpletEnum onRenameStart(FtpSession session,
                         FtpRequest request)
                         throws FtpException,
                                java.io.IOException
Rename start notification method.

Throws:
FtpException
java.io.IOException

onRenameEnd

FtpletEnum onRenameEnd(FtpSession session,
                       FtpRequest request)
                       throws FtpException,
                              java.io.IOException
Rename end notification method.

Throws:
FtpException
java.io.IOException

onSite

FtpletEnum onSite(FtpSession session,
                  FtpRequest request)
                  throws FtpException,
                         java.io.IOException
SITE command notification method.

Throws:
FtpException
java.io.IOException


Copyright © 2003-2008 The Apache Software Foundation. All Rights Reserved.