org.apache.ftpserver.ftplet
Class DefaultFtplet

java.lang.Object
  extended by org.apache.ftpserver.ftplet.DefaultFtplet
All Implemented Interfaces:
Ftplet
Direct Known Subclasses:
MyFtplet

public class DefaultFtplet
extends java.lang.Object
implements Ftplet

Default ftplet implementation. All the callback method returns null. It is just an empty implementation. You can derive your ftplet implementation from this class.

Version:
$Rev: 719389 $, $Date: 2008-11-20 22:50:22 +0100 (Thu, 20 Nov 2008) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Constructor Summary
DefaultFtplet()
           
 
Method Summary
 FtpletResult afterCommand(FtpSession session, FtpRequest request, FtpReply reply)
          Called by the ftplet container after a command has been executed by the server.
 FtpletResult beforeCommand(FtpSession session, FtpRequest request)
          Called by the ftplet container before a command is executed by the server.
 void destroy()
          Called by the Ftplet 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.
 FtpletResult onAppendEnd(FtpSession session, FtpRequest request)
          Override this method to intercept file appends after completion
 FtpletResult onAppendStart(FtpSession session, FtpRequest request)
          Override this method to intercept file appends
 FtpletResult onConnect(FtpSession session)
          Client connect notification method.
 FtpletResult onDeleteEnd(FtpSession session, FtpRequest request)
          Override this method to handle deletions after completion
 FtpletResult onDeleteStart(FtpSession session, FtpRequest request)
          Override this method to intercept deletions
 FtpletResult onDisconnect(FtpSession session)
          Client disconnect notification method.
 FtpletResult onDownloadEnd(FtpSession session, FtpRequest request)
          Override this method to handle downloads after completion
 FtpletResult onDownloadStart(FtpSession session, FtpRequest request)
          Override this method to intercept downloads
 FtpletResult onLogin(FtpSession session, FtpRequest request)
          Override this method to intercept user logins
 FtpletResult onMkdirEnd(FtpSession session, FtpRequest request)
          Override this method to handle creation of directories after completion
 FtpletResult onMkdirStart(FtpSession session, FtpRequest request)
          Override this method to intercept creation of directories
 FtpletResult onRenameEnd(FtpSession session, FtpRequest request)
          Override this method to handle renames after completion
 FtpletResult onRenameStart(FtpSession session, FtpRequest request)
          Override this method to intercept renames
 FtpletResult onRmdirEnd(FtpSession session, FtpRequest request)
          Override this method to handle deletion of directories after completion
 FtpletResult onRmdirStart(FtpSession session, FtpRequest request)
          Override this method to intercept deletion of directories
 FtpletResult onSite(FtpSession session, FtpRequest request)
          Override this method to intercept SITE commands
 FtpletResult onUploadEnd(FtpSession session, FtpRequest request)
          Override this method to handle uploads after completion
 FtpletResult onUploadStart(FtpSession session, FtpRequest request)
          Override this method to intercept uploads
 FtpletResult onUploadUniqueEnd(FtpSession session, FtpRequest request)
          Override this method to handle unique uploads after completion
 FtpletResult onUploadUniqueStart(FtpSession session, FtpRequest request)
          Override this method to intercept unique uploads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFtplet

public DefaultFtplet()
Method Detail

init

public void init(FtpletContext ftpletContext)
          throws FtpException
Description copied from interface: Ftplet
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.

Specified by:
init in interface Ftplet
Parameters:
ftpletContext - The current FtpletContext
Throws:
FtpException

destroy

public void destroy()
Description copied from interface: Ftplet
Called by the Ftplet 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.

Specified by:
destroy in interface Ftplet

onConnect

public FtpletResult onConnect(FtpSession session)
                       throws FtpException,
                              java.io.IOException
Description copied from interface: Ftplet
Client connect notification method.

Specified by:
onConnect in interface Ftplet
Parameters:
session - The current FtpSession
Returns:
The desired action to be performed by the server
Throws:
FtpException
java.io.IOException

onDisconnect

public FtpletResult onDisconnect(FtpSession session)
                          throws FtpException,
                                 java.io.IOException
Description copied from interface: Ftplet
Client disconnect notification method. This is the last callback method.

Specified by:
onDisconnect in interface Ftplet
Parameters:
session - The current FtpSession
Returns:
The desired action to be performed by the server
Throws:
FtpException
java.io.IOException

