|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttriptracker.server.Server
public class Server
Main server class.
| Constructor Summary | |
|---|---|
Server()
Default constructor. |
|
| Method Summary | |
|---|---|
protected void |
addGPSHandler(GPSHandler handler)
Adds a GPS client handler to the main server handler list. |
void |
addListener(ServerListener listener)
Register a listener for server events. |
protected void |
addMapHandler(MapHandler handler)
Adds a map client handler from the main server handler list. |
protected void |
checkMapHandler(GPSHandler gpsHandler)
Checks if any mapHandlers are listening to the route gpsHandler will log |
protected void |
clientListUpdate(ClientHandler client,
boolean joined)
Publish a "socket error" event to all listeners. |
GPSHandler |
getGPSHandler(Route route)
Returns a GPSHandler to listen to. |
List<GPSHandler> |
getGPSHandlers()
|
protected void |
invalidMessage(ClientHandler client,
String message)
Publish an "invalid message" event to all listeners. |
protected void |
log(String source,
String message)
Log a status message to the server log file. |
static void |
main(String[] args)
Main server entry point. |
protected void |
removeGPSHandler(GPSHandler handler)
Removes a GPS client handler from the main server handler list. |
void |
removeListener(ServerListener listener)
Remove listener from listener queue. |
protected void |
removeMapHandler(MapHandler handler)
Removes a map client handler from the main server handler list. |
protected void |
socketErrorEvent(ClientHandler client,
IOException exception)
Publish a "socket error" event to all listeners. |
void |
startServer(int port)
Main method will open the server socket, and go into a loop, where it recieves clients and starts handlers. |
void |
stopServer()
Method being run when server is set for stopping. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Server()
| Method Detail |
|---|
public final void stopServer()
throws IOException
IOException - server dies on IOExceptionpublic static void main(String[] args)
public final void startServer(int port)
throws IOException
port - listening port
IOException - server dies on IOExceptionpublic GPSHandler getGPSHandler(Route route)
protected final void addGPSHandler(GPSHandler handler)
handler - handlerprotected final void removeGPSHandler(GPSHandler handler)
handler - handlerprotected final void checkMapHandler(GPSHandler gpsHandler)
gpsHandler - protected final void addMapHandler(MapHandler handler)
handler - handlerprotected final void removeMapHandler(MapHandler handler)
handler - handlerpublic List<GPSHandler> getGPSHandlers()
public final void addListener(ServerListener listener)
listener - event receiverpublic final void removeListener(ServerListener listener)
listener - event receiver
protected final void socketErrorEvent(ClientHandler client,
IOException exception)
client has been closed and
the client has been removed from any client list it might be a member of.
client - disconnected clientexception - socket IOException thrown by client
protected final void invalidMessage(ClientHandler client,
String message)
client.
Clients are usually not disconnected for sending invalid messages, unless
the amount of invalid messages is significant and the behaviour of the
client appears to be malicious.
client - misbehaving clientmessage - full message
protected final void clientListUpdate(ClientHandler client,
boolean joined)
client has been closed and
the client has been removed from any client list it might be a member of.
client - joined or disconnected clientjoined - true if joined, false if disconnected
protected final void log(String source,
String message)
source - in what context the log message was recordedmessage - status message
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||