com.dalsemi.shell.server.serial
Class SerialSession

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.dalsemi.shell.server.Session
              |
              +--com.dalsemi.shell.server.serial.SerialSession

public class SerialSession
extends Session

This class encapsulates all functionality for a Serial session. The Serial server listens to the serial port connection requests. When someone attempts to start a Serial session, 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 the user and the TINI system.


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 the underlying session's input stream.
 void login()
          Logs the user into the system.
protected  void sessionEnding()
          Cleans 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, 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()
Cleans up when the session is ending. (i.e. the user typed "exit", or something bad happened that caused the session to terminate.) Also resumes the Serial server so new connections will be accepted.
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.

getNextCommand

public String getNextCommand()
                      throws IOException
Gets the next command from the underlying session's input stream. This effectively performs functionality like a readLine(), but gives the stream a chance to parse the incoming data (to take care of backspace events, etc.)
Overrides:
getNextCommand in class Session
Returns:
the next command from the input stream