org.apache.ftpserver
Class BaseFtpConnection

java.lang.Object
  extended by org.apache.ftpserver.BaseFtpConnection
All Implemented Interfaces:
org.apache.avalon.cornerstone.services.connection.ConnectionHandler, StreamConnectorObserver
Direct Known Subclasses:
FtpConnection

public class BaseFtpConnection
extends Object
implements org.apache.avalon.cornerstone.services.connection.ConnectionHandler, StreamConnectorObserver

This is a generic ftp connection handler. It delegates the request to appropriate methods in subclasses.

Author:
Rana Bhattacharyya

Field Summary
protected  boolean mbStopRequest
           
protected  FtpConfig mConfig
           
protected  Socket mControlSocket
           
protected  org.apache.ftpserver.FtpDataConnection mDataConnection
           
protected static Class[] METHOD_INPUT_SIG
           
protected  FtpStatus mFtpStatus
           
protected  FtpConnectionObserver mObserver
           
protected  SpyConnectionInterface mSpy
           
protected  FtpUser mUser
           
protected  FtpWriter mWriter
           
 
Constructor Summary
BaseFtpConnection(FtpConfig ftpConfig)
          Set configuration file and the control socket.
 
Method Summary
 void dataTransferred(int sz)
          This method tracks data transfer.
 FtpConfig getConfig()
          Get config object
 FtpConnectionObserver getObserver()
          Get observer
 SpyConnectionInterface getSpyObject()
          Get connection spy object
 FtpStatus getStatus()
          Get status object
 FtpUser getUser()
          Get user object
 void handleConnection(Socket socket)
          Server one FTP connection.
protected  boolean hasPermission(FtpRequest request)
          Check permission - default implementation - does nothing.
 boolean isClosed()
          Is the connection closed?
 void notifyObserver()
          Notify observer.
 void service(FtpRequest request, FtpWriter writer)
          Execute the ftp command.
 void setObserver(FtpConnectionObserver obsr)
          Set observer
 void setSpyObject(SpyConnectionInterface spy)
          Set spy object
protected  void spyRequest(String str)
          Monitor the user request.
 void stop()
          User logout and stop this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_INPUT_SIG

protected static final Class[] METHOD_INPUT_SIG

mConfig

protected FtpConfig mConfig

mFtpStatus

protected FtpStatus mFtpStatus

mDataConnection

protected org.apache.ftpserver.FtpDataConnection mDataConnection

mUser

protected FtpUser mUser

mSpy

protected SpyConnectionInterface mSpy

mObserver

protected FtpConnectionObserver mObserver

mControlSocket

protected Socket mControlSocket

mWriter

protected FtpWriter mWriter

mbStopRequest

protected boolean mbStopRequest
Constructor Detail

BaseFtpConnection

public BaseFtpConnection(FtpConfig ftpConfig)
Set configuration file and the control socket.

Method Detail

handleConnection

public void handleConnection(Socket socket)
Server one FTP connection.

Specified by:
handleConnection in interface org.apache.avalon.cornerstone.services.connection.ConnectionHandler

service

public void service(FtpRequest request,
                    FtpWriter writer)
             throws IOException
Execute the ftp command.

Throws:
IOException

hasPermission

protected boolean hasPermission(FtpRequest request)
Check permission - default implementation - does nothing.


stop

public void stop()
User logout and stop this thread.


isClosed

public boolean isClosed()
Is the connection closed?


spyRequest

protected void spyRequest(String str)
Monitor the user request.


getUser

public FtpUser getUser()
Get user object


getSpyObject

public SpyConnectionInterface getSpyObject()
Get connection spy object


setSpyObject

public void setSpyObject(SpyConnectionInterface spy)
Set spy object


getObserver

public FtpConnectionObserver getObserver()
Get observer


setObserver

public void setObserver(FtpConnectionObserver obsr)
Set observer


notifyObserver

public void notifyObserver()
Notify observer.


dataTransferred

public void dataTransferred(int sz)
This method tracks data transfer.

Specified by:
dataTransferred in interface StreamConnectorObserver

getConfig

public FtpConfig getConfig()
Get config object


getStatus

public FtpStatus getStatus()
Get status object



Copyright © 2001-2012 Codehaus. All Rights Reserved.