|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
ClientServer
This is a drink client designed to run directly on a drink machine alongside of the regular software. This client does not use SundayServer to for communication, it simply accesses everything just by itself. The ClientServer class itself listens for incoming connections and passes them to ClientServerThread, which handles all the processing and IO. The ClientServerThread can be quite large, since there is so much to process.
| Nested Class Summary | |
class |
ClientServer.ClientServerThread
Handles new client connections. |
class |
ClientServer.TelnetPrintWriter
Extends the PrintWriter class to replace the println() method, so that it always prints a CR LF, which is required by the telnet protocol. |
| Field Summary | |
private AcctMgrSpec |
acctMgr
The class we use for performing user authentication and for retreiving that users information. |
private static int |
clientCount
The number of currenlty connected clients. |
private ConfigMgr |
configMgr
Where we get our runtime configuration data from. |
private DrinkMachineSpec |
drink
The DrinkMachineSpec we use for communicating with the hardware with. |
private boolean |
killAfterDrop
Whether or not to kill the connection immediately after a drop. |
private static ServerSocket |
listen
The socket to listen for client connections on. |
private String |
location
A description of the location of the machine. |
private DrinkLoggerSpec |
log
The DrinkLoggerSpec we log all our errors/etc to. |
private int |
maxClients
The maximum number of connected clients. |
private int |
maxDelay
The maximum a user can request that the drop be delayed for. |
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. |
static String |
VERSION_TAG
Specifies the internal version number and the date the client was last updated. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
ClientServer(DrinkMachineSpec _drink,
AcctMgrSpec _acct,
DrinkLoggerSpec _log,
ConfigMgr _config)
This is the constructor for the ClientServer class. |
|
| Method Summary | |
boolean |
addClient()
Keeps track of the number of logged in clients. |
boolean |
removeClient()
Keeps track of the number of clients If clientCount is not zero, then decrement clientCount and return true, otherwise return false. |
void |
run()
This method attempts to accept connections forever, and launches new ClientServerThread's as they come in. |
| 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 |
public static final String VERSION_TAG
private static ServerSocket listen
private static int clientCount
private DrinkMachineSpec drink
private DrinkLoggerSpec log
private AcctMgrSpec acctMgr
private int port
private int maxClients
private int maxDelay
private ConfigMgr configMgr
private String motd
private String location
private boolean killAfterDrop
| Constructor Detail |
public ClientServer(DrinkMachineSpec _drink,
AcctMgrSpec _acct,
DrinkLoggerSpec _log,
ConfigMgr _config)
_drink - The drink machine that we are to interact with._log - The log we are to output our info/errors/etc to._acct - The Account manager ClientServerThread authorizes with._config - The ConfigMgr to use to get config values.| Method Detail |
public void run()
public boolean addClient()
public boolean removeClient()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||