|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--webtester.packages.distributed.serverHandler
Handles user input, and sends appropriate responses.
Field Summary | |
private boolean |
bConfigLoaded
Indicates whether a config file is loaded. |
private boolean |
bMaster
Indicates if the server is a master or not. |
private static int |
iNodeAssign
A counter used to assign new nodes a number. |
private java.io.DataInputStream |
input
Contain input to the server. |
private int |
iNumTries
Number of allowed tries to read data from client. |
private int |
iSleepTime
Amount of time to sleep when waiting for client to send data. |
private int |
iTextAreaLength
Max number of characters allowed in textarea. |
private java.io.PrintStream |
output
Sends ouput to the client. |
private java.lang.String |
sConfigFile
The config file that was loaded. |
private java.lang.String |
sMessage
Last status message. |
private javax.swing.JTextArea |
text
Text area used to update user. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
serverHandler(java.io.InputStream in,
java.io.OutputStream out)
Constructor that takes input/output streams as arguments. |
Method Summary | |
private java.lang.String |
getConfigFileContents()
Retrieve the contents of the configuration file that is loaded. |
java.lang.String |
getMessage()
Return the last message received. |
private int |
getNodeNumber()
Get a uniqe number to assign to the node. |
private void |
handleNodeUpdates(java.lang.String sCmdStr)
Deal with updates coming from a node to the master server. |
void |
run()
The main entry point into the server handler routines. |
private void |
sendResponse(java.lang.String sResponse)
|
void |
setConfigFile(java.lang.String sStr)
Set the config file that was loaded. |
void |
setConfigLoaded(boolean bVal)
Set the value that indicates if a config file is loaded. |
void |
setMaster(boolean bVal)
Indicates whether the server is a master. |
void |
setTextArea(javax.swing.JTextArea jtext)
Set textarea used to update user. |
private void |
updateTextArea(java.lang.String sText)
Update the text area without erasing all existing data, if possible |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, 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 |
Field Detail |
private java.io.DataInputStream input
private java.io.PrintStream output
private javax.swing.JTextArea text
private final int iNumTries
private final int iSleepTime
private final int iTextAreaLength
private static int iNodeAssign
private boolean bConfigLoaded
private java.lang.String sConfigFile
private java.lang.String sMessage
private boolean bMaster
Constructor Detail |
public serverHandler(java.io.InputStream in, java.io.OutputStream out)
in
- contains input to the serverout
- used to send output to the clientMethod Detail |
public void setMaster(boolean bVal)
bVal
- indicates whether the server is a masterpublic void setTextArea(javax.swing.JTextArea jtext)
jtext
- textarea used to update userpublic void setConfigLoaded(boolean bVal)
bVal
- the boolean value to usepublic void setConfigFile(java.lang.String sStr)
sStr
- the config file that was loadedpublic java.lang.String getMessage()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
private void sendResponse(java.lang.String sResponse)
private int getNodeNumber()
private void updateTextArea(java.lang.String sText)
sText
- the text to add to the text areaprivate java.lang.String getConfigFileContents()
private void handleNodeUpdates(java.lang.String sCmdStr)
sCmdStr
- command input to the server
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |