Class RMIController
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
it.polimi.ingsw.Server.Controller.RMIController
- All Implemented Interfaces:
RMIControllerInterface
,Serializable
,Remote
Implements intermediate to the Game Controllers, making multiple games management easier
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Map<ClientStatusInterface,
GameController> private final Map<String,
GameController> Associates a Game's identifier to its controllerFields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
ConstructorDescriptionRMIController
(Map<String, GameController> identifierToController, Map<ClientStatusInterface, GameController> clientStatusToController) RMI Controller constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptPlayer
(String identifier, String nickname, int maxPlayers) Admission phaseboolean
createGame
(String identifier, ClientStatusInterface csi) Creates a game using the corresponding identifierboolean
identifierExists
(String identifier) boolean
nicknameExists
(String identifier, String nickname) boolean
reEnterGame
(String identifier, String nickname) Game's re-enter strategyMethods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
Field Details
-
identifierToController
Associates a Game's identifier to its controller -
clientStatusToController
-
-
Constructor Details
-
RMIController
public RMIController(Map<String, GameController> identifierToController, Map<ClientStatusInterface, throws RemoteExceptionGameController> clientStatusToController) RMI Controller constructor- Parameters:
identifierToController
- games identifiers mapclientStatusToController
- maps Client Status Interfaces to Game's Controller- Throws:
RemoteException
- related to RMI
-
-
Method Details
-
identifierExists
- Specified by:
identifierExists
in interfaceRMIControllerInterface
- Parameters:
identifier
- Game's identifier- Returns:
- whether the identifier exists
-
nicknameExists
- Specified by:
nicknameExists
in interfaceRMIControllerInterface
- Parameters:
identifier
- Game's identifiernickname
- Player's nickname- Returns:
- whether the nickname exists in the given Game's identifier
-
createGame
Creates a game using the corresponding identifier- Specified by:
createGame
in interfaceRMIControllerInterface
- Parameters:
identifier
- Game's identifiercsi
- Client Status Interface- Returns:
- true if the Game have been correctly created
-
acceptPlayer
Admission phase- Specified by:
acceptPlayer
in interfaceRMIControllerInterface
- Parameters:
identifier
- Game's identifiernickname
- Player's nicknamemaxPlayers
- 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
Game's re-enter strategy- Specified by:
reEnterGame
in interfaceRMIControllerInterface
- Parameters:
identifier
- Game's identifiernickname
- Player's nickname- Returns:
- action validity
-