: Class FTPSession

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.shell.server.ftp
Class FTPSession

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--com.dalsemi.shell.server.Session
                  |
                  +--com.dalsemi.shell.server.ftp.FTPSession

public class FTPSession
extends Session

This class encapsulates all functionality for an FTP session. The FTP server listens to port 21 for connection requests. When someone attempts to start an FTP session, they contact port 21. The server spins off a session (an instance of this class) to handle that session. The session allows you to log into the system, then handles the communication between that remote computer and the TINI system. The FTP server and sessions are designed to be multi-threaded, allowing multiple simultaneous FTP connections. List of FTP return codes: 120 Service ready in nnn minutes 125 Data Connection already opening, transfer starting 150 File Status OK, about to open data connection 200 OK 202 Command not implemented 211 System status, or help reply 212 Directory status 213 File Status 214 Help Message 215 NAME system type 220 Service ready for new user 221 Service closing control connection 225 Data connection open , no transfer in progress 226 Closing data connection 227 Entering passive mode (h1 h2 h3 h4 p1 p2) 230 User logged in proceed 250 Requested file action OK completed 257 PATHNAME created 331 User name OK, need password 332 Need account for login 350 Requested action pending further info 421 Service not available, closing control connection 425 Can't open data connection 426 Connection closed, transfer aborted 450 Req file action not taken 451 Req action aborted - local error 452 Req action not taken (out of memory) 500 Syntax 501 Syntax in parameters or arguments 502 Command not implemented 503 Bad sequence of commands 504 Command not implemented for that parameter 530 Not logged in 532 Need acct for storing files 550 Requested action not taken (file not found, no access, etc.)

Inner classes inherited from class com.dalsemi.shell.server.Session
`Session.Login`

Fields inherited from class com.dalsemi.shell.server.Session
`commandHistory, CURRENT_COMMAND, CURRENT_DIRECTORY, currentCommand, environment, err, in, inCommand, lastCommand, loginStack, myThreadID, out, paramsArray, paramsVector, password, prompt, PROMPT, retArray, server, shutdown, userName, welcomeMessage`

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Method Summary
`protected void` | `currentCommandFinished()` Called after each command is completed.
`protected void` | `exceptionThrown(Exception ex)` Called when an exception is thrown in a command.
`String` | `getNextCommand()` Gets the next command from this session's input stream.
`void` | `login()` Logs the user into the system.
`protected void` | `sessionEnding()` Called to clean up when the session is ending.

Methods inherited from class com.dalsemi.shell.server.Session
`addToHistory, broadcast, endSession, execute, forceEndSession, getEnvironment, getErrStream, getFromEnvironment, getHistoryNumber, getOutputStream, getParams, getUserName, inCommand, parseLogin, printHistory, run, stepDownHistory, stepUpHistory, su, updatePrompt`

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### login

    public void login()
               throws IOException

  Logs the user into the system. This function will prompt the user for username and password.
  Overrides:
    login in class Session

### sessionEnding

    protected void sessionEnding()

  Called to clean up when the session is ending. (i.e. the user typed "exit", or something bad happened that causes the session to terminate.) Closes all of the sockets associated with this session.
  Overrides:
    sessionEnding in class Session

### currentCommandFinished

    protected void currentCommandFinished()

  Called after each command is completed. For example, the user types "ls". The command is received and parsed, then the appropriate command is called in the shell. Finally, we need send the correct result code.
  Overrides:
    currentCommandFinished in class Session

### exceptionThrown

    protected void exceptionThrown(Exception ex)

  Called when an exception is thrown in a command. This function will attempt to notify the user. Any exceptions raised specifically by shell commands should try to give as descriptive a message to the exception as possible.
  Overrides:
    exceptionThrown in class Session
  Parameters:
    `ex` - The exception thrown.

### getNextCommand

    public String getNextCommand()
                          throws IOException

  Gets the next command from this session's input stream. This effectively performs functionality like a readLine(), but gives the stream a chance to parse the incoming data. This allows us to translate FTP commands into system commands.
  Overrides:
    getNextCommand in class Session
  Returns:
    the next command from the input stream

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD