org.apache.ftpserver.impl
Class DefaultFtpSession

java.lang.Object
  extended by org.apache.ftpserver.impl.DefaultFtpSession
All Implemented Interfaces:
FtpSession

public class DefaultFtpSession
extends java.lang.Object
implements FtpSession

Internal class, do not use directly. FTP session

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

Constructor Summary
DefaultFtpSession(FtpIoSession ioSession)
          Default constructor.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Get attribute
 java.net.InetSocketAddress getClientAddress()
          Get remote address
 java.security.cert.Certificate[] getClientCertificates()
          Retrieve the certificates for the client, if running over SSL and with client authentication
 java.util.Date getConnectionTime()
          Get connection time.
 DataConnectionFactory getDataConnection()
          Get FTP data connection.
 DataType getDataType()
          Get the data type.
 int getFailedLogins()
          Get the number of failed logins.
 long getFileOffset()
          Get file offset.
 FileSystemView getFileSystemView()
          Get file system view.
 java.lang.String getLanguage()
          Get language.
 java.util.Date getLastAccessTime()
          Get last access time.
 java.util.Date getLoginTime()
          Get the login time.
 int getMaxIdleTime()
          Returns maximum idle time.
 FtpFile getRenameFrom()
          Get rename from file object.
 java.net.InetSocketAddress getServerAddress()
          Returns the IP address of the server
 java.util.UUID getSessionId()
          Get the unique ID for this session.
 Structure getStructure()
          Get structure.
 User getUser()
          Get user.
 java.lang.String getUserArgument()
          Returns user name entered in USER command
 void increaseReadDataBytes(int increment)
          Increase the number of bytes read on the data connection
 void increaseWrittenDataBytes(int increment)
          Increase the number of bytes written on the data connection
 boolean isLoggedIn()
          Is logged-in
 boolean isSecure()
          Indicates whether the control socket for this session is secure, that is, running over SSL/TLS
 void removeAttribute(java.lang.String name)
          Removes an attribute from this request.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set attribute.
 void setMaxIdleTime(int maxIdleTime)
          Set maximum idle time in seconds.
 void write(FtpReply reply)
          Write a reply to the client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFtpSession

public DefaultFtpSession(FtpIoSession ioSession)
Default constructor.

Method Detail

isLoggedIn

public boolean isLoggedIn()
Is logged-in

Specified by:
isLoggedIn in interface FtpSession
Returns:
true if the user is logged in

getDataConnection

public DataConnectionFactory getDataConnection()
Get FTP data connection.

Specified by:
getDataConnection in interface FtpSession
Returns:
The DataConnectionFactory

getFileSystemView

public FileSystemView getFileSystemView()
Get file system view.

Specified by:
getFileSystemView in interface FtpSession
Returns:
The FileSystemView for this session/user

getConnectionTime

public java.util.Date getConnectionTime()
Get connection time.

Specified by:
getConnectionTime in interface FtpSession
Returns:
Time when the client connected to the server

getLoginTime

public java.util.Date getLoginTime()
Get the login time.

Specified by:
getLoginTime in interface FtpSession
Returns:
Time when the client logged into the server

getLastAccessTime

public java.util.Date getLastAccessTime()
Get last access time.

Specified by:
getLastAccessTime in interface FtpSession
Returns:
The last time the session performed any action

getFileOffset

public long getFileOffset()
Get file offset.

Specified by:
getFileOffset in interface FtpSession
Returns:
The current file transfer offset, or 0 if non is set

getRenameFrom

public FtpFile getRenameFrom()
Get rename from file object.

Specified by:
getRenameFrom in interface FtpSession
Returns:
The current rename from, or null if non is set

getUserArgument

public java.lang.String getUserArgument()
Returns user name entered in USER command

Specified by:
getUserArgument in interface FtpSession
Returns:
user name entered in USER command

getLanguage

public java.lang.String getLanguage()
Get language.

Specified by:
getLanguage in interface FtpSession
Returns:
The language requested by the client

getUser

public User getUser()
Get user.

Specified by:
getUser in interface FtpSession
Returns:
The current User

getClientAddress

public java.net.InetSocketAddress getClientAddress()
Get remote address

Specified by:
getClientAddress in interface FtpSession
Returns:
The client InetAddress

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get attribute

Specified by:
getAttribute in interface FtpSession
Parameters:
name - The attribute name
Returns:
The attribute value, or null if no attribute of the given name exists.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set attribute.

Specified by:
setAttribute in interface FtpSession
Parameters:
name - The attribute name
value - The attribute value

getMaxIdleTime

public int getMaxIdleTime()
Description copied from interface: FtpSession
Returns maximum idle time. This time equals to ConnectionManagerImpl#getDefaultIdleSec() until user login, and User.getMaxIdleTime() after user login.

Specified by:
getMaxIdleTime in interface FtpSession
Returns:
The number of seconds the client is allowed to be idle before disconnected.

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Description copied from interface: FtpSession
Set maximum idle time in seconds. This time equals to ConnectionManagerImpl#getDefaultIdleSec() until user login, and User.getMaxIdleTime() after user login.

Specified by:
setMaxIdleTime in interface FtpSession
Parameters:
maxIdleTime - The number of seconds the client is allowed to be idle before disconnected.

getDataType

public DataType getDataType()
Get the data type.

Specified by:
getDataType in interface FtpSession
Returns:
The current DataType for this session

getStructure

public Structure getStructure()
Get structure.

Specified by:
getStructure in interface FtpSession
Returns:
The current Structure for this session

getClientCertificates

public java.security.cert.Certificate[] getClientCertificates()
Description copied from interface: FtpSession
Retrieve the certificates for the client, if running over SSL and with client authentication

Specified by:
getClientCertificates in interface FtpSession
Returns:
The Certificate chain, or null if the certificates are not avialble

getServerAddress

public java.net.InetSocketAddress getServerAddress()
Description copied from interface: FtpSession
Returns the IP address of the server

Specified by:
getServerAddress in interface FtpSession
Returns:
The server InetAddress

getFailedLogins

public int getFailedLogins()
Description copied from interface: FtpSession
Get the number of failed logins.

Specified by:
getFailedLogins in interface FtpSession
Returns:
The number of failed logins. When login succeeds, this will return 0.

removeAttribute

public void removeAttribute(java.lang.String name)
Description copied from interface: FtpSession
Removes an attribute from this request.

Specified by:
removeAttribute in interface FtpSession
Parameters:
name - The attribute name

write

public void write(FtpReply reply)
           throws FtpException
Description copied from interface: FtpSession
Write a reply to the client

Specified by:
write in interface FtpSession
Parameters:
reply - The reply that will be sent to the client
Throws:
FtpException

isSecure

public boolean isSecure()
Description copied from interface: FtpSession
Indicates whether the control socket for this session is secure, that is, running over SSL/TLS

Specified by:
isSecure in interface FtpSession
Returns:
true if the control socket is secured

increaseWrittenDataBytes

public void increaseWrittenDataBytes(int increment)
Increase the number of bytes written on the data connection

Parameters:
increment - The number of bytes written

increaseReadDataBytes

public void increaseReadDataBytes(int increment)
Increase the number of bytes read on the data connection

Parameters:
increment - The number of bytes written

getSessionId

public java.util.UUID getSessionId()
Get the unique ID for this session. This ID will be maintained for the entire session and is also available to MDC logging using the "session" identifier.

Specified by:
getSessionId in interface FtpSession
Returns:
The unique ID for this session


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