beforeCommand

public FtpletResult beforeCommand(FtpSession session,
                                  FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
Description copied from interface: Ftplet
Called by the ftplet container before a command is executed by the server. The implementation should return based on the desired action to be taken by the server:

Specified by:
beforeCommand in interface Ftplet
Parameters:
session - The current session
request - The current request
Returns:
The desired action to be performed by the server
Throws:
FtpException
java.io.IOException

afterCommand

public FtpletResult afterCommand(FtpSession session,
                                 FtpRequest request,
                                 FtpReply reply)
                          throws FtpException,
                                 java.io.IOException
Description copied from interface: Ftplet
Called by the ftplet container after a command has been executed by the server. The implementation should return based on the desired action to be taken by the server:

Specified by:
afterCommand in interface Ftplet
Parameters:
session - The current session
request - The current request
reply - the reply that was sent for this command. Implementations can use this to check the reply code and thus determine if the command was successfully processed or not.
Returns:
The desired action to be performed by the server
Throws:
FtpException
java.io.IOException

onLogin

public FtpletResult onLogin(FtpSession session,
                            FtpRequest request)
                     throws FtpException,
                            java.io.IOException
Override this method to intercept user logins

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onDeleteStart

public FtpletResult onDeleteStart(FtpSession session,
                                  FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
Override this method to intercept deletions

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onDeleteEnd

public FtpletResult onDeleteEnd(FtpSession session,
                                FtpRequest request)
                         throws FtpException,
                                java.io.IOException
Override this method to handle deletions after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onUploadStart

public FtpletResult onUploadStart(FtpSession session,
                                  FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
Override this method to intercept uploads

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onUploadEnd

public FtpletResult onUploadEnd(FtpSession session,
                                FtpRequest request)
                         throws FtpException,
                                java.io.IOException
Override this method to handle uploads after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onDownloadStart

public FtpletResult onDownloadStart(FtpSession session,
                                    FtpRequest request)
                             throws FtpException,
                                    java.io.IOException
Override this method to intercept downloads

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onDownloadEnd

public FtpletResult onDownloadEnd(FtpSession session,
                                  FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
Override this method to handle downloads after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onRmdirStart

public FtpletResult onRmdirStart(FtpSession session,
                                 FtpRequest request)
                          throws FtpException,
                                 java.io.IOException
Override this method to intercept deletion of directories

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onRmdirEnd

public FtpletResult onRmdirEnd(FtpSession session,
                               FtpRequest request)
                        throws FtpException,
                               java.io.IOException
Override this method to handle deletion of directories after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onMkdirStart

public FtpletResult onMkdirStart(FtpSession session,
                                 FtpRequest request)
                          throws FtpException,
                                 java.io.IOException
Override this method to intercept creation of directories

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onMkdirEnd

public FtpletResult onMkdirEnd(FtpSession session,
                               FtpRequest request)
                        throws FtpException,
                               java.io.IOException
Override this method to handle creation of directories after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onAppendStart

public FtpletResult onAppendStart(FtpSession session,
                                  FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
Override this method to intercept file appends

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onAppendEnd

public FtpletResult onAppendEnd(FtpSession session,
                                FtpRequest request)
                         throws FtpException,
                                java.io.IOException
Override this method to intercept file appends after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onUploadUniqueStart

public FtpletResult onUploadUniqueStart(FtpSession session,
                                        FtpRequest request)
                                 throws FtpException,
                                        java.io.IOException
Override this method to intercept unique uploads

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onUploadUniqueEnd

public FtpletResult onUploadUniqueEnd(FtpSession session,
                                      FtpRequest request)
                               throws FtpException,
                                      java.io.IOException
Override this method to handle unique uploads after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onRenameStart

public FtpletResult onRenameStart(FtpSession session,
                                  FtpRequest request)
                           throws FtpException,
                                  java.io.IOException
Override this method to intercept renames

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onRenameEnd

public FtpletResult onRenameEnd(FtpSession session,
                                FtpRequest request)
                         throws FtpException,
                                java.io.IOException
Override this method to handle renames after completion

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException

onSite

public FtpletResult onSite(FtpSession session,
                           FtpRequest request)
                    throws FtpException,
                           java.io.IOException
Override this method to intercept SITE commands

Parameters:
session - The current FtpSession
request - The current FtpRequest
Returns:
The action for the container to take
Throws:
FtpException
java.io.IOException


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.