|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Interface ServerInterface is an interface through which the
client (Tracksail) executes remote calls to the server.
Inherits the Remote interface. Class Server
implements the ServerInterface interface.
Thus, ServerInterface provides the RMI functionality of making
remote calls directly from the client to the server.
The client receives an object that implements ServerInterface
from RMI (returned by the Naming.lookup(...) method). After
this, the client can directly call the ServerInterface methods
of the received object and the calls are transferred to the server which has
implemented the methods in question.
First we call the loginPlayer method, which receives as it's
parameter, among others, a client object that implements the
ClientInterface interface. The object is stored on the server.
The reason behind this is that the server can use it to call the services of
the client directly.
Server,
ClientInterface| Method Summary | |
void |
changeTrack(int game_id,
java.lang.String track_name)
Loads a new track to a race (if it's not in a racing state). |
int |
createGame(int player_id,
java.lang.String game_name)
Creates a new race and places the player in it. |
Game |
getGame(int game_id)
Returns the specified Game object. |
Player |
getPlayer(int player_id)
Returns the specified Player object. |
boolean |
joinGame(int player_id,
int game_id)
Places the player in a race. |
void |
leaveGame(int player_id,
int game_id)
Exits a race. |
int |
loginPlayer(java.lang.String name,
ClientInterface cobj)
Logs the player in to the server. |
void |
logoutPlayer(int player_id)
Logs the player out from the server. |
void |
sayToAll(java.lang.String message)
Sends a chat message to everybody. |
void |
sayToGame(int game_id,
java.lang.String message)
Sends a chat message to the specified race. |
void |
sayToLobby(java.lang.String message)
Sends a chat message to everybody in the lobby room. |
void |
setSail(int player_id,
int sail)
Adjusts a sail. |
void |
startGame(int game_id)
Starts racing in a race. |
void |
turnLeft(int player_id)
Turns a boat portboard. |
void |
turnRight(int player_id)
Turns a boat starboard. |
| Method Detail |
public int loginPlayer(java.lang.String name,
ClientInterface cobj)
throws java.rmi.RemoteException
name - player namecobj - client's player object
java.rmi.RemoteException
public void logoutPlayer(int player_id)
throws java.rmi.RemoteException
player_id - player id
java.rmi.RemoteException
public boolean joinGame(int player_id,
int game_id)
throws java.rmi.RemoteException
player_id - player idgame_id - race id
java.rmi.RemoteException
public int createGame(int player_id,
java.lang.String game_name)
throws java.rmi.RemoteException
player_id - player idgame_name - name of the race to create
java.rmi.RemoteException
public void leaveGame(int player_id,
int game_id)
throws java.rmi.RemoteException
player_id - player idgame_id - race id
java.rmi.RemoteException
public void startGame(int game_id)
throws java.rmi.RemoteException
Only race master calls this.
game_id - race id
java.rmi.RemoteException
public void turnLeft(int player_id)
throws java.rmi.RemoteException
player_id - player id
java.rmi.RemoteException
public void turnRight(int player_id)
throws java.rmi.RemoteException
player_id - player id
java.rmi.RemoteException
public void setSail(int player_id,
int sail)
throws java.rmi.RemoteException
player_id - player idsail - new sail value
java.rmi.RemoteException
public Game getGame(int game_id)
throws java.rmi.RemoteException
Game object.
game_id - race id
Game object.
java.rmi.RemoteException
public Player getPlayer(int player_id)
throws java.rmi.RemoteException
Player object.
player_id - player id
Player object.
java.rmi.RemoteException
public void sayToAll(java.lang.String message)
throws java.rmi.RemoteException
message - chat message
java.rmi.RemoteException
public void sayToLobby(java.lang.String message)
throws java.rmi.RemoteException
message - chat message
java.rmi.RemoteException
public void sayToGame(int game_id,
java.lang.String message)
throws java.rmi.RemoteException
game_id - the race to send the message tomessage - chat message
java.rmi.RemoteException
public void changeTrack(int game_id,
java.lang.String track_name)
throws java.rmi.RemoteException
game_id - race idtrack_name - the name of the track to load
java.rmi.RemoteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||