Class RMIController

All Implemented Interfaces:
RMIControllerInterface, Serializable, Remote

public class RMIController extends UnicastRemoteObject implements RMIControllerInterface
Implements intermediate to the Game Controllers, making multiple games management easier
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • identifierExists

      public boolean identifierExists(String identifier)
      Specified by:
      identifierExists in interface RMIControllerInterface
      Parameters:
      identifier - Game's identifier
      Returns:
      whether the identifier exists
    • nicknameExists

      public boolean nicknameExists(String identifier, String nickname)
      Specified by:
      nicknameExists in interface RMIControllerInterface
      Parameters:
      identifier - Game's identifier
      nickname - Player's nickname
      Returns:
      whether the nickname exists in the given Game's identifier
    • createGame

      public boolean createGame(String identifier, ClientStatusInterface csi)
      Creates a game using the corresponding identifier
      Specified by:
      createGame in interface RMIControllerInterface
      Parameters:
      identifier - Game's identifier
      csi - Client Status Interface
      Returns:
      true if the Game have been correctly created
    • acceptPlayer

      public boolean acceptPlayer(String identifier, String nickname, int maxPlayers) throws Exception
      Admission phase
      Specified by:
      acceptPlayer in interface RMIControllerInterface
      Parameters:
      identifier - Game's identifier
      nickname - Player's nickname
      maxPlayers - Maximum number of players for the game used only if the first player is being accepted to the game. It is ignored otherwise.
      Returns:
      true if the admission process have been correctly completed
      Throws:
      Exception - related to Model management
    • reEnterGame

      public boolean reEnterGame(String identifier, String nickname)
      Game's re-enter strategy
      Specified by:
      reEnterGame in interface RMIControllerInterface
      Parameters:
      identifier - Game's identifier
      nickname - Player's nickname
      Returns:
      action validity