|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
FingerServer
Implements a finger-protocol server to provide information about drink
through finger.
In it's current state, this class supports 5 finger targets:
'@drink' - provides the temperature readouts and a slot listing
'temp@drink' - lists the temperatures of the cabinet and power supply.
'user@drink' - provide the balance, user admin status of the user.
'slotname@drink' - lists the information for a single slot. Similar to @drink
'info@drink' - provides a quick help reference.
| Field Summary | |
private AcctMgrSpec |
acctMgr
The account manager we get user data from. |
private ConfigMgr |
configMgr
The ConfigMgr that we get our runtime configuration data from. |
private DrinkMachineSpec |
drink
The Drink machine we are to use for hardware access. |
private ServerSocket |
listen
The ServerSocket that listens for connections from new clients. |
private String |
location
A description of the location of the machine. |
private DrinkLoggerSpec |
log
Where we send our log messages for info/errors/etc. |
private String |
motd
The message of the day to display to users. |
private int |
port
The port number we are to listen on for connections. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
FingerServer(DrinkMachineSpec _drink,
AcctMgrSpec _acct,
DrinkLoggerSpec _log,
ConfigMgr _config)
Constructs the FingerServer. |
|
| Method Summary | |
private int |
naturalInt(String num)
Tests to see if the given string is a non-zero number. |
private void |
printInfo(PrintWriter out)
Prints a quick guide to the targets that the finger server provides. |
private void |
printStat(PrintWriter out)
Prints the can statistics. |
private void |
printTemp(PrintWriter out)
Prints the temperature statistics. |
private void |
printUser(PrintWriter out,
String user)
Prints the information for a single user. |
void |
run()
Executed when a new connection comes in. |
private String |
slotStat(int slotIndex)
Prints the stats for a single slot. |
| 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 int port
private ServerSocket listen
private DrinkMachineSpec drink
private AcctMgrSpec acctMgr
private DrinkLoggerSpec log
private ConfigMgr configMgr
private String motd
private String location
| Constructor Detail |
public FingerServer(DrinkMachineSpec _drink,
AcctMgrSpec _acct,
DrinkLoggerSpec _log,
ConfigMgr _config)
_drink - The DrinkMachineSpec to interact with_acct - The AcctMgrSpec to interact with._log - The DrinkLoggerSpec to log messages to._config - The ConfigMgr class to use.| Method Detail |
private String slotStat(int slotIndex)
slotIndex - The index of the slot to print.private void printInfo(PrintWriter out)
out - The PrintWriter to do the printing to.private void printStat(PrintWriter out)
out - The PrintWriter to print the stats to.
private void printUser(PrintWriter out,
String user)
out - The PrintWriter to print to.user - The user to print stats on.private void printTemp(PrintWriter out)
out - the PrintWriter to print the stats to.public void run()
private int naturalInt(String num)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||