|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.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 FtpSessionContextname - Name of the attribute.
public void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface FtpSessionContextname - Name of the attribute.value - Value of the attribute.public FtpServerOptions getOptions()
getOptions in interface FtpSessionContextpublic java.lang.String getOption(java.lang.String key)
getOption in interface FtpSessionContextkey - The option name.
public java.lang.String getPassword()
getPassword in interface FtpSessionContextpublic void setPassword(java.lang.String password)
setPassword in interface FtpSessionContextpassword - The users password.public java.lang.String getRemoteDir()
getRemoteDir in interface FtpSessionContextpublic java.lang.String getRemoteRelDir()
getRemoteRelDir in interface FtpSessionContextpublic void setRemoteDir(java.lang.String remoteDir)
setRemoteDir in interface FtpSessionContextremoteDir - The directory to set.public java.lang.String getUser()
getUser in interface FtpSessionContextpublic void setUser(java.lang.String user)
setUser in interface FtpSessionContextuser - The user name.public FtpEventListener getEventListener()
getEventListener in interface FtpSessionContextpublic java.lang.String getRes(java.lang.String id)
getRes in interface FtpSessionContextid - The name of the resource.
public boolean isAuthenticated()
isAuthenticated in interface FtpSessionContextpublic int getDataType()
getDataType in interface FtpSessionContextpublic void setDataType(int dataType)
setDataType in interface FtpSessionContextdataType - The data type.public int getStorageStructure()
getStorageStructure in interface FtpSessionContextpublic void setStorageStructure(int storageStructure)
setStorageStructure in interface FtpSessionContextstorageStructure - The storage structure..public int getTransmissionMode()
getTransmissionMode in interface FtpSessionContextpublic void setTransmissionMode(int transmissionMode)
setTransmissionMode in interface FtpSessionContexttransmissionMode - The transmission mode.public SocketProvider getDataSocketProvider()
getDataSocketProvider in interface FtpSessionContextpublic void setDataSocketProvider(SocketProvider provider)
setDataSocketProvider in interface FtpSessionContextprovider - 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 FtpSessionContextclientSocket - The socket.
java.io.IOException - Thrown if socket is invalid.public java.io.PrintWriter getClientResponseWriter()
getClientResponseWriter in interface FtpSessionContextpublic java.io.BufferedReader getClientCmdReader()
getClientCmdReader in interface FtpSessionContextpublic int getPermission(java.lang.String path)
getPermission in interface FtpSessionContextpath - The path to check the permission on.
public UserManager getUserManager()
getUserManager in interface FtpSessionContextpublic boolean authenticate()
authenticate in interface FtpSessionContextpublic UserData getUserData()
getUserData in interface FtpSessionContextpublic void resetCredentials()
resetCredentials in interface FtpSessionContextpublic void closeSockets()
closeSockets in interface FtpSessionContextpublic java.lang.String getCharset()
getCharset in interface FtpSessionContextpublic java.lang.Integer getNextPassivePort()
getNextPassivePort in interface FtpSessionContextpublic java.util.Date getCreationTime()
getCreationTime in interface FtpSessionContextpublic void setCreationTime(java.util.Date creationTime)
setCreationTime in interface FtpSessionContextcreationTime - The creation time.public java.util.Map<java.lang.String,java.lang.Long> getSessionStatistics()
getSessionStatistics in interface FtpSessionContextpublic int getMaxDownloadRate()
getMaxDownloadRate in interface FtpSessionContextpublic int getMaxUploadRate()
getMaxUploadRate in interface FtpSessionContext
public void updateIncrementalStat(java.lang.String countKey,
long value)
throws FtpQuotaException
updateIncrementalStat in interface FtpSessionContextcountKey - 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 FtpSessionContextavgKey - The name of the statistic.value - The value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||