Interface ClientInterface

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
Tracksail

public interface ClientInterface
extends java.rmi.Remote

Interface ClientInterface is an interface through which the server executes remote calls to the client.

Inherits the Remote interface. Class Tracksail implements the ClientInterface interface. Thus, ClientInterface provides the RMI functionality of making remote calls directly from the server to the client.

The server receives an object that implements ClientInterface as a remote call from the client. The client first gets a remote object of the server from RMI and then first calls the loginPlayer method, which delivers client's own remote object to the server.

Version:
1.0
Author:
Stefan Brockmann, Tero Kuusela
See Also:
Tracksail, ServerInterface

Method Summary
 void gameStateChange(boolean racing)
          Gives a player the race state when it changes (racing/paused).
 void kick(java.lang.String message)
          Kicks a player out.
 void sendText(java.lang.String str)
          Sends a text message to the client.
 void updateGameList(GameInfo[] ri)
          Gives the client an updated race list.
 void updateTrackList(java.lang.String[] tracks)
          Gives the client an updated track list.
 

Method Detail

sendText

public void sendText(java.lang.String str)
              throws java.rmi.RemoteException
Sends a text message to the client.

Parameters:
str - the message to send
Throws:
java.rmi.RemoteException

kick

public void kick(java.lang.String message)
          throws java.rmi.RemoteException
Kicks a player out.

Parameters:
message - an informational message to print on the console
Throws:
java.rmi.RemoteException

updateGameList

public void updateGameList(GameInfo[] ri)
                    throws java.rmi.RemoteException
Gives the client an updated race list.

This is called for all players if a new race is created or an existing race is closed. This is also always called for a player when (s)he signs in to the server.

Parameters:
ri - the race list to give
Throws:
java.rmi.RemoteException

updateTrackList

public void updateTrackList(java.lang.String[] tracks)
                     throws java.rmi.RemoteException
Gives the client an updated track list.

This is called for all players always when the track list changes. This is also always called for a player when (s)he signs in to the server.

Parameters:
tracks - the track list to give
Throws:
java.rmi.RemoteException

gameStateChange

public void gameStateChange(boolean racing)
                     throws java.rmi.RemoteException
Gives a player the race state when it changes (racing/paused).

The server calls this e.g. when a race begins or ends. Game Master can e.g. disable the "start" button when a race begins/ends.

Parameters:
racing - true if the race begun, false if it ended
Throws:
java.rmi.RemoteException