/** * Copyright 2010 The University of Nottingham * * This file is part of lobbyservice. * * lobbyservice is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * lobbyservice is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with lobbyservice. If not, see <http://www.gnu.org/licenses/>. * */ package uk.ac.horizon.ug.lobby.server; import java.io.IOException; import javax.persistence.EntityManager; import uk.ac.horizon.ug.lobby.model.Account; import uk.ac.horizon.ug.lobby.model.GameClient; import uk.ac.horizon.ug.lobby.model.GameInstance; import uk.ac.horizon.ug.lobby.model.GameInstanceFactory; import uk.ac.horizon.ug.lobby.model.GameInstanceSlot; import uk.ac.horizon.ug.lobby.model.GameServer; import uk.ac.horizon.ug.lobby.protocol.GameJoinRequest; import uk.ac.horizon.ug.lobby.protocol.GameJoinResponse; /** generic server control interface (plug-in). * * @author cmg * */ public interface ServerProtocol { /** handle an authenticated "PLAY" request from a client */ public void handlePlayRequest(GameJoinRequest gjreq, GameJoinResponse gjresp, GameInstance gi, GameInstanceSlot gs, GameServer server, GameClient gc, Account account); /** check that factory/server are valid for this protocol */ public void validate(GameInstanceFactory factory, GameServer server) throws ConfigurationException; /** game instance maintenance task - called from GameInstanceTasks.checkGameInstance */ public void handleGameInstancePreparingFromPlanned(GameInstance gi, GameInstanceFactory factory, GameServer server) throws ConfigurationException, IOException; /** game instance maintenance task - called from GameInstanceTasks.checkGameInstance */ public void handleGameInstanceReadyFromPreparing(GameInstance gi, GameInstanceFactory factory, GameServer server) throws ConfigurationException, IOException; /** game instance maintenance task - called from GameInstanceTasks.checkGameInstance */ public void handleGameInstanceActiveFromReady(GameInstance gi, GameInstanceFactory factory, GameServer server) throws ConfigurationException, IOException; /** game instance maintenance task - called from GameInstanceTasks.checkGameInstance */ public void handleGameInstanceEndingFromActive(GameInstance gi, GameInstanceFactory factory, GameServer server) throws ConfigurationException, IOException; /** game instance maintenance task - called from GameInstanceTasks.checkGameInstance */ public void handleGameInstanceEnd(GameInstance gi, GameInstanceFactory factory, GameServer server) throws ConfigurationException, IOException; }