diff --git a/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/GameRequestHandler.java b/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/GameRequestHandler.java index 29d04af34..8bcc61caa 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/GameRequestHandler.java +++ b/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/GameRequestHandler.java @@ -13,8 +13,8 @@ import com.gempukku.lotro.game.LotroServer; import com.gempukku.lotro.game.ParticipantCommunicationVisitor; import com.gempukku.lotro.game.Player; import com.gempukku.lotro.game.state.EventSerializer; +import com.gempukku.lotro.game.state.GameCommunicationChannel; import com.gempukku.lotro.game.state.GameEvent; -import com.gempukku.lotro.game.state.GatheringParticipantCommunicationChannel; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.handler.codec.http.*; import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder; @@ -130,7 +130,7 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri Document doc = documentBuilder.newDocument(); Element update = doc.createElement("update"); - GatheringParticipantCommunicationChannel communicationChannel = _gameMediator.getCommunicationChannel(_resourceOwner, _channelNumber); + GameCommunicationChannel communicationChannel = _gameMediator.getCommunicationChannel(_resourceOwner, _channelNumber); _gameMediator.processVisitor(communicationChannel, _channelNumber, _resourceOwner.getName(), new SerializationVisitor(doc, update)); doc.appendChild(update); diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GatheringParticipantCommunicationChannel.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameCommunicationChannel.java similarity index 97% rename from gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GatheringParticipantCommunicationChannel.java rename to gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameCommunicationChannel.java index e102576bd..71845cf1c 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GatheringParticipantCommunicationChannel.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/state/GameCommunicationChannel.java @@ -10,13 +10,13 @@ import java.util.*; import static com.gempukku.lotro.game.state.GameEvent.Type.*; -public class GatheringParticipantCommunicationChannel implements GameStateListener { +public class GameCommunicationChannel implements GameStateListener { private List _events = new LinkedList(); private String _self; private long _lastConsumed = System.currentTimeMillis(); private int _channelNumber; - public GatheringParticipantCommunicationChannel(String self, int channelNumber) { + public GameCommunicationChannel(String self, int channelNumber) { _self = self; _channelNumber = channelNumber; } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java index 90b303d08..e4bf31958 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/chat/ChatRoomMediator.java @@ -2,7 +2,7 @@ package com.gempukku.lotro.chat; import com.gempukku.lotro.PrivateInformationException; import com.gempukku.lotro.SubscriptionExpiredException; -import com.gempukku.lotro.game.GatheringChatRoomListener; +import com.gempukku.lotro.game.ChatCommunicationChannel; import org.apache.log4j.Logger; import java.util.*; @@ -13,7 +13,7 @@ public class ChatRoomMediator { private Logger _logger; private ChatRoom _chatRoom; - private Map _listeners = new HashMap(); + private Map _listeners = new HashMap(); private int _channelInactivityTimeoutPeriod = 1000 * 20; // 10 seconds private Set _allowedPlayers; @@ -37,7 +37,7 @@ public class ChatRoomMediator { if (!admin && _allowedPlayers != null && !_allowedPlayers.contains(playerId)) throw new PrivateInformationException(); - GatheringChatRoomListener value = new GatheringChatRoomListener(); + ChatCommunicationChannel value = new ChatCommunicationChannel(); _listeners.put(playerId, value); _chatRoom.joinChatRoom(playerId, value); return value.consumeMessages(); @@ -46,10 +46,10 @@ public class ChatRoomMediator { } } - public GatheringChatRoomListener getChatRoomListener(String playerId) throws SubscriptionExpiredException { + public ChatCommunicationChannel getChatRoomListener(String playerId) throws SubscriptionExpiredException { _lock.readLock().lock(); try { - GatheringChatRoomListener gatheringChatRoomListener = _listeners.get(playerId); + ChatCommunicationChannel gatheringChatRoomListener = _listeners.get(playerId); if (gatheringChatRoomListener == null) throw new SubscriptionExpiredException(); return gatheringChatRoomListener; @@ -85,10 +85,10 @@ public class ChatRoomMediator { _lock.writeLock().lock(); try { long currentTime = System.currentTimeMillis(); - Map copy = new HashMap(_listeners); - for (Map.Entry playerListener : copy.entrySet()) { + Map copy = new HashMap(_listeners); + for (Map.Entry playerListener : copy.entrySet()) { String playerId = playerListener.getKey(); - GatheringChatRoomListener listener = playerListener.getValue(); + ChatCommunicationChannel listener = playerListener.getValue(); if (currentTime > listener.getLastAccessed() + _channelInactivityTimeoutPeriod) { _chatRoom.partChatRoom(playerId); _listeners.remove(playerId); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GatheringChatRoomListener.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/ChatCommunicationChannel.java similarity index 93% rename from gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GatheringChatRoomListener.java rename to gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/ChatCommunicationChannel.java index 4c0b21530..c7bf43531 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GatheringChatRoomListener.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/ChatCommunicationChannel.java @@ -6,7 +6,7 @@ import com.gempukku.lotro.chat.ChatRoomListener; import java.util.LinkedList; import java.util.List; -public class GatheringChatRoomListener implements ChatRoomListener { +public class ChatCommunicationChannel implements ChatRoomListener { private List _messages = new LinkedList(); private long _lastConsumed = System.currentTimeMillis(); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameRecorder.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameRecorder.java index 75dbd7de7..b89f9e0cb 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameRecorder.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameRecorder.java @@ -2,8 +2,8 @@ package com.gempukku.lotro.game; import com.gempukku.lotro.common.ApplicationConfiguration; import com.gempukku.lotro.game.state.EventSerializer; +import com.gempukku.lotro.game.state.GameCommunicationChannel; import com.gempukku.lotro.game.state.GameEvent; -import com.gempukku.lotro.game.state.GatheringParticipantCommunicationChannel; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -50,9 +50,9 @@ public class GameRecorder { public GameRecordingInProgress recordGame(LotroGameMediator lotroGame, final String formatName, final String tournament, final Map deckNames) { final Date startData = new Date(); - final Map recordingChannels = new HashMap(); + final Map recordingChannels = new HashMap(); for (String playerId : lotroGame.getPlayersPlaying()) { - GatheringParticipantCommunicationChannel recordChannel = new GatheringParticipantCommunicationChannel(playerId, 0); + GameCommunicationChannel recordChannel = new GameCommunicationChannel(playerId, 0); lotroGame.addGameStateListener(playerId, recordChannel); recordingChannels.put(playerId, recordChannel); } @@ -84,9 +84,9 @@ public class GameRecorder { return new DeflaterOutputStream(new FileOutputStream(recordingFile), deflater); } - private Map saveRecordedChannels(Map gameProgress) { + private Map saveRecordedChannels(Map gameProgress) { Map result = new HashMap(); - for (Map.Entry playerRecordings : gameProgress.entrySet()) { + for (Map.Entry playerRecordings : gameProgress.entrySet()) { String playerId = playerRecordings.getKey(); String gameRecordingId = getRecordingId(playerId); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java index 6d81918ee..67d67e500 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java @@ -6,8 +6,8 @@ import com.gempukku.lotro.SubscriptionExpiredException; import com.gempukku.lotro.common.*; import com.gempukku.lotro.communication.GameStateListener; import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.state.GameCommunicationChannel; import com.gempukku.lotro.game.state.GameEvent; -import com.gempukku.lotro.game.state.GatheringParticipantCommunicationChannel; import com.gempukku.lotro.logic.GameUtils; import com.gempukku.lotro.logic.decisions.AwaitingDecision; import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException; @@ -23,7 +23,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; public class LotroGameMediator { private static final Logger LOG = Logger.getLogger(LotroGameMediator.class); - private Map _communicationChannels = new HashMap(); + private Map _communicationChannels = new HashMap(); private DefaultUserFeedback _userFeedback; private DefaultLotroGame _lotroGame; private Map _playerClocks = new HashMap(); @@ -230,12 +230,12 @@ public class LotroGameMediator { _writeLock.lock(); try { long currentTime = System.currentTimeMillis(); - Map channelsCopy = new HashMap(_communicationChannels); - for (Map.Entry playerChannels : channelsCopy.entrySet()) { + Map channelsCopy = new HashMap(_communicationChannels); + for (Map.Entry playerChannels : channelsCopy.entrySet()) { String playerId = playerChannels.getKey(); // Channel is stale (user no longer connected to game, to save memory, we remove the channel // User can always reconnect and establish a new channel - GatheringParticipantCommunicationChannel channel = playerChannels.getValue(); + GameCommunicationChannel channel = playerChannels.getValue(); if (currentTime > channel.getLastAccessed() + _playerDecisionTimeoutPeriod) { _lotroGame.removeGameStateListener(channel); _communicationChannels.remove(playerId); @@ -296,7 +296,7 @@ public class LotroGameMediator { String playerName = player.getName(); _writeLock.lock(); try { - GatheringParticipantCommunicationChannel communicationChannel = _communicationChannels.get(playerName); + GameCommunicationChannel communicationChannel = _communicationChannels.get(playerName); if (communicationChannel != null) { if (communicationChannel.getChannelNumber() == channelNumber) { AwaitingDecision awaitingDecision = _userFeedback.getAwaitingDecision(playerName); @@ -333,14 +333,14 @@ public class LotroGameMediator { } } - public GatheringParticipantCommunicationChannel getCommunicationChannel(Player player, int channelNumber) throws PrivateInformationException, SubscriptionConflictException, SubscriptionExpiredException { + public GameCommunicationChannel getCommunicationChannel(Player player, int channelNumber) throws PrivateInformationException, SubscriptionConflictException, SubscriptionExpiredException { String playerName = player.getName(); if (!player.getType().contains("a") && !_allowSpectators && !_playersPlaying.contains(playerName)) throw new PrivateInformationException(); _readLock.lock(); try { - GatheringParticipantCommunicationChannel communicationChannel = _communicationChannels.get(playerName); + GameCommunicationChannel communicationChannel = _communicationChannels.get(playerName); if (communicationChannel != null) { if (communicationChannel.getChannelNumber() == channelNumber) { return communicationChannel; @@ -355,7 +355,7 @@ public class LotroGameMediator { } } - public void processVisitor(GatheringParticipantCommunicationChannel communicationChannel, int channelNumber, String playerName, ParticipantCommunicationVisitor visitor) { + public void processVisitor(GameCommunicationChannel communicationChannel, int channelNumber, String playerName, ParticipantCommunicationVisitor visitor) { visitor.visitChannelNumber(channelNumber); for (GameEvent gameEvent : communicationChannel.consumeGameEvents()) visitor.visitGameEvent(gameEvent); @@ -382,7 +382,7 @@ public class LotroGameMediator { int number = _channelNextIndex; _channelNextIndex++; - GatheringParticipantCommunicationChannel participantCommunicationChannel = new GatheringParticipantCommunicationChannel(playerName, number); + GameCommunicationChannel participantCommunicationChannel = new GameCommunicationChannel(playerName, number); _communicationChannels.put(playerName, participantCommunicationChannel); _lotroGame.addGameStateListener(playerName, participantCommunicationChannel);