|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.hermesftp.session.impl.FtpSessionContextImpl
public class FtpSessionContextImpl
This class servers as a means of transportation for data shared by a single FTP session.
Instances of the FtpSessionContextImpl
class are passed to each of the commands
while executing a FTP command sequence. The command objects read connection settings and other
options from the context. In turn data that may concern the general state of the FTP session can
be stored in the context.
Field Summary |
---|
Constructor Summary | |
---|---|
FtpSessionContextImpl(FtpServerOptions options,
UserManager userManager,
java.util.ResourceBundle resourceBundle,
FtpEventListener listener)
Constructor. |
Method Summary | |
---|---|
boolean |
authenticate()
|
void |
closeSockets()
Closes all sockets involved in current session. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns a sesson attribute. |
java.lang.String |
getCharset()
Returns the charset to be used for text output. |
java.io.BufferedReader |
getClientCmdReader()
Returns the Reader that is used to read client commands. |
java.io.PrintWriter |
getClientResponseWriter()
Returns the writer that is used to respond to client requests. |
java.net.Socket |
getClientSocket()
Returns the client communication socket. |
java.util.Date |
getCreationTime()
Date/time the session context was created. |
SocketProvider |
getDataSocketProvider()
Returns the object that provides the socket that is used for file transfer. |
int |
getDataType()
Returns the current data type (ASCII, BINARY, EPBCDIC). |
FtpEventListener |
getEventListener()
Returns the instance that listens to session events. |
int |
getMaxDownloadRate()
Returns the maximum transfer rate (download stream) in KB/s. |
int |
getMaxUploadRate()
Returns the maximum transfer rate (upload stream) in KB/s. |
java.lang.Integer |
getNextPassivePort()
Returns the next available port from a user defined list of passive ports. |
java.lang.String |
getOption(java.lang.String key)
Returns the value of an server option. |
FtpServerOptions |
getOptions()
|
java.lang.String |
getPassword()
Gets the user's password. |
int |
getPermission(java.lang.String path)
Gets the user's permission on the passed path. |
java.lang.String |
getRemoteDir()
Gets the current remote directory. |
java.lang.String |
getRemoteRelDir()
Gets the relative path, with respect to the FTP root path. |
java.lang.String |
getRes(java.lang.String id)
Returns a named resource from a resource bundle. |
java.util.Map<java.lang.String,java.lang.Long> |
getSessionStatistics()
Returns the session statistics. |
int |
getStorageStructure()
Returns the storage structure (File, Record). |
int |
getTransmissionMode()
Returns the transmission mode (Stream, Block, Compressed). |
java.lang.String |
getUser()
Returns the login name of the user. |
UserData |
getUserData()
Returns data about the current user. |
UserManager |
getUserManager()
Returns the user manager. |
boolean |
isAuthenticated()
Checks whether user was successfully authenticated. |
void |
resetCredentials()
Resets the user's credentials and unflags the authentication. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets a session attribute. |
void |
setClientSocket(java.net.Socket clientSocket)
Sets the client communication socket. |
void |
setCreationTime(java.util.Date creationTime)
Date/time the session context was created. |
void |
setDataSocketProvider(SocketProvider provider)
Sets the provider that provides the socket that is used in file transfer. |
void |
setDataType(int dataType)
Sets the current data type. |
void |
setPassword(java.lang.String password)
Sets the user's password. |
void |
setRemoteDir(java.lang.String remoteDir)
Sets the remote directory of the user's session. |
void |
setStorageStructure(int storageStructure)
Sets the storage structure (File, Record). |
void |
setTransmissionMode(int transmissionMode)
Sets the transmission mode (Stream, Block, Compressed). |
void |
setUser(java.lang.String user)
Sets the login name of the user. |
void |
updateAverageStat(java.lang.String avgKey,
int value)
Updates the upload or download transfer rate taking the passed value into account. |
void |
updateIncrementalStat(java.lang.String countKey,
long value)
Increases a particular resource consumption by the passed value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FtpSessionContextImpl(FtpServerOptions options, UserManager userManager, java.util.ResourceBundle resourceBundle, FtpEventListener listener)
options
- The server options.userManager
- The user manager.resourceBundle
- The resource bundle that containts messages and texts.listener
- The listener that is informed on session events.Method Detail |
---|
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface FtpSessionContext
name
- Name of the attribute.
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface FtpSessionContext
name
- Name of the attribute.value
- Value of the attribute.public FtpServerOptions getOptions()
getOptions
in interface FtpSessionContext
public java.lang.String getOption(java.lang.String key)
getOption
in interface FtpSessionContext
key
- The option name.
public java.lang.String getPassword()
getPassword
in interface FtpSessionContext
public void setPassword(java.lang.String password)
setPassword
in interface FtpSessionContext
password
- The users password.public java.lang.String getRemoteDir()
getRemoteDir
in interface FtpSessionContext
public java.lang.String getRemoteRelDir()
getRemoteRelDir
in interface FtpSessionContext
public void setRemoteDir(java.lang.String remoteDir)
setRemoteDir
in interface FtpSessionContext
remoteDir
- The directory to set.public java.lang.String getUser()
getUser
in interface FtpSessionContext
public void setUser(java.lang.String user)
setUser
in interface FtpSessionContext
user
- The user name.public FtpEventListener getEventListener()
getEventListener
in interface FtpSessionContext
public java.lang.String getRes(java.lang.String id)
getRes
in interface FtpSessionContext
id
- The name of the resource.
public boolean isAuthenticated()
isAuthenticated
in interface FtpSessionContext
public int getDataType()
getDataType
in interface FtpSessionContext
public void setDataType(int dataType)
setDataType
in interface FtpSessionContext
dataType
- The data type.public int getStorageStructure()
getStorageStructure
in interface FtpSessionContext
public void setStorageStructure(int storageStructure)
setStorageStructure
in interface FtpSessionContext
storageStructure
- The storage structure..public int getTransmissionMode()
getTransmissionMode
in interface FtpSessionContext
public void setTransmissionMode(int transmissionMode)
setTransmissionMode
in interface FtpSessionContext
transmissionMode
- The transmission mode.public SocketProvider getDataSocketProvider()
getDataSocketProvider
in interface FtpSessionContext
public void setDataSocketProvider(SocketProvider provider)
setDataSocketProvider
in interface FtpSessionContext
provider
- The socket provider.public java.net.Socket getClientSocket()
getClientSocket
in interface FtpSessionContext
public void setClientSocket(java.net.Socket clientSocket) throws java.io.IOException
setClientSocket
in interface FtpSessionContext
clientSocket
- The socket.
java.io.IOException
- Thrown if socket is invalid.public java.io.PrintWriter getClientResponseWriter()
getClientResponseWriter
in interface FtpSessionContext
public java.io.BufferedReader getClientCmdReader()
getClientCmdReader
in interface FtpSessionContext
public int getPermission(java.lang.String path)
getPermission
in interface FtpSessionContext
path
- The path to check the permission on.
public UserManager getUserManager()
getUserManager
in interface FtpSessionContext
public boolean authenticate()
authenticate
in interface FtpSessionContext
public UserData getUserData()
getUserData
in interface FtpSessionContext
public void resetCredentials()
resetCredentials
in interface FtpSessionContext
public void closeSockets()
closeSockets
in interface FtpSessionContext
public java.lang.String getCharset()
getCharset
in interface FtpSessionContext
public java.lang.Integer getNextPassivePort()
getNextPassivePort
in interface FtpSessionContext
public java.util.Date getCreationTime()
getCreationTime
in interface FtpSessionContext
public void setCreationTime(java.util.Date creationTime)
setCreationTime
in interface FtpSessionContext
creationTime
- The creation time.public java.util.Map<java.lang.String,java.lang.Long> getSessionStatistics()
getSessionStatistics
in interface FtpSessionContext
public int getMaxDownloadRate()
getMaxDownloadRate
in interface FtpSessionContext
public int getMaxUploadRate()
getMaxUploadRate
in interface FtpSessionContext
public void updateIncrementalStat(java.lang.String countKey, long value) throws FtpQuotaException
updateIncrementalStat
in interface FtpSessionContext
countKey
- The name of the statistic.value
- The value
FtpQuotaException
- Thrown if a resource limit has been reached.public void updateAverageStat(java.lang.String avgKey, int value)
updateAverageStat
in interface FtpSessionContext
avgKey
- The name of the statistic.value
- The value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |