|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
net.bluebones.boggle.Server
public class Server
Controls the network side of the application from the host/server side.
Field Summary |
---|
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Constructor Summary | |
---|---|
Server(Player player,
Client host,
HostInfo hostInfo)
Initialises a Server with the specified client as the host. |
Method Summary | |
---|---|
void |
addClient(String clientAddr,
String clientName)
Adds a client to this server. |
void |
checkResultsSend()
Periodic check that sends results out to all clients if appropriate. |
NamedClient[] |
getClients()
Gets the clients currently attached to this Server. |
GameId |
getGameId()
Gets the GameId of the game currently running on this
server. |
boolean |
isClient(IClient client)
Determines whether the specified client is a client of this Server. |
static void |
main(String[] args)
A simple commandline test of Server. |
void |
removeClients(Collection clients)
Removes all the clients in clients from the list of clients
of this server. |
void |
returnResults(Turn turn)
To be called by a client. |
void |
sendResults(Round round)
Notifiy all registered clients of the results of a game. |
void |
setRubber()
Sends up to date rubber information to all clients. |
void |
startGame()
Initialises a game and notifies all registered clients to start. |
void |
writeMsg(String s)
Writes the specified message to stdout. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Server(Player player, Client host, HostInfo hostInfo) throws RemoteException, IllegalArgumentException
player
- Player this Server belongs to.host
- Client that is hosting this game.hostInfo
- IP and port information to set up
on.
RemoteException
- If anything goes wrong with the RMI.
IllegalArgumentException
- IfMethod Detail |
---|
public void writeMsg(String s)
writeMsg
in interface IServer
s
- Message to write.public void addClient(String clientAddr, String clientName) throws ConnectException, RemoteException
addClient
in interface IServer
clientAddr
- RMI address on which the client can be
invoked.clientName
- Name of the player at
clientAddr
.
ConnectException
- If the client cannot be added for some
reason.
RemoteException
- If there is any problem with the RMI.public void startGame()
public void returnResults(Turn turn) throws RemoteException
returnResults
in interface IServer
turn
- Turn information.
RemoteException
- If anything goes wrong with the RMI.public void checkResultsSend()
public void sendResults(Round round)
round
- Results of the round.public void setRubber()
public NamedClient[] getClients()
public boolean isClient(IClient client) throws RemoteException
isClient
in interface IServer
client
- IClient to check for.
RemoteException
- If anything goes wrong with the RMI.public void removeClients(Collection clients)
clients
from the list of clients
of this server. Clients in the collection will no longer receive updates
from this server without re-registering. Update the rubber details to
reflect the removal.
clients
- Collection
of clients to remove.public GameId getGameId()
GameId
of the game currently running on this
server.
GameId
of current game.public static void main(String[] args) throws RemoteException, UnknownHostException
args
- Commandline arguments.
RemoteException
- If anything goes wrong with the RMI.
UnknownHostException
- If can't detect local IP.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |