|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
NetAcctServer
This class provides a multithreaded, network interface to the drink accounting system. The server opens a port either on the default port, or the port specified by the -p option on the command line, if present. As connections to the port are made, new NetAcctServerSession's are spawned to handle the requests. This class is the server portion of NetAcctMgr, which was originally written by Michael J. Douglas. TODO: Better ConfigMgr usage. TODO: Get rid of command line argument processing. TODO: Unify config variable names. TODO: Generic DrinkLoggerSpec stuff, eg NetDrinkLogger, LocalDrinkLogger. TODO: Use configfile stuff. Keep syntax same with BasicDrinkLogger. TODO: Put the hostacl stuff in the configfile. TODO: Check for hostacl file existance at startup.
| Nested Class Summary | |
(package private) class |
NetAcctServer.NetAcctServerSession
Handles processing and IO for individual client sessions. |
| Field Summary | |
private AcctMgrSpec |
acct
The underlying Account Manager implementation that we actually use. |
private ConfigMgr |
config
Where we get our config data from. |
static String |
configFile
The file we read our config data out of. |
static int |
DEFAULT_PORT
The port that the account manager runs on when no "-p port" command line option is specified. |
private ServerSocket |
listen
The socket that the clients connect on. |
private DrinkLoggerSpec |
log
The class to use for logging. |
private int |
port
The port that we are listening on. |
static String |
VERSION_TAG
The version of the software/protocol implementation. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
NetAcctServer(DrinkLoggerSpec inLog,
AcctMgrSpec inAcct,
int inPort)
Instantiates a new NetAcctServer to listen for and handle incoming connections by threading-off the new connections. |
|
| Method Summary | |
private boolean |
authenticate(String user,
String pass,
String host)
|
private boolean |
isHostIPAllowed(String host)
Determines whether or not the specified host is allowed to connect and communicate with the account server. |
static void |
main(String[] args)
Start the server. |
void |
run()
Accepts connects forever and launches new NetAcctServerThread's to handle the incoming connections. |
| 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
public static final String configFile
public static final int DEFAULT_PORT
private AcctMgrSpec acct
private DrinkLoggerSpec log
private int port
private ServerSocket listen
private ConfigMgr config
| Constructor Detail |
public NetAcctServer(DrinkLoggerSpec inLog,
AcctMgrSpec inAcct,
int inPort)
inLog - The DrinkLoggerSpec to write log messages to.inAcct - The underlying AcctMgrSpec to work with.inPort - The port number to listen on.| Method Detail |
public static void main(String[] args)
args - The command line arguments, which are ignored.public void run()
private boolean isHostIPAllowed(String host)
host - The host to verify
private boolean authenticate(String user,
String pass,
String host)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||