com.dalsemi.shell.server.telnet
Class TelnetSession

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.dalsemi.shell.server.Session
              |
              +--com.dalsemi.shell.server.telnet.TelnetSession

public class TelnetSession
extends Session

This class encapsulates all functionality for a Telnet session. The Telnet server listens to port 23 for connection requests. When someone attempts to start a Telnet session, they contact port 23. 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 Telnet server and sessions are designed to be multi-threaded, allowing multiple simultaneous Telnet connections.


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.
 void login()
          Logs the user into the system.
protected  void sessionEnding()
          Called to clean up when the session is ending.
 void updatePrompt(String withThis)
          This method was added to speed up prompt printing.
 
Methods inherited from class com.dalsemi.shell.server.Session
addToHistory, broadcast, endSession, execute, forceEndSession, getEnvironment, getErrStream, getFromEnvironment, getHistoryNumber, getNextCommand, getOutputStream, getParams, getUserName, inCommand, parseLogin, printHistory, run, stepDownHistory, stepUpHistory, su
 
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 sockets opened by 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 to again display the system prompt.
Overrides:
currentCommandFinished in class Session

updatePrompt

public void updatePrompt(String withThis)
This method was added to speed up prompt printing. It is called when the prompt needs to change because the user changed directory.
Overrides:
updatePrompt in class Session
Parameters:
withThis - the current directory

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