org.apache.ftpserver.ftpletcontainer.impl
Class DefaultFtpletContainer

java.lang.Object
  extended by org.apache.ftpserver.ftpletcontainer.impl.DefaultFtpletContainer
All Implemented Interfaces:
Ftplet, FtpletContainer

public class DefaultFtpletContainer
extends java.lang.Object
implements FtpletContainer

Internal class, do not use directly. This ftplet calls other ftplet methods and returns appropriate return value. Internal class, do not use directly.

Version:
$Rev$, $Date$
Author:
The Apache MINA Project (dev@mina.apache.org)

Constructor Summary
DefaultFtpletContainer()
           
DefaultFtpletContainer(java.util.Map<java.lang.String,Ftplet> ftplets)
           
 
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()
          Destroy all ftplets.
 Ftplet getFtplet(java.lang.String name)
          Get Ftplet for the given name.
 java.util.Map<java.lang.String,Ftplet> getFtplets()
          Retrive all Ftplets registered with this container
 void init(FtpletContext ftpletContext)
          Called by the ftplet container to indicate to a ftplet that the ftplet is being placed into service.
 FtpletResult onConnect(FtpSession session)
          Call ftplet onConnect.
 FtpletResult onDisconnect(FtpSession session)
          Call ftplet onDisconnect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFtpletContainer

public DefaultFtpletContainer()

DefaultFtpletContainer

public DefaultFtpletContainer(java.util.Map<java.lang.String,Ftplet> ftplets)
Method Detail

getFtplet

public Ftplet getFtplet(java.lang.String name)
Get Ftplet for the given name.

Specified by:
getFtplet in interface FtpletContainer
Parameters:
name - The name of the Ftplet to retrive
Returns:
The Ftplet if found, or null if the name is unknown to the container.

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

getFtplets

public java.util.Map<java.lang.String,Ftplet> getFtplets()
Description copied from interface: FtpletContainer
Retrive all Ftplets registered with this container

Specified by:
getFtplets in interface FtpletContainer
Returns:
A map of all Ftplets with their name as the key
See Also:
FtpletContainer.getFtplets()

destroy

public void destroy()
Destroy all ftplets.

Specified by:
destroy in interface Ftplet

onConnect

public FtpletResult onConnect(FtpSession session)
                       throws FtpException,
                              java.io.IOException
Call ftplet onConnect.

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
Call ftplet onDisconnect.

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

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

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


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