dsnserver
Class Parser

java.lang.Object
  extended by java.lang.Thread
      extended by dsnserver.Parser
All Implemented Interfaces:
java.lang.Runnable

public class Parser
extends java.lang.Thread

The Parser Class is the main classe of the parser classes. The parsers have to initialised here. In the main function we will read the lines from the node and send the lines to the parser it belongs to.

Author:
kaltt

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.util.Map cmdParserPattern
           
(package private)  Communication myComm
           
private static CmdParser parserState
           
(package private)  CmdParser pConinfo
           
(package private)  CmdParser pDSNID
           
(package private)  CmdParser pDSNLocation
           
(package private)  CmdParser pDSNProgInfo
           
(package private)  CmdParser pDSNVersion
           
(package private)  CmdParser pGetAddr
           
(package private)  CmdParser pLoadFile
           
(package private)  CmdParser pLogging
           
(package private)  CmdParser pRPCS
           
(package private)  CmdParser pTargetCommand
           
(package private)  CmdParser pTargetFlash
           
(package private)  CmdParser pTime
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Parser(Communication comm)
           
 
Method Summary
private  void addCmdParser(java.lang.String key, CmdParser value)
          Key is the String we are looking for at the beginning of the line and Value is the name of the Method which has to be used if the key is found at the beginning of the line.
static CmdParser getParserState()
          To get the variable parserState.
private  void init()
          All CmdParser has to be initialized here by using the function addCmdParser(key, value).
static void resetParserState()
          To reset the variable parserState.
 void run()
           
static void setParserState(CmdParser state)
          To set the variable parserState.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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
 

Field Detail

myComm

Communication myComm

pTime

CmdParser pTime

pDSNID

CmdParser pDSNID

pDSNVersion

CmdParser pDSNVersion

pDSNLocation

CmdParser pDSNLocation

pLogging

CmdParser pLogging

pDSNProgInfo

CmdParser pDSNProgInfo

pGetAddr

CmdParser pGetAddr

pTargetCommand

CmdParser pTargetCommand

pLoadFile

CmdParser pLoadFile

pTargetFlash

CmdParser pTargetFlash

pConinfo

CmdParser pConinfo

pRPCS

CmdParser pRPCS

parserState

private static CmdParser parserState

cmdParserPattern

public static java.util.Map cmdParserPattern
Constructor Detail

Parser

public Parser(Communication comm)
Method Detail

init

private void init()
All CmdParser has to be initialized here by using the function addCmdParser(key, value). Key must be the string which we are looking for and Value is the name of the Method which has to be used in this case.


addCmdParser

private void addCmdParser(java.lang.String key,
                          CmdParser value)
Key is the String we are looking for at the beginning of the line and Value is the name of the Method which has to be used if the key is found at the beginning of the line.


resetParserState

public static void resetParserState()
To reset the variable parserState. Is used by the cmdParser to say the Parser that he is not expecting another line.


setParserState

public static void setParserState(CmdParser state)
To set the variable parserState. Is used by the cmdParser to say the Parser that the next line is for the same cmdParser as well.


getParserState

public static CmdParser getParserState()
To get the variable parserState.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread