|
|||||||||||
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 Game |
game
Game associated with this connection thread (will be mirrored to that on the server. |
protected String |
gameID
Current game ID. |
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. |
Game |
getGame()
Return the game object which should be mirrored to that on the server. |
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 delegate to the implementating client. |
void |
send(CommGameMessage message)
Send a ITransmittable object from a client to the server. |
void |
setClientInterface(IClient clientInterface)
Set the client interface. |
void |
setGame(Game game)
Set the game object from the server. |
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, setSocket, 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 String gameID
protected Game game
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 setClientInterface(IClient clientInterface)
clientInterface
- Client interfacepublic void parse(XMLElement message)
parse
in class AbstractConnectionThread
message
- Communication as an XML object.AbstractConnectionThread.parse(nanoxml.XMLElement)
public void send(CommGameMessage message)
message
- public UserList getUserList()
public void setUserList(UserList userList)
userList
- List of userspublic Game getGame()
public void setGame(Game game)
game
- public 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 |