|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.jogre.common.AbstractConnectionThread org.jogre.client.ClientConnectionThread
Client connection which is spawned from the client machine and receives/ sends communication to/from the server. This class also holds a mirrored copy of the TableList and UserList objects which are stored on the JogreServer.
The communication between this connection thread and the GUI (e.g. an implementation of the JogreClientFrame) must goes through an interface IClient to ensure maximum abstraction.
Field Summary | |
protected IClient |
clientInterface
Interface betweem this thread and the Frame |
protected String |
gameID
Current game ID. |
protected TableList |
tableList
TableList object which should mirror that on the JogreServer. |
protected UserList |
userList
UserList object which should mirror that on the JogreServer. |
Fields inherited from class org.jogre.common.AbstractConnectionThread |
connected, in, loop, out, socket, username |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ClientConnectionThread(Socket connection,
String username,
IClient clientInterface)
Default constructor which takes a Socket connection to the server, a username and an IClient which sits between this class and the GUI. |
Method Summary | |
void |
cleanup()
Client has exitted so clean everything up. |
protected void |
disconnect()
Stop the thread. |
TableList |
getTableList()
Return the table list object (should be the same as the server table list). |
UserList |
getUserList()
Return the user list (should be the same as the server user list object). |
void |
parse(XMLElement message)
Parse method which reads the first token of the message and calls the appropriate method. |
void |
send(CommBaseMessage message)
Send a ITransmittable object from a client to the server. |
void |
send(CommGameMessage message)
Send a ITransmittable object from a client to the server. |
void |
setGameID(String gameID)
Method for setting the game ID so that the user doesn't need to specify this ever time he creates a comm game message. |
void |
setTableList(TableList tableList)
Update the table list. |
void |
setUserList(UserList userList)
Update the user list. |
Methods inherited from class org.jogre.common.AbstractConnectionThread |
connect, getSocket, getUsername, run, send, setUsername, stopLoop |
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 |
protected IClient clientInterface
protected UserList userList
protected TableList tableList
protected String gameID
Constructor Detail |
public ClientConnectionThread(Socket connection, String username, IClient clientInterface)
connection
- Socket connection to server.username
- UsernameclientInterface
- Interface between this class and GUI.Method Detail |
public void parse(XMLElement message)
parse
in class AbstractConnectionThread
message
- Communication as an XML object.AbstractConnectionThread.parse(nanoxml.XMLElement)
public void send(CommBaseMessage message)
message
- public void send(CommGameMessage message)
message
- public void setGameID(String gameID)
gameID
- public UserList getUserList()
public void setUserList(UserList userList)
userList
- List of userspublic TableList getTableList()
public void setTableList(TableList tableList)
tableList
- TableList object containing Table objects.protected void disconnect()
public void cleanup()
cleanup
in class AbstractConnectionThread
AbstractConnectionThread.cleanup()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |