Commit 7dad83a6 authored by Corentin-Boulanger's avatar Corentin-Boulanger
Browse files

Add interfaces, server messages & common datamodel classes

parent b8deb536
package baleine.common.interfaces.client;
import java.util.ArrayList;
import java.util.UUID;
import baleine.common.dataModel.Board;
import baleine.common.dataModel.GameHeavy;
import baleine.common.dataModel.GameLight;
import baleine.common.dataModel.Message;
import baleine.common.dataModel.UserLight;
/**
* This class is an interface which provides client methods to communicate from
* Com to Data modules.
*/
public interface IComToData {
/**
* Send a user profile to the data module.
*
* @param user : the user to forward
*/
public void forwardPlayerProfile(UserLight user);
/**
* Add an authenticated player to local data.
*
* @param user : the user to add
*/
public void addAuthenticatedPlayer(UserLight user);
/**
* Receive the data from a game.
*
* @param user : the list of users of the game
*/
public void receiveGameData(ArrayList<UserLight> user);
/**
* Add a new user to the list.
*
* @param user : the user to add to the list
*/
public void addNewUser(UserLight user);
/**
* Notify the data module that a new game has been created.
*
* @param newGameCreated : the game created
*/
public void notifyNewGame(GameLight newGameCreated);
/**
* Send a saved game to the data module.
*
* @param game : the game saved
* @param userId : the UUID of the user who saves the game
*/
public void sendGameSave(GameHeavy game, UUID userId);
/**
* Receive a chat message.
*
* @param message : the message to receive
*/
public void receiveChatMessage(Message message);
/**
* Notify the data module that a user has been disconnected.
*
* @param user : the UUID of the disconnected user
*/
public void removeDisconnectedUser(UUID user);
/**
* Notify the data module that a new spectator has been added.
*
* @param spectator : the new spectator
*/
public void addSpectatorToGame(UserLight spectator);
/**
* Receive the answer to a game join request.
*
* @param isAccepted : the answer to the join request
* @param gameUUID : the UUID of the game to join
*/
public void receiveJoinRequestAnswer(boolean isAccepted, UUID gameUUID);
/**
* Receive a join request.
*
* @param userProposingUUID : the UUID of the user wanting to join the game
* @param gameUUID : the UUID of the game to join
*/
public void receiveJoinRequest(UUID userProposingUUID, UUID gameUUID);
/**
* Notify that the game is ended.
*
* @param game : the game ended
*/
public void notifyEndGame(GameLight game);
/**
* Notify the data module that the board has been updated.
*
* @param board : the board updated
*/
public void updateBoard(Board board);
/**
* End a game in the data modue.
*
* @param endGameInfo : the game ended
*/
public void endGame(GameLight endGameInfo);
}
package baleine.common.interfaces.client;
import java.net.InetAddress;
import java.util.UUID;
import com.sun.jmx.snmp.Timestamp;
import baleine.common.dataModel.GameLight;
import baleine.common.dataModel.Move;
import baleine.common.dataModel.UserLight;
/**
* This class is an interface which provides client methods to communicate from
* Data to Com modules.
*/
public interface IDataToCom {
/**
* Get a player by its UUID.
*
* @param playerRequested : the UUID of the player requested
*/
public void getPlayerByUUID(UUID playerRequested);
/**
* Notify the server that a user is currently online.
*
* @param user : the user connected
* @param adress : the address of the user
*/
public void connectedUserOnline(UserLight user, InetAddress adress);
/**
* Add a new available game in the list.
*
* @param newGame : the game to add to the list
*/
public void addNewGameAvailable(GameLight newGame);
/**
* Request a save of the current game.
*
* @param gameId : the UUID of the game to save
* @param userId : the UUID of the user wanted to save the game
*/
public void requestGameSave(UUID gameId, UUID userId);
/**
* Send a chat message.
*
* @param message : the message
* @param time : the timestamp when the message was written
*/
public void sendChatMessage(String message, Timestamp time);
/**
* Send a disconnecting request to the server.
*
* @param user : the user to disconnect
*/
public void sendDisconnectingRequest(UUID user);
/**
* Add a spectator to a game.
*
* @param game : the game to be spectated
* @param spectator : the user to add as a spectator
*/
public void addSpectator(GameLight game, UserLight spectator);
/**
* Ask the server to join a game.
*
* @param gameId : the UUID of the game to join
* @param userId : the UUID of the user to add to the game
*/
public void askJoinGame(UUID gameId, UUID userId);
/**
* Send the answer of a request answer.
*
* @param userRequesting : the UUID of the user wanting to join
* @param gameUUID : the UUID of the game to join
* @param isAccepted : the answer of the join request
*/
public void sendJoinRequestAnswer(UUID userRequesting, UUID gameUUID, boolean isAccepted);
/**
* Send a move to the server
*
* @param move : the move to send
*/
public void sendMove(Move move);
}
package baleine.common.interfaces.server;
import java.util.ArrayList;
import java.util.UUID;
import com.sun.jmx.snmp.Timestamp;
import baleine.common.dataModel.GameLight;
import baleine.common.dataModel.Message;
import baleine.common.dataModel.Move;
import baleine.common.dataModel.UserLight;
/**
* This class is an interface which provides server methods to communicate from
* Com to Data modules.
*/
public interface IComToData {
/**
* Request a player by its UUID.
*
* @param playerID : the UUID of the player to retrieve
*/
public void requestPlayerByUUID(UUID playerID);
/**
* Add a new user to the list.
*
* @param userLight : the user to add
*/
public void addNewUser(UserLight userLight);
/**
* Create a new game.
*
* @param gameLight : the game to create
*/
public void createGame(GameLight gameLight);
/**
* Request saving a game by UUID.
*
* @param gameID : the UUID of the game to save
*/
public void requestGameSave(UUID gameID);
/**
* Receive a new chat message to transfer it.
*
* @param message : the message to transfer
* @param timestamp : the timestamp of the message
* @param userID : the UUID of the user sending the message
* @param gameID : the UUID of the game in which the message was sent
* @return the message to transfer
*/
public Message receiveNewChatMessage(String message, Timestamp timestamp, UUID userID, UUID gameID);
/**
* Get all the participants (players & spectators) of a game.
*
* @param gameID : the UUID of the game
* @return the list of users
*/
public ArrayList<UUID> getAllGameParticipants(UUID gameID);
/**
* Notify that a user has been disconnected.
*
* @param userID : the UUID of the disconnected user
*/
public void disconnectUser(UUID userID);
/**
* Add a spectator to a game.
*
* @param gameLight : the game concerned
* @param userLight : the user to add as spectator
*/
public void addSpectator(GameLight gameLight, UserLight userLight);
/**
* Send a move to the data module.
*
* @param move : the move to send
*/
public void sendMove(Move move);
}
package baleine.common.interfaces.server;
import java.util.ArrayList;
import baleine.common.dataModel.Board;
import baleine.common.dataModel.GameLight;
import baleine.common.dataModel.UserLight;
/**
* This class is an interface which provides server methods to communicate from
* Data to Com modules.
*/
public interface IDataToCom {
/**
* Notify that a new game has been created.
*
* @param newGameCreated : the new game created
*/
public void notifyNewGame(GameLight newGameCreated);
/**
* Send a move update message to the different users of a game.
*
* @param players : the players of the game
* @param spectators : the spectators of the game
* @param updateBoard : the board to update
*/
public void sendUpdateMoveMessage(ArrayList<UserLight> players, ArrayList<UserLight> spectators, Board updateBoard);
/**
* Send an end message to the different users of a game.
*
* @param players : the players of the game
* @param spectators : the spectators of the game
* @param updateBoard : the board to update
*/
public void sendEndMoveMessage(ArrayList<UserLight> players, ArrayList<UserLight> spectators, Board updateBoard);
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a new user to add to the user list.
*/
public class AddNewUserToServerMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a chat message to transfer to correct clients.
*/
public class ChatMessageToServerMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a disconnection request to process.
*/
public class DisconnectionRequestMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a game save request.
*/
public class GameSaveRequestMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a player request by UUID.
*/
public class GetPlayerByUUIDMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a join request answer to transfer to the correct client.
*/
public class JoinRequestAnswerMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a move to process.
*/
public class MoveToSendToServerMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a game to add to the list.
*/
public class NewGameToServerMessage {
}
package baleine.server.network.messages.clientToServer;
/**
* Message containing a spectator to add to a game.
*/
public class SpectatorToAddServerMessage {
}
package baleine.server.network.messages.serverToClient;
/**
* Message containing a chat message to transfer to a client.
*/
public class ChatMessageToClientMessage {
}
package baleine.server.network.messages.serverToClient;
/**
* Message notifying clients that a user has been disconnected.
*/
public class DisconnectedUserMessage {
}
package baleine.server.network.messages.serverToClient;
/**
* Message notifying clients that the game has ended.
*/
public class EndGameSignalToClientMessage {
}
package baleine.server.network.messages.serverToClient;
/**
* Message containing a game save.
*/
public class GameSaveMessage {
}
package baleine.server.network.messages.serverToClient;
/**
* Message containing a game join request to transfer to the correct client.
*/
public class JoinRequestMessage {
}
package baleine.server.network.messages.serverToClient;
/**
* Message containing a move to forward to concerned clients.
*/
public class MoveToForwardToClientMessage {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment