diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index fcab6bd6f1d..4f39cf3f92c 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -46,8 +46,6 @@ import mage.client.constants.Constants.DeckEditorMode; import mage.client.deckeditor.collection.viewer.CollectionViewerPane; import mage.client.dialog.*; import mage.client.plugins.impl.Plugins; -import mage.interfaces.callback.ClientCallback; -import mage.remote.Session; import mage.client.util.EDTExceptionHandler; import mage.client.util.gui.ArrowBuilder; import mage.components.ImagePanel; @@ -73,37 +71,29 @@ import java.util.List; import java.util.prefs.Preferences; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; -import mage.client.chat.ChatPanel; import mage.client.components.MageUI; import mage.client.deckeditor.DeckEditorPane; import mage.client.draft.DraftPane; -import mage.client.draft.DraftPanel; import mage.client.game.GamePane; -import mage.client.game.GamePanel; -import mage.client.remote.CallbackClientImpl; +import mage.client.remote.Session; import mage.client.table.TablesPane; import mage.client.tournament.TournamentPane; -import mage.client.tournament.TournamentPanel; -import mage.constants.Constants.SessionState; import mage.game.match.MatchOptions; -import mage.interfaces.Client; -import mage.interfaces.callback.CallbackClient; import mage.utils.MageVersion; import mage.sets.Sets; -import mage.remote.Connection; -import mage.remote.Connection.ProxyType; +import mage.utils.Connection; +import mage.utils.Connection.ProxyType; import mage.view.TableView; import org.apache.log4j.Logger; /** * @author BetaSteward_at_googlemail.com */ -public class MageFrame extends javax.swing.JFrame implements Client { +public class MageFrame extends javax.swing.JFrame { private final static Logger logger = Logger.getLogger(MageFrame.class); private static Session session; - private static CallbackClient callbackClient; private ConnectDialog connectDialog; private static Preferences prefs = Preferences.userNodeForPackage(MageFrame.class); private JLabel title; @@ -112,10 +102,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { private UUID clientId; private static MagePane activeFrame; - private static Map chats = new HashMap(); - private static Map games = new HashMap(); - private static Map drafts = new HashMap(); - private static Map tournaments = new HashMap(); private static MageUI ui = new MageUI(); /** @@ -133,7 +119,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { return prefs; } - @Override public MageVersion getVersion() { return version; } @@ -171,7 +156,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { this.setExtendedState(JFrame.MAXIMIZED_BOTH); session = new Session(this); - callbackClient = new CallbackClientImpl(this); connectDialog = new ConnectDialog(); desktopPane.add(connectDialog, JLayeredPane.POPUP_LAYER); ui.addComponent(MageComponents.DESKTOP_PANE, desktopPane); @@ -753,9 +737,9 @@ public class MageFrame extends javax.swing.JFrame implements Client { }//GEN-LAST:event_btnExitActionPerformed private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed - if (session.getState() == SessionState.CONNECTED) { + if (session.isConnected()) { if (JOptionPane.showConfirmDialog(this, "Are you sure you want to disconnect?", "Confirm disconnect", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { - session.disconnect(false); + session.disconnect(); showMessage("You have disconnected"); } } else { @@ -770,7 +754,7 @@ public class MageFrame extends javax.swing.JFrame implements Client { }//GEN-LAST:event_btnAboutActionPerformed public void exitApp() { - session.disconnect(false); + session.disconnect(); Plugins.getInstance().shutdown(); dispose(); System.exit(0); @@ -889,40 +873,10 @@ public class MageFrame extends javax.swing.JFrame implements Client { return ui; } - public static ChatPanel getChat(UUID chatId) { - return chats.get(chatId); - } - - public static void addChat(UUID chatId, ChatPanel chatPanel) { - chats.put(chatId, chatPanel); - } - - public static GamePanel getGame(UUID gameId) { - return games.get(gameId); - } - - public static void addGame(UUID gameId, GamePanel gamePanel) { - games.put(gameId, gamePanel); - } - - public static DraftPanel getDraft(UUID draftId) { - return drafts.get(draftId); - } - - public static void addDraft(UUID draftId, DraftPanel draftPanel) { - drafts.put(draftId, draftPanel); - } - - public static void addTournament(UUID tournamentId, TournamentPanel tournament) { - tournaments.put(tournamentId, tournament); - } - - @Override public UUID getId() { return clientId; } - @Override public void connected(final String message) { if (SwingUtilities.isEventDispatchThread()) { setStatusText(message); @@ -939,7 +893,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { } } - @Override public void disconnected() { if (SwingUtilities.isEventDispatchThread()) { setStatusText("Not connected"); @@ -960,7 +913,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { } } - @Override public void showMessage(final String message) { if (SwingUtilities.isEventDispatchThread()) { JOptionPane.showMessageDialog(desktopPane, message); @@ -975,7 +927,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { } } - @Override public void showError(final String message) { if (SwingUtilities.isEventDispatchThread()) { JOptionPane.showMessageDialog(desktopPane, message, "Error", JOptionPane.ERROR_MESSAGE); @@ -990,11 +941,6 @@ public class MageFrame extends javax.swing.JFrame implements Client { } } - @Override - public void processCallback(ClientCallback callback) { - callbackClient.processCallback(callback); - } - } class MagePaneMenuItem extends JCheckBoxMenuItem { diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index 96b2e2fdb0d..c54e1058959 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -80,7 +80,7 @@ import mage.cards.MagePermanent; import mage.cards.TextPopup; import mage.client.MageFrame; import mage.client.game.PlayAreaPanel; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.Config; import mage.client.util.DefaultActionCallback; import mage.client.util.ImageHelper; @@ -382,13 +382,13 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis List targets = card.getTargets(); if (targets != null) { for (UUID uuid : targets) { - PlayAreaPanel p = MageFrame.getGame(gameId).getPlayers().get(uuid); + PlayAreaPanel p = MageFrame.getSession().getGame(gameId).getPlayers().get(uuid); if (p != null) { Point target = p.getLocationOnScreen(); Point me = this.getLocationOnScreen(); ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red); } else { - for (PlayAreaPanel pa : MageFrame.getGame(gameId).getPlayers().values()) { + for (PlayAreaPanel pa : MageFrame.getSession().getGame(gameId).getPlayers().values()) { MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid); if (permanent != null) { Point target = permanent.getLocationOnScreen(); diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java index a2beed58220..bb4fec70866 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java @@ -40,7 +40,7 @@ import java.util.*; import java.util.List; import mage.client.MageFrame; import mage.client.components.ColorPane; -import mage.remote.Session; +import mage.client.remote.Session; import mage.view.ChatMessage.MessageColor; import javax.swing.border.EmptyBorder; @@ -130,9 +130,7 @@ public class ChatPanel extends javax.swing.JPanel { public void connect(UUID chatId) { session = MageFrame.getSession(); this.chatId = chatId; - if (session.joinChat(chatId)) { - MageFrame.addChat(chatId, this); - } + session.joinChat(chatId, this); } public void disconnect() { diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index 98287f80b40..a56c37f4131 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -50,8 +50,8 @@ import javax.swing.SwingWorker; import mage.client.MageFrame; import mage.client.util.Config; -import mage.remote.Connection; -import mage.remote.Connection.ProxyType; +import mage.utils.Connection; +import mage.utils.Connection.ProxyType; import org.apache.log4j.Logger; diff --git a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java index 9837fbd4d26..fb227155009 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java @@ -38,7 +38,7 @@ package mage.client.dialog; import mage.client.*; import java.util.UUID; import javax.swing.JOptionPane; -import mage.remote.Session; +import mage.client.remote.Session; import mage.sets.Sets; import org.apache.log4j.Logger; diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index 4ecc346a460..020c308b2f9 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -46,7 +46,7 @@ import javax.swing.SpinnerNumberModel; import mage.Constants.MultiplayerAttackOption; import mage.Constants.RangeOfInfluence; import mage.client.components.MageComponents; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.table.TablePlayerPanel; import mage.client.util.Event; import mage.client.util.Listener; diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form index 9e184839662..033e6fe3923 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form @@ -72,12 +72,12 @@ - + - - + + diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index fa9e930424b..80d138a4300 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -45,7 +45,7 @@ import mage.Constants.MultiplayerAttackOption; import mage.Constants.RangeOfInfluence; import mage.cards.ExpansionSet; import mage.client.MageFrame; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.table.TournamentPlayerPanel; import mage.game.draft.DraftOptions; import mage.game.draft.DraftOptions.TimingOption; @@ -260,12 +260,12 @@ public class NewTournamentDialog extends MageDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlPacks, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE) + .addComponent(pnlPacks, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(spnNumPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 22, Short.MAX_VALUE) - .addComponent(jLabel2) - .addComponent(pnlDraftOptions, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(spnNumPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) + .addComponent(pnlDraftOptions, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) diff --git a/Mage.Client/src/main/java/mage/client/dialog/ReconnectDialog.form b/Mage.Client/src/main/java/mage/client/dialog/ReconnectDialog.form deleted file mode 100644 index 22a1c40aacb..00000000000 --- a/Mage.Client/src/main/java/mage/client/dialog/ReconnectDialog.form +++ /dev/null @@ -1,56 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/Mage.Client/src/main/java/mage/client/dialog/ReconnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ReconnectDialog.java deleted file mode 100644 index 5ae9d3522da..00000000000 --- a/Mage.Client/src/main/java/mage/client/dialog/ReconnectDialog.java +++ /dev/null @@ -1,167 +0,0 @@ -/* -* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - -/* - * ReconnectDialog.java - * - * Created on 20-May-2011, 2:39:21 PM - */ -package mage.client.dialog; - -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.SwingWorker; -import mage.remote.Session; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class ReconnectDialog extends MageDialog { - - private static final int MAX_ATTEMPTS = 3; - private boolean result = false; - private boolean cancel = false; - private ReconnectTask reconnectTask; - - /** Creates new form ReconnectDialog */ - public ReconnectDialog() { - initComponents(); - } - - public void showDialog(Session session) { - result = false; - cancel = false; - reconnectTask = new ReconnectTask(session, this); - reconnectTask.execute(); - this.setModal(true); - this.setLocation(100, 100); - this.setVisible(true); - } - - public void closeDialog() { - if (reconnectTask != null) reconnectTask.cancel(true); - this.setVisible(false); - } - - public void update(String message) { - this.jLabel1.setText(message); - } - - public boolean getResult() { - return result; - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jLabel1 = new javax.swing.JLabel(); - btnCancel = new javax.swing.JButton(); - - btnCancel.setText("Cancel"); - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnCancel, javax.swing.GroupLayout.Alignment.TRAILING)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnCancel) - .addContainerGap()) - ); - - pack(); - }// //GEN-END:initComponents - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed - this.cancel = true; - closeDialog(); - }//GEN-LAST:event_btnCancelActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnCancel; - private javax.swing.JLabel jLabel1; - // End of variables declaration//GEN-END:variables - - class ReconnectTask extends SwingWorker { - - private Session session; - private ReconnectDialog dialog; - - ReconnectTask(Session session, ReconnectDialog dialog) { - this.session = session; - this.dialog = dialog; - } - - @Override - protected Void doInBackground() throws Exception { - int numAttempts = 0; - while (numAttempts < MAX_ATTEMPTS && !cancel) { - numAttempts++; - this.publish("Attempting to reconnect: attempt " + numAttempts + "of " + MAX_ATTEMPTS); - Thread.sleep(2000); - if (session.connect()) { - result = true; - closeDialog(); - break; - } - } - return null; - } - - @Override - protected void process(List view) { - dialog.update(view.get(0)); - } - - } -} - diff --git a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.form b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.form index d0387c56548..6c0783f2204 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.form @@ -40,7 +40,7 @@ - + diff --git a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java index 2e9a084e31f..7a473d4e577 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java @@ -42,7 +42,7 @@ import java.util.concurrent.ExecutionException; import javax.swing.SwingWorker; import javax.swing.table.AbstractTableModel; import mage.client.components.MageComponents; -import mage.remote.Session; +import mage.client.remote.Session; import mage.view.SeatView; import mage.view.TableView; import org.apache.log4j.Logger; diff --git a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java index ee4351dc6a6..2525de73f8e 100644 --- a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java +++ b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java @@ -41,7 +41,7 @@ import java.util.UUID; import javax.swing.Timer; import mage.client.MageFrame; import mage.client.constants.Constants.SortBy; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.Event; import mage.client.util.Listener; import mage.view.DraftPickView; @@ -81,7 +81,7 @@ public class DraftPanel extends javax.swing.JPanel { public synchronized void showDraft(UUID draftId) { this.draftId = draftId; session = MageFrame.getSession(); - MageFrame.addDraft(draftId, this); + session.addDraft(draftId, this); if (!session.joinDraft(draftId)) hideDraft(); } diff --git a/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java b/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java index b521cb0c92d..b9d027a6eec 100644 --- a/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java +++ b/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java @@ -38,7 +38,7 @@ import javax.swing.JPopupMenu; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import mage.client.MageFrame; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.gui.GuiDisplayUtil; import mage.view.AbilityPickerView; diff --git a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java index f41ca697842..627249e69dd 100644 --- a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java @@ -46,7 +46,7 @@ import javax.swing.*; import mage.client.MageFrame; import mage.client.components.MageTextArea; import mage.client.components.arcane.GlowText; -import mage.remote.Session; +import mage.client.remote.Session; import org.apache.log4j.Logger; diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index c7864044c26..7dddf7cf652 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -58,7 +58,7 @@ import mage.client.dialog.PickNumberDialog; import mage.client.dialog.ShowCardsDialog; import mage.client.game.FeedbackPanel.FeedbackMode; import mage.client.plugins.impl.Plugins; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.Config; import mage.client.util.GameManager; import mage.client.util.PhaseManager; @@ -161,7 +161,7 @@ public class GamePanel extends javax.swing.JPanel { this.gameId = gameId; this.playerId = playerId; session = MageFrame.getSession(); - MageFrame.addGame(gameId, this); + session.addGame(gameId, this); this.feedbackPanel.init(gameId); this.feedbackPanel.clear(); this.abilityPicker.init(session, gameId); @@ -178,7 +178,7 @@ public class GamePanel extends javax.swing.JPanel { this.gameId = gameId; this.playerId = null; session = MageFrame.getSession(); - MageFrame.addGame(gameId, this); + session.addGame(gameId, this); this.feedbackPanel.init(gameId); this.feedbackPanel.clear(); this.btnConcede.setVisible(false); @@ -194,7 +194,7 @@ public class GamePanel extends javax.swing.JPanel { this.gameId = gameId; this.playerId = null; session = MageFrame.getSession(); - MageFrame.addGame(gameId, this); + session.addGame(gameId, this); this.feedbackPanel.clear(); this.btnConcede.setVisible(false); this.btnStopWatching.setVisible(false); diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanel.form b/Mage.Client/src/main/java/mage/client/game/PlayerPanel.form index a1141f257f8..92c0c74d182 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanel.form +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanel.form @@ -1,4 +1,4 @@ - +
diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanel.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanel.java index 5b0be1560a9..eef67591d1d 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanel.java @@ -39,7 +39,7 @@ import java.util.UUID; import mage.client.MageFrame; import mage.client.cards.BigCard; import mage.client.dialog.ShowCardsDialog; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.Config; import mage.view.PlayerView; diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java index 1f04aa03104..3db87b15540 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -40,7 +40,7 @@ import mage.client.components.HoverButton; import mage.client.components.MageRoundPane; import mage.client.components.arcane.ManaSymbols; import mage.client.dialog.ShowCardsDialog; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.Command; import mage.client.util.Config; import mage.client.util.ImageHelper; diff --git a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java index 9a7798856ef..100bd8c1fb9 100644 --- a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java @@ -18,7 +18,7 @@ import mage.client.cards.BigCard; import mage.client.components.MageComponents; import mage.client.game.PlayAreaPanel; import mage.client.plugins.impl.Plugins; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.DefaultActionCallback; import mage.client.util.ImageHelper; import mage.client.util.gui.ArrowBuilder; @@ -82,13 +82,13 @@ public class MageActionCallback implements ActionCallback { for (UUID uuid : targets) { //System.out.println("Getting play area panel for uuid: " + uuid); - PlayAreaPanel p = MageFrame.getGame(data.gameId).getPlayers().get(uuid); + PlayAreaPanel p = session.getGame(data.gameId).getPlayers().get(uuid); if (p != null) { Point target = p.getLocationOnScreen(); target.translate(-parentPoint.x, -parentPoint.y); ArrowBuilder.addArrow((int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 40, (int) target.getY() - 40, Color.red); } else { - for (PlayAreaPanel pa : MageFrame.getGame(data.gameId).getPlayers().values()) { + for (PlayAreaPanel pa : session.getGame(data.gameId).getPlayers().values()) { MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid); if (permanent != null) { Point target = permanent.getLocationOnScreen(); @@ -105,7 +105,7 @@ public class MageActionCallback implements ActionCallback { Point me = new Point(data.locationOnScreen); me.translate(-parentPoint.x, -parentPoint.y); UUID uuid = data.card.getParentId(); - for (PlayAreaPanel pa : MageFrame.getGame(data.gameId).getPlayers().values()) { + for (PlayAreaPanel pa : session.getGame(data.gameId).getPlayers().values()) { MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid); if (permanent != null) { Point source = permanent.getLocationOnScreen(); diff --git a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java b/Mage.Client/src/main/java/mage/client/remote/Client.java similarity index 85% rename from Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java rename to Mage.Client/src/main/java/mage/client/remote/Client.java index 5c2ec948877..9831f67a3c6 100644 --- a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java +++ b/Mage.Client/src/main/java/mage/client/remote/Client.java @@ -28,7 +28,9 @@ package mage.client.remote; +import java.rmi.RemoteException; import java.util.UUID; +import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import mage.cards.decks.Deck; import mage.client.MageFrame; @@ -38,10 +40,8 @@ import mage.client.draft.DraftPanel; import mage.client.game.GamePanel; import mage.client.plugins.impl.Plugins; import mage.client.util.GameManager; -import mage.client.util.object.SaveObjectUtil; import mage.interfaces.callback.CallbackClient; import mage.interfaces.callback.ClientCallback; -import mage.utils.CompressUtil; import mage.view.AbilityPickerView; import mage.view.ChatMessage; import mage.view.DraftClientMessage; @@ -55,26 +55,26 @@ import org.apache.log4j.Logger; * * @author BetaSteward_at_googlemail.com */ -public class CallbackClientImpl implements CallbackClient { +public class Client implements CallbackClient { - private final static Logger logger = Logger.getLogger(CallbackClientImpl.class); + private final static Logger logger = Logger.getLogger(Client.class); private UUID clientId; private MageFrame frame; + private Session session; private int messageId = 0; - public CallbackClientImpl(MageFrame frame) { + public Client(Session session, MageFrame frame) { this.clientId = UUID.randomUUID(); this.frame = frame; + this.session = session; } @Override public synchronized void processCallback(final ClientCallback callback) { logger.info(callback.getMessageId() + " - " + callback.getMethod()); - SaveObjectUtil.saveObject(callback.getData(), callback.getMethod()); - callback.setData(CompressUtil.decompress(callback.getData())); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -101,7 +101,7 @@ public class CallbackClientImpl implements CallbackClient { } else if (callback.getMethod().equals("chatMessage")) { ChatMessage message = (ChatMessage) callback.getData(); - ChatPanel panel = frame.getChat(callback.getObjectId()); + ChatPanel panel = session.getChat(callback.getObjectId()); if (panel != null) { if (message.isUserMessage() && panel.getConnectedChat() != null) { panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), ChatMessage.MessageColor.BLACK); @@ -111,31 +111,31 @@ public class CallbackClientImpl implements CallbackClient { } } else if (callback.getMethod().equals("replayInit")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.init((GameView) callback.getData()); } else if (callback.getMethod().equals("replayDone")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) { panel.modalMessage((String) callback.getData()); panel.hideGame(); } } else if (callback.getMethod().equals("replayUpdate")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.updateGame((GameView) callback.getData()); } else if (callback.getMethod().equals("gameInit")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) { panel.init((GameView) callback.getData()); - + session.ack("gameInit"); } } else if (callback.getMethod().equals("gameOver")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) { panel.modalMessage((String) callback.getData()); panel.hideGame(); @@ -143,53 +143,53 @@ public class CallbackClientImpl implements CallbackClient { } else if (callback.getMethod().equals("gameAsk")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.ask(message.getMessage(), message.getGameView()); } else if (callback.getMethod().equals("gameTarget")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.pickTarget(message.getMessage(), message.getCardsView(), message.getGameView(), message.getTargets(), message.isFlag(), message.getOptions()); } else if (callback.getMethod().equals("gameSelect")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.select(message.getMessage(), message.getGameView()); } else if (callback.getMethod().equals("gameChooseAbility")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.pickAbility((AbilityPickerView) callback.getData()); } else if (callback.getMethod().equals("gameChoose")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.getChoice(message.getMessage(), message.getStrings()); } else if (callback.getMethod().equals("gamePlayMana")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.playMana(message.getMessage(), message.getGameView()); } else if (callback.getMethod().equals("gamePlayXMana")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.playXMana(message.getMessage(), message.getGameView()); } else if (callback.getMethod().equals("gameSelectAmount")) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.getAmount(message.getMin(), message.getMax(), message.getMessage()); } else if (callback.getMethod().equals("gameUpdate")) { - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.updateGame((GameView) callback.getData()); } @@ -197,7 +197,7 @@ public class CallbackClientImpl implements CallbackClient { if (callback.getMessageId() > messageId) { GameClientMessage message = (GameClientMessage) callback.getData(); - GamePanel panel = frame.getGame(callback.getObjectId()); + GamePanel panel = session.getGame(callback.getObjectId()); if (panel != null) panel.inform(message.getMessage(), message.getGameView()); } @@ -214,18 +214,18 @@ public class CallbackClientImpl implements CallbackClient { construct(message.getDeck(), message.getTableId(), message.getTime()); } else if (callback.getMethod().equals("draftOver")) { - DraftPanel panel = frame.getDraft(callback.getObjectId()); + DraftPanel panel = session.getDraft(callback.getObjectId()); if (panel != null) panel.hideDraft(); } else if (callback.getMethod().equals("draftPick")) { DraftClientMessage message = (DraftClientMessage) callback.getData(); - DraftPanel panel = frame.getDraft(callback.getObjectId()); + DraftPanel panel = session.getDraft(callback.getObjectId()); if (panel != null) panel.loadBooster(message.getDraftPickView()); } else if (callback.getMethod().equals("draftUpdate")) { - DraftPanel panel = frame.getDraft(callback.getObjectId()); + DraftPanel panel = session.getDraft(callback.getObjectId()); if (panel != null) panel.updateDraft((DraftView) callback.getData()); } @@ -238,10 +238,10 @@ public class CallbackClientImpl implements CallbackClient { } } else if (callback.getMethod().equals("draftInit")) { - + session.ack("draftInit"); } else if (callback.getMethod().equals("tournamentInit")) { - + session.ack("tournamentInit"); } messageId = callback.getMessageId(); } @@ -252,7 +252,7 @@ public class CallbackClientImpl implements CallbackClient { }); } - public UUID getId() { + public UUID getId() throws RemoteException { return clientId; } @@ -320,7 +320,9 @@ public class CallbackClientImpl implements CallbackClient { private void handleException(Exception ex) { logger.fatal("Client error\n", ex); - frame.showError("Error: " + ex.getMessage()); + JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Unrecoverable client error. Disconnecting", "Error", JOptionPane.ERROR_MESSAGE); + session.disconnect(); + frame.disableButtons(); } } diff --git a/Mage.Common/src/mage/remote/MageRemoteException.java b/Mage.Client/src/main/java/mage/client/remote/MageRemoteException.java similarity index 98% rename from Mage.Common/src/mage/remote/MageRemoteException.java rename to Mage.Client/src/main/java/mage/client/remote/MageRemoteException.java index 4f775473e08..006252fd760 100644 --- a/Mage.Common/src/mage/remote/MageRemoteException.java +++ b/Mage.Client/src/main/java/mage/client/remote/MageRemoteException.java @@ -26,7 +26,7 @@ * or implied, of BetaSteward_at_googlemail.com. */ -package mage.remote; +package mage.client.remote; /** * diff --git a/Mage.Client/src/main/java/mage/client/remote/Session.java b/Mage.Client/src/main/java/mage/client/remote/Session.java new file mode 100644 index 00000000000..5b31df94733 --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/remote/Session.java @@ -0,0 +1,821 @@ +/* +* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. +*/ + +package mage.client.remote; + +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.rmi.NotBoundException; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import javax.swing.JOptionPane; +import mage.cards.decks.DeckCardLists; +import mage.client.MageFrame; +import mage.client.chat.ChatPanel; +import mage.client.components.MageUI; +import mage.client.draft.DraftPanel; +import mage.client.game.GamePanel; +import mage.client.tournament.TournamentPanel; +import mage.client.util.Config; +import mage.game.GameException; +import mage.MageException; +import mage.game.match.MatchOptions; +import mage.game.tournament.TournamentOptions; +import mage.interfaces.Server; +import mage.interfaces.ServerState; +import mage.interfaces.callback.CallbackClientDaemon; +import mage.utils.Connection; +import mage.view.DraftPickView; +import mage.view.GameTypeView; +import mage.view.TableView; +import mage.view.TournamentTypeView; +import mage.view.TournamentView; +import org.apache.log4j.Logger; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class Session { + + private final static Logger logger = Logger.getLogger(Session.class); + private static ScheduledExecutorService sessionExecutor = Executors.newScheduledThreadPool(1); + + private UUID sessionId; + private Server server; + private Client client; + private String userName; + private MageFrame frame; + private ServerState serverState; + private Map chats = new HashMap(); + private Map games = new HashMap(); + private Map drafts = new HashMap(); + private Map tournaments = new HashMap(); + private CallbackClientDaemon callbackDaemon; + private ScheduledFuture future; + private MageUI ui = new MageUI(); + + public Session(MageFrame frame) { + this.frame = frame; + } + + public boolean connect(Connection connection) { + if (isConnected()) { + disconnect(); + } + try { + System.setSecurityManager(null); + System.setProperty("http.nonProxyHosts", "code.google.com"); + System.setProperty("socksNonProxyHosts", "code.google.com"); + + // clear previous values + System.clearProperty("socksProxyHost"); + System.clearProperty("socksProxyPort"); + System.clearProperty("http.proxyHost"); + System.clearProperty("http.proxyPort"); + + switch (connection.getProxyType()) { + case SOCKS: + System.setProperty("socksProxyHost", connection.getProxyHost()); + System.setProperty("socksProxyPort", Integer.toString(connection.getProxyPort())); + break; + case HTTP: + System.setProperty("http.proxyHost", connection.getProxyHost()); + System.setProperty("http.proxyPort", Integer.toString(connection.getProxyPort())); + Authenticator.setDefault(new MageAuthenticator(connection.getProxyUsername(), connection.getProxyPassword())); + break; + } + Registry reg = LocateRegistry.getRegistry(connection.getHost(), connection.getPort()); + this.server = (Server) reg.lookup(Config.remoteServer); + this.userName = connection.getUsername(); + if (client == null) + client = new Client(this, frame); + sessionId = server.registerClient(userName, client.getId(), frame.getVersion()); + callbackDaemon = new CallbackClientDaemon(sessionId, client, server); + serverState = server.getServerState(); + future = sessionExecutor.scheduleWithFixedDelay(new ServerPinger(), 5, 5, TimeUnit.SECONDS); + logger.info("Connected to RMI server at " + connection.getHost() + ":" + connection.getPort()); + frame.setStatusText("Connected to " + connection.getHost() + ":" + connection.getPort() + " "); + frame.enableButtons(); + return true; + } catch (MageException ex) { + logger.fatal("", ex); + disconnect(); + JOptionPane.showMessageDialog(frame, "Unable to connect to server. " + ex.getMessage()); + } catch (RemoteException ex) { + logger.fatal("Unable to connect to server - ", ex); + disconnect(); + JOptionPane.showMessageDialog(frame, "Unable to connect to server. " + ex.getMessage()); + } catch (NotBoundException ex) { + logger.fatal("Unable to connect to server - ", ex); + } + return false; + } + + public void disconnect() { + + if (isConnected()) { + try { + for (UUID chatId: chats.keySet()) { + server.leaveChat(chatId, sessionId); + } + } + catch (Exception ex) { + //swallow all exceptions at this point + } + try { + //TODO: stop daemon + if (server != null) + server.deregisterClient(sessionId); + } catch (RemoteException ex) { + logger.fatal("Error disconnecting ...", ex); + } catch (MageException ex) { + logger.fatal("Error disconnecting ...", ex); + } + removeServer(); + } + } + + private void removeServer() { + if (future != null && !future.isDone()) + future.cancel(true); + server = null; + frame.hideGames(); + frame.hideTables(); + frame.setStatusText("Not connected"); + frame.disableButtons(); + logger.info("Disconnected ... "); + JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Disconnected.", "Disconnected", JOptionPane.INFORMATION_MESSAGE); + } + + public void ack(String message) { + try { + server.ack(message, sessionId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + } + + public boolean ping() { + try { + return server.ping(sessionId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean isConnected() { + return server != null; + } + + public String[] getPlayerTypes() { + return serverState.getPlayerTypes(); + } + + public List getGameTypes() { + return serverState.getGameTypes(); + } + + public String[] getDeckTypes() { + return serverState.getDeckTypes(); + } + + public List getTournamentTypes() { + return serverState.getTournamentTypes(); + } + + public boolean isTestMode() { + if (serverState != null) + return serverState.isTestMode(); + return false; + } + + public ChatPanel getChat(UUID chatId) { + return chats.get(chatId); + } + + public GamePanel getGame(UUID gameId) { + return games.get(gameId); + } + + public void addGame(UUID gameId, GamePanel gamePanel) { + games.put(gameId, gamePanel); + } + + public DraftPanel getDraft(UUID draftId) { + return drafts.get(draftId); + } + + public void addDraft(UUID draftId, DraftPanel draftPanel) { + drafts.put(draftId, draftPanel); + } + + public void addTournament(UUID tournamentId, TournamentPanel tournament) { + tournaments.put(tournamentId, tournament); + } + + public UUID getMainRoomId() { + try { + return server.getMainRoomId(); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public UUID getRoomChatId(UUID roomId) { + try { + return server.getRoomChatId(roomId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public UUID getTableChatId(UUID tableId) { + try { + return server.getTableChatId(tableId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public UUID getGameChatId(UUID gameId) { + try { + return server.getGameChatId(gameId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public TableView getTable(UUID roomId, UUID tableId) { + try { + return server.getTable(roomId, tableId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public boolean watchTable(UUID roomId, UUID tableId) { + try { + server.watchTable(sessionId, roomId, tableId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList) { + try { + return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (GameException ex) { + handleGameException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill) { + try { + return server.joinTournamentTable(sessionId, roomId, tableId, playerName, playerType, skill); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (GameException ex) { + handleGameException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public Collection getTables(UUID roomId) throws MageRemoteException { + try { + return server.getTables(roomId); + } catch (RemoteException ex) { + handleRemoteException(ex); + throw new MageRemoteException(); + } catch (MageException ex) { + handleMageException(ex); + throw new MageRemoteException(); + } + } + + public Collection getConnectedPlayers(UUID roomId) throws MageRemoteException { + try { + return server.getConnectedPlayers(roomId); + } catch (RemoteException ex) { + handleRemoteException(ex); + throw new MageRemoteException(); + } catch (MageException ex) { + handleMageException(ex); + throw new MageRemoteException(); + } + } + + public TournamentView getTournament(UUID tournamentId) throws MageRemoteException { + try { + return server.getTournament(tournamentId); + } catch (RemoteException ex) { + handleRemoteException(ex); + throw new MageRemoteException(); + } catch (MageException ex) { + handleMageException(ex); + throw new MageRemoteException(); + } + } + + public UUID getTournamentChatId(UUID tournamentId) { + try { + return server.getTournamentChatId(tournamentId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public boolean sendPlayerUUID(UUID gameId, UUID data) { + try { + server.sendPlayerUUID(gameId, sessionId, data); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean sendPlayerBoolean(UUID gameId, boolean data) { + try { + server.sendPlayerBoolean(gameId, sessionId, data); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean sendPlayerInteger(UUID gameId, int data) { + try { + server.sendPlayerInteger(gameId, sessionId, data); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean sendPlayerString(UUID gameId, String data) { + try { + server.sendPlayerString(gameId, sessionId, data); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public DraftPickView sendCardPick(UUID draftId, UUID cardId) { + try { + return server.sendCardPick(draftId, sessionId, cardId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public boolean joinChat(UUID chatId, ChatPanel chat) { + try { + server.joinChat(chatId, sessionId, userName); + chats.put(chatId, chat); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean leaveChat(UUID chatId) { + try { + server.leaveChat(chatId, sessionId); + chats.remove(chatId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean sendChatMessage(UUID chatId, String message) { + try { + server.sendChatMessage(chatId, userName, message); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean joinGame(UUID gameId) { + try { + server.joinGame(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean joinDraft(UUID draftId) { + try { + server.joinDraft(draftId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean joinTournament(UUID tournamentId) { + try { + server.joinTournament(tournamentId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean watchGame(UUID gameId) { + try { + server.watchGame(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean replayGame(UUID gameId) { + try { + server.replayGame(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public TableView createTable(UUID roomId, MatchOptions matchOptions) { + try { + return server.createTable(sessionId, roomId, matchOptions); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public TableView createTournamentTable(UUID roomId, TournamentOptions tournamentOptions) { + try { + return server.createTournamentTable(sessionId, roomId, tournamentOptions); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return null; + } + + public boolean isTableOwner(UUID roomId, UUID tableId) { + try { + return server.isTableOwner(sessionId, roomId, tableId); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean removeTable(UUID roomId, UUID tableId) { + try { + server.removeTable(sessionId, roomId, tableId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean swapSeats(UUID roomId, UUID tableId, int seatNum1, int seatNum2) { + try { + server.swapSeats(sessionId, roomId, tableId, seatNum1, seatNum2); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean leaveTable(UUID roomId, UUID tableId) { + try { + server.leaveTable(sessionId, roomId, tableId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean startGame(UUID roomId, UUID tableId) { + try { + server.startMatch(sessionId, roomId, tableId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean startTournament(UUID roomId, UUID tableId) { + try { + server.startTournament(sessionId, roomId, tableId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean startChallenge(UUID roomId, UUID tableId, UUID challengeId) { + try { + server.startChallenge(sessionId, roomId, tableId, challengeId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean submitDeck(UUID tableId, DeckCardLists deck) { + try { + return server.submitDeck(sessionId, tableId, deck); + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (GameException ex) { + handleGameException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean concedeGame(UUID gameId) { + try { + server.concedeGame(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean stopWatching(UUID gameId) { + try { + server.stopWatching(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean startReplay(UUID gameId) { + try { + server.startReplay(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean stopReplay(UUID gameId) { + try { + server.stopReplay(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean nextPlay(UUID gameId) { + try { + server.nextPlay(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean previousPlay(UUID gameId) { + try { + server.previousPlay(gameId, sessionId); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + public boolean cheat(UUID gameId, UUID playerId, DeckCardLists deckList) { + try { + server.cheat(gameId, sessionId, playerId, deckList); + return true; + } catch (RemoteException ex) { + handleRemoteException(ex); + } catch (MageException ex) { + handleMageException(ex); + } + return false; + } + + private void handleRemoteException(RemoteException ex) { + logger.fatal("Communication error", ex); + JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Critical server error. Disconnecting", "Error", JOptionPane.ERROR_MESSAGE); + disconnect(); + } + + private void handleMageException(MageException ex) { + logger.fatal("Server error", ex); + JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Critical server error. Disconnecting", "Error", JOptionPane.ERROR_MESSAGE); + disconnect(); + } + + private void handleGameException(GameException ex) { + logger.warn(ex.getMessage()); + JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + } + + + public String getUserName() { + return userName; + } + + public MageUI getUI() { + return ui; + } + + public Server getServerRef() { + return server; + } + + class ServerPinger implements Runnable { + + private int missed = 0; + + @Override + public void run() { + if (!ping()) { + missed++; + if (missed > 10) { + logger.info("Connection to server timed out"); + removeServer(); + } + } + else { + missed = 0; + } + } + + } +} + +class MageAuthenticator extends Authenticator { + + private String username; + private String password; + + public MageAuthenticator(String username, String password) { + this.username = username; + this.password = password; + } + + @Override + public PasswordAuthentication getPasswordAuthentication () { + return new PasswordAuthentication (username, password.toCharArray()); + } +} \ No newline at end of file diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java index 2eb3f7b6cb2..8515206a695 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java @@ -41,7 +41,7 @@ import java.util.UUID; import javax.swing.DefaultComboBoxModel; import mage.client.MageFrame; -import mage.remote.Session; +import mage.client.remote.Session; import mage.client.util.Config; import mage.client.util.Event; import mage.client.util.Listener; diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index e32f9cf4198..84a010bf05e 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -43,8 +43,8 @@ import mage.client.dialog.JoinTableDialog; import mage.client.dialog.NewTableDialog; import mage.client.dialog.NewTournamentDialog; import mage.client.dialog.TableWaitingDialog; -import mage.remote.MageRemoteException; -import mage.remote.Session; +import mage.client.remote.MageRemoteException; +import mage.client.remote.Session; import mage.client.util.ButtonColumn; import mage.game.match.MatchOptions; import mage.sets.Sets; diff --git a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java index e4ace620af8..42fdffe8891 100644 --- a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java @@ -38,7 +38,7 @@ import java.util.UUID; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import mage.client.MageFrame; -import mage.remote.Session; +import mage.client.remote.Session; /** * diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java index c61de38e637..b70548a65ab 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java @@ -48,8 +48,8 @@ import java.util.concurrent.ExecutionException; import javax.swing.*; import javax.swing.table.AbstractTableModel; import mage.client.MageFrame; -import mage.remote.MageRemoteException; -import mage.remote.Session; +import mage.client.remote.MageRemoteException; +import mage.client.remote.Session; import mage.client.util.ButtonColumn; import mage.view.RoundView; import mage.view.TournamentGameView; @@ -104,7 +104,7 @@ public class TournamentPanel extends javax.swing.JPanel { public synchronized void showTournament(UUID tournamentId) { this.tournamentId = tournamentId; session = MageFrame.getSession(); - MageFrame.addTournament(tournamentId, this); + session.addTournament(tournamentId, this); UUID chatRoomId = session.getTournamentChatId(tournamentId); if (session.joinTournament(tournamentId) && chatRoomId != null) { this.chatPanel1.connect(chatRoomId); diff --git a/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java b/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java index e783ad9f5bb..7a7421af71f 100644 --- a/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java @@ -3,7 +3,7 @@ package mage.client.util; import java.awt.event.MouseEvent; import java.util.UUID; -import mage.remote.Session; +import mage.client.remote.Session; import mage.view.CardView; diff --git a/Mage.Common/src/mage/interfaces/Client.java b/Mage.Common/src/mage/interfaces/Client.java deleted file mode 100644 index a6094843ed1..00000000000 --- a/Mage.Common/src/mage/interfaces/Client.java +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - -package mage.interfaces; - -import java.util.UUID; -import mage.interfaces.callback.CallbackClient; -import mage.utils.MageVersion; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public interface Client extends CallbackClient { - - public UUID getId(); - public MageVersion getVersion(); - public void connected(String message); - public void disconnected(); - public void showMessage(String message); - public void showError(String message); - -} diff --git a/Mage.Common/src/mage/interfaces/Server.java b/Mage.Common/src/mage/interfaces/Server.java index 81db21972c2..c8889a03a95 100644 --- a/Mage.Common/src/mage/interfaces/Server.java +++ b/Mage.Common/src/mage/interfaces/Server.java @@ -28,12 +28,12 @@ package mage.interfaces; -import mage.MageException; import mage.game.match.MatchOptions; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.List; import java.util.UUID; +import mage.MageException; import mage.cards.decks.DeckCardLists; import mage.game.GameException; import mage.game.tournament.TournamentOptions; @@ -54,6 +54,7 @@ public interface Server extends Remote, CallbackServer { public UUID registerClient(String userName, UUID clientId, MageVersion version) throws RemoteException, MageException; public UUID registerAdmin(String password, MageVersion version) throws RemoteException, MageException; public void deregisterClient(UUID sessionId) throws RemoteException, MageException; + public void ack(String message, UUID sessionId) throws RemoteException, MageException; public boolean ping(UUID sessionId) throws RemoteException, MageException; public ServerState getServerState() throws RemoteException, MageException; diff --git a/Mage.Common/src/mage/interfaces/callback/CallbackAck.java b/Mage.Common/src/mage/interfaces/callback/CallbackAck.java deleted file mode 100644 index 2399d14e3ac..00000000000 --- a/Mage.Common/src/mage/interfaces/callback/CallbackAck.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.interfaces.callback; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class CallbackAck { - - private boolean ack; - private int value; - - public void clear() { - ack = false; - value = 0; - } - - public boolean isAck() { - return ack; - } - - public void setAck(boolean ack) { - this.ack = ack; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } - -} diff --git a/Mage.Common/src/mage/interfaces/callback/CallbackClientDaemon.java b/Mage.Common/src/mage/interfaces/callback/CallbackClientDaemon.java index a4a6b3495b0..95a6ecdc40b 100644 --- a/Mage.Common/src/mage/interfaces/callback/CallbackClientDaemon.java +++ b/Mage.Common/src/mage/interfaces/callback/CallbackClientDaemon.java @@ -31,9 +31,6 @@ package mage.interfaces.callback; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import mage.MageException; -import mage.remote.ServerUnavailable; -import mage.remote.Session; import org.apache.log4j.Logger; /** @@ -44,15 +41,14 @@ public class CallbackClientDaemon extends Thread { private final static Logger logger = Logger.getLogger(CallbackClientDaemon.class); - private ExecutorService callbackExecutor = Executors.newFixedThreadPool(1); + private static ExecutorService callbackExecutor = Executors.newCachedThreadPool(); private final CallbackClient client; - private final Session session; + private final CallbackServer server; private final UUID id; - private boolean end = false; - public CallbackClientDaemon(UUID id, CallbackClient client, Session session) { + public CallbackClientDaemon(UUID id, CallbackClient client, CallbackServer server) { this.client = client; - this.session = session; + this.server = server; this.id = id; setDaemon(true); start(); @@ -60,30 +56,25 @@ public class CallbackClientDaemon extends Thread { @Override public void run() { - try { - while(!end && session.isConnected()) { - try { - final ClientCallback callback = session.callback(id); - session.ack(id, callback.getMessageId()); - if (callbackExecutor.isShutdown()) - logger.fatal("Attempt to submit callback to shutdown executor"); - else - client.processCallback(callback); - } catch (ServerUnavailable ex) { - session.handleServerUnavailable(ex); - } catch (Exception ex) { - logger.fatal("CallbackClientDaemon failed ", ex); + try { + while(true) { + final ClientCallback callback = server.callback(id); + callbackExecutor.submit( + new Runnable() { + @Override + public void run() { + try { + client.processCallback(callback); + } + catch (Exception ex) { + logger.fatal("CallbackClientDaemon error ", ex); + } + } } - } - } catch (Exception ex) { + ); + } + } catch(Exception ex) { logger.fatal("CallbackClientDaemon error ", ex); - } - logger.info("CallbackClientDaemon stopped"); - } - - public void stopDaemon() { - end = true; - callbackExecutor.shutdown(); - } - + } + } } diff --git a/Mage.Common/src/mage/interfaces/callback/CallbackServer.java b/Mage.Common/src/mage/interfaces/callback/CallbackServer.java index 1c5cf2a479a..f3e1b8ce35c 100644 --- a/Mage.Common/src/mage/interfaces/callback/CallbackServer.java +++ b/Mage.Common/src/mage/interfaces/callback/CallbackServer.java @@ -37,7 +37,6 @@ import java.util.UUID; */ public interface CallbackServer { - public ClientCallback callback(UUID clientId) throws RemoteException, CallbackException; - public void ack(int messageId, UUID sessionId) throws RemoteException, CallbackException; + public ClientCallback callback(UUID clientId) throws RemoteException; } diff --git a/Mage.Common/src/mage/interfaces/callback/CallbackServerSession.java b/Mage.Common/src/mage/interfaces/callback/CallbackServerSession.java index 314f06d755e..63d9a813425 100644 --- a/Mage.Common/src/mage/interfaces/callback/CallbackServerSession.java +++ b/Mage.Common/src/mage/interfaces/callback/CallbackServerSession.java @@ -30,8 +30,6 @@ package mage.interfaces.callback; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; - -import mage.utils.CompressUtil; import org.apache.log4j.Logger; /** @@ -87,7 +85,7 @@ public class CallbackServerSession { waiting.await(); } callback.setMethod(call.getMethod()); - callback.setData(CompressUtil.compress(call.getData())); + callback.setData(call.getData()); callback.setObjectId(call.getObjectId()); callback.setMessageId(call.getMessageId()); callbackCalled.signal(); diff --git a/Mage.Common/src/mage/remote/AbstractRemoteMethodCall.java b/Mage.Common/src/mage/remote/AbstractRemoteMethodCall.java deleted file mode 100644 index 6116a83bfda..00000000000 --- a/Mage.Common/src/mage/remote/AbstractRemoteMethodCall.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ -import java.rmi.*; -import mage.MageException; -import mage.interfaces.Server; -import org.apache.log4j.Logger; - -public abstract class AbstractRemoteMethodCall { - - private final static Logger logger = Logger.getLogger(AbstractRemoteMethodCall.class); - - public T makeCall() throws ServerUnavailable, MageException { - RetryStrategy strategy = getRetryStrategy(); - while (strategy.shouldRetry()) { - Server server = getServer(); - if (null == server) { - throw new ServerUnavailable(); - } - try { - return performRemoteCall(server); - } - catch (RemoteException remoteException) { - try { - remoteExceptionOccurred(remoteException); - strategy.remoteExceptionOccurred(); - } - catch (RetryException retryException) { - handleRetryException(server); - } - } - } - return null; - } - -/* - The next 4 methods define the core behavior. Of these, two must - be implemented by the subclass (and so are left abstract). The - remaining three can be altered to provide customized retry handling. -*/ - -/** - getRemoteObject is a template method which should, in most cases, - return the stub. -*/ - - protected abstract Server getServer() throws ServerUnavailable; - -/** - performRemoteCall is a template method which actually makes the remote - method invocation. -*/ - protected abstract T performRemoteCall(Server server) throws RemoteException, MageException; - - - protected RetryStrategy getRetryStrategy() { - return new AdditiveWaitRetryStrategy(); - } - - protected void remoteExceptionOccurred(RemoteException remoteException) { - /* ignored in based class. */ - } - - protected void handleRetryException(Server server) throws ServerUnavailable { - logger.fatal("Repeated attempts to communicate with " + server + " failed."); - throw new ServerUnavailable(); - } -} \ No newline at end of file diff --git a/Mage.Common/src/mage/remote/AdditiveWaitRetryStrategy.java b/Mage.Common/src/mage/remote/AdditiveWaitRetryStrategy.java deleted file mode 100644 index 13d97caeca5..00000000000 --- a/Mage.Common/src/mage/remote/AdditiveWaitRetryStrategy.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ - -/** - The most commonly used retry strategy; it extends the waiting - period by a constant amount with each retry. - - Note that the default version of this (e.g. the one with a - zero argument constructor) will make 3 calls and wind up waiting - approximately 11 seconds (zero wait for the first call, 3 seconds - for the second call, and 8 seconds for the third call). These - wait times are pretty small, and are usually dwarfed by socket - timeouts when network difficulties occur anyway. -*/ - -public class AdditiveWaitRetryStrategy extends RetryStrategy { - public static final long STARTING_WAIT_TIME = 3000; - public static final long WAIT_TIME_INCREMENT = 5000; - - private long currentTimeToWait; - private long waitTimeIncrement; - - public AdditiveWaitRetryStrategy () { - this(DEFAULT_NUMBER_OF_RETRIES , STARTING_WAIT_TIME, WAIT_TIME_INCREMENT); - } - - public AdditiveWaitRetryStrategy (int numberOfRetries, long startingWaitTime, long waitTimeIncrement) { - super(numberOfRetries); - this.currentTimeToWait = startingWaitTime; - this.waitTimeIncrement = waitTimeIncrement; - } - - @Override - protected long getTimeToWait() { - long returnValue = currentTimeToWait; - currentTimeToWait += waitTimeIncrement; - return returnValue; - } -} \ No newline at end of file diff --git a/Mage.Common/src/mage/remote/RMIClientDaemon.java b/Mage.Common/src/mage/remote/RMIClientDaemon.java deleted file mode 100644 index bf96fe4306b..00000000000 --- a/Mage.Common/src/mage/remote/RMIClientDaemon.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class RMIClientDaemon extends Thread { - - private final RemoteMethodCallQueue q; - - public RMIClientDaemon(RemoteMethodCallQueue q) { - this.q = q; - setDaemon(true); - start(); - } - - @Override - public void run() { - try { - while (true) { - RemoteMethodCall call = q.take(); - call.makeCall(); - synchronized (call) { - call.notify(); - } - } - } - catch (InterruptedException ex) { - - } - } -} diff --git a/Mage.Common/src/mage/remote/RemoteMethodCall.java b/Mage.Common/src/mage/remote/RemoteMethodCall.java deleted file mode 100644 index e8c124a2b23..00000000000 --- a/Mage.Common/src/mage/remote/RemoteMethodCall.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -import java.rmi.*; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import org.apache.log4j.Logger; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ - -public abstract class RemoteMethodCall extends AbstractRemoteMethodCall { - - protected final static Logger logger = Logger.getLogger(RemoteMethodCall.class); - - protected Connection connection; - protected String name; - protected T returnVal; - protected boolean exception = false; - protected MageException ex; - protected SessionState allowedState; - - public RemoteMethodCall(Connection connection, String name, SessionState allowedState){ - this.connection = connection; - this.name = name; - this.allowedState = allowedState; - } - - @Override - public T makeCall() { - returnVal = null; - logger.debug("Calling: " + name); - try { - returnVal = super.makeCall(); - } - catch (ServerUnavailable e) { - this.exception = true; - } - catch (MageException e) { - this.exception = true; - this.ex = e; - } - finally { - ServerCache.noLongerUsingServer(connection); - } - return returnVal; - } - - public T makeDirectCall() throws ServerUnavailable, MageException { - T returnValue = null; - logger.debug("Calling direct: " + name); - try { - returnValue = super.makeCall(); - } - finally { - ServerCache.noLongerUsingServer(connection); - } - return returnValue; - } - - @Override - protected Server getServer() throws ServerUnavailable { - try { - Server stub = ServerCache.getServer(connection); - return stub; - } - catch (ServerUnavailable serverUnavailable) { - logger.fatal("Can't find stub for server " + connection); - throw serverUnavailable; - } - } - - public String getName() { - return name; - } - - protected void remoteExceptionOccured(RemoteException remoteException) { - ServerCache.removeServerFromCache(connection); - } - - public T getReturnVal() { - return returnVal; - } - - public MageException getException() { - return ex; - } - - public boolean isException() { - return exception; - } - - public SessionState getAllowedState() { - return allowedState; - } -} diff --git a/Mage.Common/src/mage/remote/RemoteMethodCallQueue.java b/Mage.Common/src/mage/remote/RemoteMethodCallQueue.java deleted file mode 100644 index ef55d90e75e..00000000000 --- a/Mage.Common/src/mage/remote/RemoteMethodCallQueue.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote; - -import java.util.concurrent.LinkedBlockingQueue; -import mage.MageException; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class RemoteMethodCallQueue extends LinkedBlockingQueue { - - public void callMethod(RemoteMethodCall call) throws ServerUnavailable, MageException { - synchronized (call) { - try { - this.offer(call); - call.wait(); - if (call.isException()) { - if (call.getException() != null) - throw call.getException(); - else - throw new ServerUnavailable(); - } - } catch (InterruptedException ex) { - - } - } - } - - public void clearCalls() { - RemoteMethodCall call = null; - while (true) { - call = poll(); - if (call == null) - return; - synchronized (call) { - call.notify(); - } - } - } - -} diff --git a/Mage.Common/src/mage/remote/RetryException.java b/Mage.Common/src/mage/remote/RetryException.java deleted file mode 100644 index e291189f3b8..00000000000 --- a/Mage.Common/src/mage/remote/RetryException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -import java.io.*; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ - -public class RetryException extends Exception implements Externalizable -{ - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - } -} diff --git a/Mage.Common/src/mage/remote/RetryStrategy.java b/Mage.Common/src/mage/remote/RetryStrategy.java deleted file mode 100644 index 20e0f3565ff..00000000000 --- a/Mage.Common/src/mage/remote/RetryStrategy.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -import org.apache.log4j.Logger; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ -public abstract class RetryStrategy { - public static final int DEFAULT_NUMBER_OF_RETRIES = 3; - private int _numberOfTriesLeft; - private final static Logger logger = Logger.getLogger(RetryStrategy.class); - - public RetryStrategy() { - this(DEFAULT_NUMBER_OF_RETRIES); - } - - public RetryStrategy(int numberOfRetries){ - _numberOfTriesLeft = numberOfRetries; - } - - public boolean shouldRetry() { - return (0 < _numberOfTriesLeft); - } - - public void remoteExceptionOccurred() throws RetryException { - _numberOfTriesLeft --; - if (!shouldRetry()) { - throw new RetryException(); - } - waitUntilNextTry(); - } - - protected abstract long getTimeToWait(); - - private void waitUntilNextTry() { - long timeToWait = getTimeToWait(); - logger.warn("Error calling server, waiting " + timeToWait + "ms before retrying"); - try { - Thread.sleep(timeToWait ); - } - catch (InterruptedException ignored) {} - } -} \ No newline at end of file diff --git a/Mage.Common/src/mage/remote/ServerCache.java b/Mage.Common/src/mage/remote/ServerCache.java deleted file mode 100644 index 6daa5db3756..00000000000 --- a/Mage.Common/src/mage/remote/ServerCache.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -import java.util.HashMap; -import mage.interfaces.Server; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ -public class ServerCache -{ - private static HashMap servers = new HashMap(); - - public static Server getServer(Connection connection) throws ServerUnavailable - { - Server returnValue = servers.get(connection); - if (returnValue == null) { - returnValue = connection.getServer() ; - if (returnValue != null) { - servers.put(connection, returnValue); - } - else { - throw new ServerUnavailable(); - } - } - return returnValue; - - } - - public static void noLongerUsingServer(Connection connection) { - /* - Needs to be implemented if we take cleaning up the cache seriously. - */ - } - - public static void removeServerFromCache(Connection connection) { - servers.remove(connection); - } -} diff --git a/Mage.Common/src/mage/remote/ServerUnavailable.java b/Mage.Common/src/mage/remote/ServerUnavailable.java deleted file mode 100644 index 605783192a2..00000000000 --- a/Mage.Common/src/mage/remote/ServerUnavailable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote; - -import java.io.*; - -/** - * Adopted from the code by William Grosso, author of Java RMI - * 10/17/2001 - * - * http://www.onjava.com/pub/a/onjava/2001/10/17/rmi.html - * oreillynet.com Copyright © 2000 O'Reilly & Associates, Inc. - * - * @author BetaSteward_at_googlemail.com - */ - -public class ServerUnavailable extends Exception implements Externalizable -{ - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException{ - } -} diff --git a/Mage.Common/src/mage/remote/Session.java b/Mage.Common/src/mage/remote/Session.java deleted file mode 100644 index 0dbaea52493..00000000000 --- a/Mage.Common/src/mage/remote/Session.java +++ /dev/null @@ -1,548 +0,0 @@ -/* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - -package mage.remote; - -import java.net.Authenticator; -import java.net.PasswordAuthentication; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import java.util.Collection; -import java.util.List; -import java.util.Map.Entry; -import java.util.UUID; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import mage.cards.decks.DeckCardLists; -import mage.remote.method.*; -import mage.game.GameException; -import mage.MageException; -import mage.cards.decks.InvalidDeckException; -import mage.constants.Constants.SessionState; -import mage.game.match.MatchOptions; -import mage.game.tournament.TournamentOptions; -import mage.interfaces.Client; -import mage.interfaces.ServerState; -import mage.interfaces.callback.CallbackClientDaemon; -import mage.interfaces.callback.ClientCallback; -import mage.utils.MageVersion; -import mage.view.DraftPickView; -import mage.view.GameTypeView; -import mage.view.TableView; -import mage.view.TournamentTypeView; -import mage.view.TournamentView; -import org.apache.log4j.Logger; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Session { - - private final static Logger logger = Logger.getLogger(Session.class); - private static ScheduledExecutorService sessionExecutor = Executors.newScheduledThreadPool(1); - - private UUID sessionId; - private Client client; - private String userName; - private ServerState serverState; - private SessionState sessionState = SessionState.DISCONNECTED; - private CallbackClientDaemon callbackDaemon; - private RMIClientDaemon rmiDaemon; - private RemoteMethodCallQueue q = new RemoteMethodCallQueue(); - private ScheduledFuture future; - private Connection connection; - - public Session(Client client) { - this.client = client; - rmiDaemon = new RMIClientDaemon(q); - } - - public synchronized boolean connect(Connection connection) { - cleanupSession(); - this.connection = connection; - return connect(); - } - - public boolean connect() { - sessionState = SessionState.CONNECTING; - try { - System.setSecurityManager(null); - System.setProperty("http.nonProxyHosts", "code.google.com"); - System.setProperty("socksNonProxyHosts", "code.google.com"); - - // clear previous values - System.clearProperty("socksProxyHost"); - System.clearProperty("socksProxyPort"); - System.clearProperty("http.proxyHost"); - System.clearProperty("http.proxyPort"); - - switch (connection.getProxyType()) { - case SOCKS: - System.setProperty("socksProxyHost", connection.getProxyHost()); - System.setProperty("socksProxyPort", Integer.toString(connection.getProxyPort())); - break; - case HTTP: - System.setProperty("http.proxyHost", connection.getProxyHost()); - System.setProperty("http.proxyPort", Integer.toString(connection.getProxyPort())); - Authenticator.setDefault(new MageAuthenticator(connection.getProxyUsername(), connection.getProxyPassword())); - break; - } - Registry reg = LocateRegistry.getRegistry(connection.getHost(), connection.getPort()); - this.userName = connection.getUsername(); - sessionId = registerClient(userName, client.getId(), client.getVersion()); - serverState = getServerState(); - sessionState = SessionState.CONNECTED; - callbackDaemon = new CallbackClientDaemon(sessionId, client, this); - future = sessionExecutor.scheduleWithFixedDelay(new ServerPinger(), 5, 5, TimeUnit.SECONDS); - logger.info("Connected to RMI server at " + connection.getHost() + ":" + connection.getPort()); - client.connected("Connected to " + connection.getHost() + ":" + connection.getPort() + " "); - return true; - } catch (Exception ex) { - logger.fatal("", ex); - sessionState = SessionState.SERVER_UNAVAILABLE; - disconnect(false); - client.showMessage("Unable to connect to server. " + ex.getMessage()); - } - return false; - } - - public synchronized void disconnect(boolean showMessage) { - if (sessionState == SessionState.CONNECTED) - sessionState = SessionState.DISCONNECTING; - cleanupSession(); - if (connection == null) - return; - if (sessionState == SessionState.CONNECTED) { - try { - deregisterClient(); - } catch (Exception ex) { - logger.fatal("Error disconnecting ...", ex); - } - } - ServerCache.removeServerFromCache(connection); - client.disconnected(); - logger.info("Disconnected ... "); - if (sessionState == SessionState.SERVER_UNAVAILABLE && showMessage) { - client.showError("Server error. You have been disconnected"); - } - else { - sessionState = SessionState.DISCONNECTED; - } - } - - private void cleanupSession() { - q.clearCalls(); - if (future != null && !future.isDone()) - future.cancel(true); - if (callbackDaemon != null) - callbackDaemon.stopDaemon(); - } - - private boolean handleCall(RemoteMethodCall method) { - try { - if (sessionState == method.getAllowedState()) { - q.callMethod(method); - return true; - } - } catch (ServerUnavailable ex) { - handleServerUnavailable(ex); - } catch (GameException ex) { - handleGameException(ex); - } catch (InvalidDeckException ex) { - handleInvalidDeckException(ex); - } catch (MageException ex) { - logger.fatal(method.getName() + " error", ex); - } - return false; - } - - public boolean ping() { - Ping method = new Ping(connection, sessionId); - if (handleCall(method)) - return method.getReturnVal(); - return false; - } - - private UUID registerClient(String userName, UUID clientId, MageVersion version) throws MageException, ServerUnavailable { - if (sessionState == SessionState.CONNECTING) { - RegisterClient method = new RegisterClient(connection, userName, clientId, version); - return method.makeDirectCall(); - } - return null; - } - - private void deregisterClient() throws MageException, ServerUnavailable { - DeregisterClient method = new DeregisterClient(connection, sessionId); - method.makeDirectCall(); - } - - private ServerState getServerState() { - GetServerState method = new GetServerState(connection); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public SessionState getState() { - return sessionState; - } - public boolean isConnected() { - return sessionState == SessionState.CONNECTED; - } - - public String[] getPlayerTypes() { - return serverState.getPlayerTypes(); - } - - public List getGameTypes() { - return serverState.getGameTypes(); - } - - public String[] getDeckTypes() { - return serverState.getDeckTypes(); - } - - public List getTournamentTypes() { - return serverState.getTournamentTypes(); - } - - public boolean isTestMode() { - if (serverState != null) - return serverState.isTestMode(); - return false; - } - - public ClientCallback callback(UUID clientId) throws ServerUnavailable, MageException { - if (sessionState == SessionState.CONNECTED) { - Callback method = new Callback(connection, clientId); - return method.makeDirectCall(); - } - return null; - } - - public boolean ack(UUID clientId, int messageId) { - Ack method = new Ack(connection, clientId, messageId); - return handleCall(method); - } - - public UUID getMainRoomId() { - GetMainRoomId method = new GetMainRoomId(connection); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public UUID getRoomChatId(UUID roomId) { - GetRoomChatId method = new GetRoomChatId(connection, roomId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public UUID getTableChatId(UUID tableId) { - GetTableChatId method = new GetTableChatId(connection, tableId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public UUID getGameChatId(UUID gameId) { - GetGameChatId method = new GetGameChatId(connection, gameId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public TableView getTable(UUID roomId, UUID tableId) { - GetTable method = new GetTable(connection, roomId, tableId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public boolean watchTable(UUID roomId, UUID tableId) { - WatchTable method = new WatchTable(connection, sessionId, roomId, tableId); - if (handleCall(method)) - return method.getReturnVal(); - return false; - } - - public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList) { - JoinTable method = new JoinTable(connection, sessionId, roomId, tableId, playerName, playerType, skill, deckList); - if (handleCall(method)) - return method.getReturnVal(); - return false; - } - - public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill) { - JoinTournamentTable method = new JoinTournamentTable(connection, sessionId, roomId, tableId, playerName, playerType, skill); - if (handleCall(method)) - return method.getReturnVal(); - return false; - } - - public Collection getTables(UUID roomId) throws MageRemoteException { - GetTables method = new GetTables(connection, roomId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public Collection getConnectedPlayers(UUID roomId) throws MageRemoteException { - GetConnectedPlayers method = new GetConnectedPlayers(connection, roomId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public TournamentView getTournament(UUID tournamentId) throws MageRemoteException { - GetTournament method = new GetTournament(connection, tournamentId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public UUID getTournamentChatId(UUID tournamentId) { - GetTournamentChatId method = new GetTournamentChatId(connection, tournamentId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public boolean sendPlayerUUID(UUID gameId, UUID data) { - SendPlayerUUID method = new SendPlayerUUID(connection, sessionId, gameId, data); - return handleCall(method); - } - - public boolean sendPlayerBoolean(UUID gameId, boolean data) { - SendPlayerBoolean method = new SendPlayerBoolean(connection, sessionId, gameId, data); - return handleCall(method); - } - - public boolean sendPlayerInteger(UUID gameId, int data) { - SendPlayerInteger method = new SendPlayerInteger(connection, sessionId, gameId, data); - return handleCall(method); - } - - public boolean sendPlayerString(UUID gameId, String data) { - SendPlayerString method = new SendPlayerString(connection, sessionId, gameId, data); - return handleCall(method); - } - - public DraftPickView sendCardPick(UUID draftId, UUID cardId) { - SendCardPick method = new SendCardPick(connection, sessionId, draftId, cardId); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public boolean joinChat(UUID chatId) { - JoinChat method = new JoinChat(connection, sessionId, chatId, userName); - return handleCall(method); - } - - public boolean leaveChat(UUID chatId) { - LeaveChat method = new LeaveChat(connection, sessionId, chatId); - return handleCall(method); - } - - public boolean sendChatMessage(UUID chatId, String message) { - SendChatMessage method = new SendChatMessage(connection, chatId, message, userName); - return handleCall(method); - } - - public boolean joinGame(UUID gameId) { - JoinGame method = new JoinGame(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean joinDraft(UUID draftId) { - JoinDraft method = new JoinDraft(connection, sessionId, draftId); - return handleCall(method); - } - - public boolean joinTournament(UUID tournamentId) { - JoinTournament method = new JoinTournament(connection, sessionId, tournamentId); - return handleCall(method); - } - - public boolean watchGame(UUID gameId) { - WatchGame method = new WatchGame(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean replayGame(UUID gameId) { - ReplayGame method = new ReplayGame(connection, sessionId, gameId); - return handleCall(method); - } - - public TableView createTable(UUID roomId, MatchOptions matchOptions) { - CreateTable method = new CreateTable(connection, sessionId, roomId, matchOptions); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public TableView createTournamentTable(UUID roomId, TournamentOptions tournamentOptions) { - CreateTournamentTable method = new CreateTournamentTable(connection, sessionId, roomId, tournamentOptions); - if (handleCall(method)) - return method.getReturnVal(); - return null; - } - - public boolean isTableOwner(UUID roomId, UUID tableId) { - IsTableOwner method = new IsTableOwner(connection, sessionId, roomId, tableId); - if (handleCall(method)) - return method.getReturnVal(); - return false; - } - - public boolean removeTable(UUID roomId, UUID tableId) { - RemoveTable method = new RemoveTable(connection, sessionId, roomId, tableId); - return handleCall(method); - } - - public boolean swapSeats(UUID roomId, UUID tableId, int seatNum1, int seatNum2) { - SwapSeats method = new SwapSeats(connection, sessionId, roomId, tableId, seatNum1, seatNum2); - return handleCall(method); - } - - public boolean leaveTable(UUID roomId, UUID tableId) { - LeaveTable method = new LeaveTable(connection, sessionId, roomId, tableId); - return handleCall(method); - } - - public boolean startGame(UUID roomId, UUID tableId) { - StartGame method = new StartGame(connection, sessionId, roomId, tableId); - return handleCall(method); - } - - public boolean startTournament(UUID roomId, UUID tableId) { - StartTournament method = new StartTournament(connection, sessionId, roomId, tableId); - return handleCall(method); - } - - public boolean startChallenge(UUID roomId, UUID tableId, UUID challengeId) { - StartChallenge method = new StartChallenge(connection, sessionId, roomId, tableId, challengeId); - return handleCall(method); - } - - public boolean submitDeck(UUID tableId, DeckCardLists deck) { - SubmitDeck method = new SubmitDeck(connection, sessionId, tableId, deck); - if (handleCall(method)) - return method.getReturnVal(); - return false; - } - - public boolean concedeGame(UUID gameId) { - ConcedeGame method = new ConcedeGame(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean stopWatching(UUID gameId) { - StopWatching method = new StopWatching(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean startReplay(UUID gameId) { - StartReplay method = new StartReplay(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean stopReplay(UUID gameId) { - StopReplay method = new StopReplay(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean nextPlay(UUID gameId) { - NextPlay method = new NextPlay(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean previousPlay(UUID gameId) { - PreviousPlay method = new PreviousPlay(connection, sessionId, gameId); - return handleCall(method); - } - - public boolean cheat(UUID gameId, UUID playerId, DeckCardLists deckList) { - Cheat method = new Cheat(connection, sessionId, gameId, playerId, deckList); - return handleCall(method); - } - - public void handleServerUnavailable(ServerUnavailable ex) { - sessionState = SessionState.SERVER_UNAVAILABLE; - logger.fatal("server unavailable - ", ex); - disconnect(true); - } - - private void handleGameException(GameException ex) { - logger.warn(ex.getMessage()); - client.showError(ex.getMessage()); - } - - private void handleInvalidDeckException(InvalidDeckException ex) { - StringBuilder sbMessage = new StringBuilder(); - logger.warn(ex.getMessage()); - sbMessage.append(ex.getMessage()).append("\n"); - for (Entry entry: ex.getInvalid().entrySet()) { - sbMessage.append(entry.getKey()).append(":").append(entry.getValue()).append("\n"); - } - client.showError(sbMessage.toString()); - } - - public String getUserName() { - return userName; - } - - class ServerPinger implements Runnable { - - @Override - public void run() { - ping(); - } - } -} - -class MageAuthenticator extends Authenticator { - - private String username; - private String password; - - public MageAuthenticator(String username, String password) { - this.username = username; - this.password = password; - } - - @Override - public PasswordAuthentication getPasswordAuthentication () { - return new PasswordAuthentication (username, password.toCharArray()); - } -} \ No newline at end of file diff --git a/Mage.Common/src/mage/remote/method/Ack.java b/Mage.Common/src/mage/remote/method/Ack.java deleted file mode 100644 index 36a581cfa20..00000000000 --- a/Mage.Common/src/mage/remote/method/Ack.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.interfaces.callback.CallbackException; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Ack extends RemoteMethodCall { - - private UUID sessionId; - private int messageId; - - public Ack(Connection connection, UUID sessionId, int messageId) { - super(connection, "Ack", SessionState.CONNECTED); - this.sessionId = sessionId; - this.messageId = messageId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, CallbackException { - server.ack(messageId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/Callback.java b/Mage.Common/src/mage/remote/method/Callback.java deleted file mode 100644 index 540c777175b..00000000000 --- a/Mage.Common/src/mage/remote/method/Callback.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.interfaces.callback.CallbackException; -import mage.interfaces.callback.ClientCallback; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Callback extends RemoteMethodCall { - - private UUID sessionId; - - public Callback(Connection connection, UUID sessionId) { - super(connection, "Callback", SessionState.CONNECTED); - this.sessionId = sessionId; - } - - @Override - protected ClientCallback performRemoteCall(Server server) throws RemoteException, CallbackException { - return server.callback(sessionId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/Cheat.java b/Mage.Common/src/mage/remote/method/Cheat.java deleted file mode 100644 index be710c5a8e1..00000000000 --- a/Mage.Common/src/mage/remote/method/Cheat.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.cards.decks.DeckCardLists; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Cheat extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - private UUID playerId; - private DeckCardLists deckList; - - public Cheat(Connection connection, UUID sessionId, UUID gameId, UUID playerId, DeckCardLists deckList) { - super(connection, "Cheat", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - this.playerId = playerId; - this.deckList = deckList; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.cheat(gameId, sessionId, playerId, deckList); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/ConcedeGame.java b/Mage.Common/src/mage/remote/method/ConcedeGame.java deleted file mode 100644 index 1c1733b7212..00000000000 --- a/Mage.Common/src/mage/remote/method/ConcedeGame.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class ConcedeGame extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public ConcedeGame(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "ConcedeGame", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.concedeGame(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/CreateTable.java b/Mage.Common/src/mage/remote/method/CreateTable.java deleted file mode 100644 index 138ee5b4f94..00000000000 --- a/Mage.Common/src/mage/remote/method/CreateTable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.game.match.MatchOptions; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.view.TableView; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class CreateTable extends RemoteMethodCall { - - private UUID roomId; - private UUID sessionId; - private MatchOptions matchOptions; - - public CreateTable(Connection connection, UUID sessionId, UUID roomId, MatchOptions matchOptions) { - super(connection, "CreateTable", SessionState.CONNECTED); - this.roomId = roomId; - this.sessionId = sessionId; - this.matchOptions = matchOptions; - } - - @Override - protected TableView performRemoteCall(Server server) throws RemoteException, MageException { - return server.createTable(sessionId, roomId, matchOptions); - } - -} diff --git a/Mage.Common/src/mage/remote/method/CreateTournamentTable.java b/Mage.Common/src/mage/remote/method/CreateTournamentTable.java deleted file mode 100644 index fde8f6c42d9..00000000000 --- a/Mage.Common/src/mage/remote/method/CreateTournamentTable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.game.tournament.TournamentOptions; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.view.TableView; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class CreateTournamentTable extends RemoteMethodCall { - - private UUID roomId; - private UUID sessionId; - private TournamentOptions tournamentOptions; - - public CreateTournamentTable(Connection connection, UUID sessionId, UUID roomId, TournamentOptions tournamentOptions) { - super(connection, "CreateTournamentTable", SessionState.CONNECTED); - this.roomId = roomId; - this.sessionId = sessionId; - this.tournamentOptions = tournamentOptions; - } - - @Override - protected TableView performRemoteCall(Server server) throws RemoteException, MageException { - return server.createTournamentTable(sessionId, roomId, tournamentOptions); - } - -} diff --git a/Mage.Common/src/mage/remote/method/DeregisterClient.java b/Mage.Common/src/mage/remote/method/DeregisterClient.java deleted file mode 100644 index 61efe19732e..00000000000 --- a/Mage.Common/src/mage/remote/method/DeregisterClient.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class DeregisterClient extends RemoteMethodCall { - - private UUID sessionId; - - public DeregisterClient(Connection connection, UUID sessionId) { - super(connection, "DeregisterClient", SessionState.DISCONNECTING); - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.deregisterClient(sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetConnectedPlayers.java b/Mage.Common/src/mage/remote/method/GetConnectedPlayers.java deleted file mode 100644 index 5c30eed2396..00000000000 --- a/Mage.Common/src/mage/remote/method/GetConnectedPlayers.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.List; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetConnectedPlayers extends RemoteMethodCall> { - - private UUID roomId; - - public GetConnectedPlayers(Connection connection, UUID roomId) { - super(connection, "GetConnectedPlayers", SessionState.CONNECTED); - this.roomId = roomId; - } - - @Override - protected List performRemoteCall(Server server) throws RemoteException, MageException { - return server.getConnectedPlayers(roomId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetGameChatId.java b/Mage.Common/src/mage/remote/method/GetGameChatId.java deleted file mode 100644 index 503d3304171..00000000000 --- a/Mage.Common/src/mage/remote/method/GetGameChatId.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetGameChatId extends RemoteMethodCall { - - private UUID gameId; - - public GetGameChatId(Connection connection, UUID gameId) { - super(connection, "GetGameChatId", SessionState.CONNECTED); - this.gameId = gameId; - } - - @Override - protected UUID performRemoteCall(Server server) throws RemoteException, MageException { - return server.getGameChatId(gameId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetMainRoomId.java b/Mage.Common/src/mage/remote/method/GetMainRoomId.java deleted file mode 100644 index 95d093b7692..00000000000 --- a/Mage.Common/src/mage/remote/method/GetMainRoomId.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetMainRoomId extends RemoteMethodCall { - - - public GetMainRoomId(Connection connection) { - super(connection, "GetMainRoomId", SessionState.CONNECTED); - } - - @Override - protected UUID performRemoteCall(Server server) throws RemoteException, MageException { - return server.getMainRoomId(); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetRoomChatId.java b/Mage.Common/src/mage/remote/method/GetRoomChatId.java deleted file mode 100644 index 9edab7073a6..00000000000 --- a/Mage.Common/src/mage/remote/method/GetRoomChatId.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetRoomChatId extends RemoteMethodCall { - - private UUID roomId; - - public GetRoomChatId(Connection connection, UUID roomId) { - super(connection, "GetRoomChatId", SessionState.CONNECTED); - this.roomId = roomId; - } - - @Override - protected UUID performRemoteCall(Server server) throws RemoteException, MageException { - return server.getRoomChatId(roomId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetServerState.java b/Mage.Common/src/mage/remote/method/GetServerState.java deleted file mode 100644 index d1f5099c12d..00000000000 --- a/Mage.Common/src/mage/remote/method/GetServerState.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.interfaces.ServerState; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetServerState extends RemoteMethodCall { - - public GetServerState(Connection connection) { - super(connection, "GetServerState", SessionState.CONNECTING); - } - - @Override - protected ServerState performRemoteCall(Server server) throws RemoteException, MageException { - return server.getServerState(); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetTable.java b/Mage.Common/src/mage/remote/method/GetTable.java deleted file mode 100644 index df9f7e1ccf1..00000000000 --- a/Mage.Common/src/mage/remote/method/GetTable.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.view.TableView; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetTable extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - - public GetTable(Connection connection, UUID roomId, UUID tableId) { - super(connection, "GetTable", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - } - - @Override - protected TableView performRemoteCall(Server server) throws RemoteException, MageException { - return server.getTable(roomId, tableId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetTableChatId.java b/Mage.Common/src/mage/remote/method/GetTableChatId.java deleted file mode 100644 index fe01fe9c213..00000000000 --- a/Mage.Common/src/mage/remote/method/GetTableChatId.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetTableChatId extends RemoteMethodCall { - - private UUID tableId; - - public GetTableChatId(Connection connection, UUID tableId) { - super(connection, "GetTableChatId", SessionState.CONNECTED); - this.tableId = tableId; - } - - @Override - protected UUID performRemoteCall(Server server) throws RemoteException, MageException { - return server.getTableChatId(tableId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetTables.java b/Mage.Common/src/mage/remote/method/GetTables.java deleted file mode 100644 index 8368db37a98..00000000000 --- a/Mage.Common/src/mage/remote/method/GetTables.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.List; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.view.TableView; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetTables extends RemoteMethodCall> { - - private UUID roomId; - - public GetTables(Connection connection, UUID roomId) { - super(connection, "GetTables", SessionState.CONNECTED); - this.roomId = roomId; - } - - @Override - protected List performRemoteCall(Server server) throws RemoteException, MageException { - return server.getTables(roomId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetTournament.java b/Mage.Common/src/mage/remote/method/GetTournament.java deleted file mode 100644 index 7d0431ff4cb..00000000000 --- a/Mage.Common/src/mage/remote/method/GetTournament.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.view.TournamentView; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetTournament extends RemoteMethodCall { - - private UUID tournamentId; - - public GetTournament(Connection connection, UUID tournamentId) { - super(connection, "GetTournament", SessionState.CONNECTED); - this.tournamentId = tournamentId; - } - - @Override - protected TournamentView performRemoteCall(Server server) throws RemoteException, MageException { - return server.getTournament(tournamentId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/GetTournamentChatId.java b/Mage.Common/src/mage/remote/method/GetTournamentChatId.java deleted file mode 100644 index 0708ab5bd02..00000000000 --- a/Mage.Common/src/mage/remote/method/GetTournamentChatId.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class GetTournamentChatId extends RemoteMethodCall { - - private UUID tournamentId; - - public GetTournamentChatId(Connection connection, UUID tournamentId) { - super(connection, "GetTournamentChatId", SessionState.CONNECTED); - this.tournamentId = tournamentId; - } - - @Override - protected UUID performRemoteCall(Server server) throws RemoteException, MageException { - return server.getTournamentChatId(tournamentId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/IsTableOwner.java b/Mage.Common/src/mage/remote/method/IsTableOwner.java deleted file mode 100644 index 22f01c217cd..00000000000 --- a/Mage.Common/src/mage/remote/method/IsTableOwner.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class IsTableOwner extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - - public IsTableOwner(Connection connection, UUID sessionId, UUID roomId, UUID tableId) { - super(connection, "IsTableOwner", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - } - - @Override - protected Boolean performRemoteCall(Server server) throws RemoteException, MageException { - return server.isTableOwner(sessionId, roomId, tableId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/JoinChat.java b/Mage.Common/src/mage/remote/method/JoinChat.java deleted file mode 100644 index 88ae9b51f91..00000000000 --- a/Mage.Common/src/mage/remote/method/JoinChat.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class JoinChat extends RemoteMethodCall { - - private UUID chatId; - private UUID sessionId; - private String userName; - - public JoinChat(Connection connection, UUID sessionId, UUID chatId, String userName) { - super(connection, "JoinChat", SessionState.CONNECTED); - this.chatId = chatId; - this.sessionId = sessionId; - this.userName = userName; - } - - @Override - protected Void performRemoteCall(Server server) throws MageException, RemoteException { - server.joinChat(chatId, sessionId, userName); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/JoinDraft.java b/Mage.Common/src/mage/remote/method/JoinDraft.java deleted file mode 100644 index b995c468663..00000000000 --- a/Mage.Common/src/mage/remote/method/JoinDraft.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class JoinDraft extends RemoteMethodCall { - - private UUID draftId; - private UUID sessionId; - - public JoinDraft(Connection connection, UUID sessionId, UUID draftId) { - super(connection, "JoinDraft", SessionState.CONNECTED); - this.draftId = draftId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.joinDraft(draftId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/JoinGame.java b/Mage.Common/src/mage/remote/method/JoinGame.java deleted file mode 100644 index 5615fe4d2b2..00000000000 --- a/Mage.Common/src/mage/remote/method/JoinGame.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class JoinGame extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public JoinGame(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "JoinGame", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.joinGame(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/JoinTable.java b/Mage.Common/src/mage/remote/method/JoinTable.java deleted file mode 100644 index d3ef91aa153..00000000000 --- a/Mage.Common/src/mage/remote/method/JoinTable.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.cards.decks.DeckCardLists; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.game.GameException; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class JoinTable extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - private String playerName; - private String playerType; - private int skill; - private DeckCardLists deckList; - - public JoinTable(Connection connection, UUID sessionId, UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList) { - super(connection, "JoinTable", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - this.playerName = playerName; - this.playerType = playerType; - this.skill = skill; - this.deckList = deckList; - } - - @Override - protected Boolean performRemoteCall(Server server) throws MageException, GameException, RemoteException { - return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList); - } - -} diff --git a/Mage.Common/src/mage/remote/method/JoinTournament.java b/Mage.Common/src/mage/remote/method/JoinTournament.java deleted file mode 100644 index 566c600eb27..00000000000 --- a/Mage.Common/src/mage/remote/method/JoinTournament.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class JoinTournament extends RemoteMethodCall { - - private UUID tournamentId; - private UUID sessionId; - - public JoinTournament(Connection connection, UUID sessionId, UUID tournamentId) { - super(connection, "JoinTournament", SessionState.CONNECTED); - this.tournamentId = tournamentId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.joinTournament(tournamentId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/JoinTournamentTable.java b/Mage.Common/src/mage/remote/method/JoinTournamentTable.java deleted file mode 100644 index e20994a4270..00000000000 --- a/Mage.Common/src/mage/remote/method/JoinTournamentTable.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.cards.decks.DeckCardLists; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.game.GameException; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class JoinTournamentTable extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - private String playerName; - private String playerType; - private int skill; - - public JoinTournamentTable(Connection connection, UUID sessionId, UUID roomId, UUID tableId, String playerName, String playerType, int skill) { - super(connection, "JoinTournamentTable", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - this.playerName = playerName; - this.playerType = playerType; - this.skill = skill; - } - - @Override - protected Boolean performRemoteCall(Server server) throws MageException, GameException, RemoteException { - return server.joinTournamentTable(sessionId, roomId, tableId, playerName, playerType, skill); - } - -} diff --git a/Mage.Common/src/mage/remote/method/LeaveChat.java b/Mage.Common/src/mage/remote/method/LeaveChat.java deleted file mode 100644 index efb0c6aab68..00000000000 --- a/Mage.Common/src/mage/remote/method/LeaveChat.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class LeaveChat extends RemoteMethodCall { - - private UUID chatId; - private UUID sessionId; - - public LeaveChat(Connection connection, UUID sessionId, UUID chatId) { - super(connection, "LeaveChat", SessionState.CONNECTED); - this.chatId = chatId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws MageException, RemoteException { - server.leaveChat(chatId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/LeaveTable.java b/Mage.Common/src/mage/remote/method/LeaveTable.java deleted file mode 100644 index 970e2e9f170..00000000000 --- a/Mage.Common/src/mage/remote/method/LeaveTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class LeaveTable extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - - public LeaveTable(Connection connection, UUID sessionId, UUID roomId, UUID tableId) { - super(connection, "LeaveTable", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.leaveTable(sessionId, roomId, tableId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/NextPlay.java b/Mage.Common/src/mage/remote/method/NextPlay.java deleted file mode 100644 index 190b1c7bbf3..00000000000 --- a/Mage.Common/src/mage/remote/method/NextPlay.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class NextPlay extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public NextPlay(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "NextPlay", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.nextPlay(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/Ping.java b/Mage.Common/src/mage/remote/method/Ping.java deleted file mode 100644 index cd76bba65a6..00000000000 --- a/Mage.Common/src/mage/remote/method/Ping.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class Ping extends RemoteMethodCall { - - private UUID sessionId; - - public Ping(Connection connection, UUID sessionId) { - super(connection, "Ping", SessionState.CONNECTED); - this.sessionId = sessionId; - } - - @Override - protected Boolean performRemoteCall(Server server) throws RemoteException, MageException { - return server.ping(sessionId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/PreviousPlay.java b/Mage.Common/src/mage/remote/method/PreviousPlay.java deleted file mode 100644 index ee11ce08c88..00000000000 --- a/Mage.Common/src/mage/remote/method/PreviousPlay.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class PreviousPlay extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public PreviousPlay(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "PreviousPlay", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.previousPlay(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/RegisterClient.java b/Mage.Common/src/mage/remote/method/RegisterClient.java deleted file mode 100644 index 9b1591d0c34..00000000000 --- a/Mage.Common/src/mage/remote/method/RegisterClient.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.utils.MageVersion; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class RegisterClient extends RemoteMethodCall { - - private String userName; - private UUID clientId; - private MageVersion version; - - public RegisterClient(Connection connection, String userName, UUID clientId, MageVersion version) { - super(connection, "RegisterClient", SessionState.CONNECTING); - this.userName = userName; - this.clientId = clientId; - this.version = version; - } - - @Override - protected UUID performRemoteCall(Server server) throws RemoteException, MageException { - return server.registerClient(userName, clientId, version); - } - -} diff --git a/Mage.Common/src/mage/remote/method/RemoveTable.java b/Mage.Common/src/mage/remote/method/RemoveTable.java deleted file mode 100644 index a43994208a0..00000000000 --- a/Mage.Common/src/mage/remote/method/RemoveTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class RemoveTable extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - - public RemoveTable(Connection connection, UUID sessionId, UUID roomId, UUID tableId) { - super(connection, "RemoveTable", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.removeTable(sessionId, roomId, tableId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/ReplayGame.java b/Mage.Common/src/mage/remote/method/ReplayGame.java deleted file mode 100644 index ce1cd1c7eaa..00000000000 --- a/Mage.Common/src/mage/remote/method/ReplayGame.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class ReplayGame extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public ReplayGame(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "ReplayGame", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.replayGame(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/SendCardPick.java b/Mage.Common/src/mage/remote/method/SendCardPick.java deleted file mode 100644 index d51400957ee..00000000000 --- a/Mage.Common/src/mage/remote/method/SendCardPick.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; -import mage.view.DraftPickView; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SendCardPick extends RemoteMethodCall { - - private UUID sessionId; - private UUID draftId; - private UUID cardId; - - public SendCardPick(Connection connection, UUID sessionId, UUID draftId, UUID cardId) { - super(connection, "SendCardPick", SessionState.CONNECTED); - this.sessionId = sessionId; - this.draftId = draftId; - this.cardId = cardId; - } - - @Override - protected DraftPickView performRemoteCall(Server server) throws RemoteException, MageException { - return server.sendCardPick(draftId, sessionId, cardId); - } - -} diff --git a/Mage.Common/src/mage/remote/method/SendChatMessage.java b/Mage.Common/src/mage/remote/method/SendChatMessage.java deleted file mode 100644 index 98de05ebefd..00000000000 --- a/Mage.Common/src/mage/remote/method/SendChatMessage.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SendChatMessage extends RemoteMethodCall { - - private UUID chatId; - private String message; - private String userName; - - public SendChatMessage(Connection connection, UUID chatId, String message, String userName) { - super(connection, "SendChatMessage", SessionState.CONNECTED); - this.chatId = chatId; - this.message = message; - this.userName = userName; - } - - @Override - protected Void performRemoteCall(Server server) throws MageException, RemoteException { - server.sendChatMessage(chatId, userName, message); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/SendPlayerBoolean.java b/Mage.Common/src/mage/remote/method/SendPlayerBoolean.java deleted file mode 100644 index 09c84d78a0c..00000000000 --- a/Mage.Common/src/mage/remote/method/SendPlayerBoolean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SendPlayerBoolean extends RemoteMethodCall { - - private UUID sessionId; - private UUID gameId; - private Boolean data; - - public SendPlayerBoolean(Connection connection, UUID sessionId, UUID gameId, Boolean data) { - super(connection, "SendPlayerBoolean", SessionState.CONNECTED); - this.sessionId = sessionId; - this.gameId = gameId; - this.data = data; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.sendPlayerBoolean(gameId, sessionId, data); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/SendPlayerInteger.java b/Mage.Common/src/mage/remote/method/SendPlayerInteger.java deleted file mode 100644 index de42bd71a57..00000000000 --- a/Mage.Common/src/mage/remote/method/SendPlayerInteger.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SendPlayerInteger extends RemoteMethodCall { - - private UUID sessionId; - private UUID gameId; - private Integer data; - - public SendPlayerInteger(Connection connection, UUID sessionId, UUID gameId, Integer data) { - super(connection, "SendPlayerInteger", SessionState.CONNECTED); - this.sessionId = sessionId; - this.gameId = gameId; - this.data = data; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.sendPlayerInteger(gameId, sessionId, data); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/SendPlayerString.java b/Mage.Common/src/mage/remote/method/SendPlayerString.java deleted file mode 100644 index dc71df20e00..00000000000 --- a/Mage.Common/src/mage/remote/method/SendPlayerString.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SendPlayerString extends RemoteMethodCall { - - private UUID sessionId; - private UUID gameId; - private String data; - - public SendPlayerString(Connection connection, UUID sessionId, UUID gameId, String data) { - super(connection, "SendPlayerString", SessionState.CONNECTED); - this.sessionId = sessionId; - this.gameId = gameId; - this.data = data; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.sendPlayerString(gameId, sessionId, data); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/SendPlayerUUID.java b/Mage.Common/src/mage/remote/method/SendPlayerUUID.java deleted file mode 100644 index 3f90c32d3e8..00000000000 --- a/Mage.Common/src/mage/remote/method/SendPlayerUUID.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SendPlayerUUID extends RemoteMethodCall { - - private UUID sessionId; - private UUID gameId; - private UUID data; - - public SendPlayerUUID(Connection connection, UUID sessionId, UUID gameId, UUID data) { - super(connection, "SendPlayerUUID", SessionState.CONNECTED); - this.sessionId = sessionId; - this.gameId = gameId; - this.data = data; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.sendPlayerUUID(gameId, sessionId, data); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/StartChallenge.java b/Mage.Common/src/mage/remote/method/StartChallenge.java deleted file mode 100644 index 7fe109bd517..00000000000 --- a/Mage.Common/src/mage/remote/method/StartChallenge.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class StartChallenge extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - private UUID challengeId; - - public StartChallenge(Connection connection, UUID sessionId, UUID roomId, UUID tableId, UUID challengeId) { - super(connection, "StartChallenge", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - this.challengeId = challengeId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.startChallenge(sessionId, roomId, tableId, challengeId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/StartGame.java b/Mage.Common/src/mage/remote/method/StartGame.java deleted file mode 100644 index b16ca17078e..00000000000 --- a/Mage.Common/src/mage/remote/method/StartGame.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class StartGame extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - - public StartGame(Connection connection, UUID sessionId, UUID roomId, UUID tableId) { - super(connection, "StartGame", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.startMatch(sessionId, roomId, tableId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/StartReplay.java b/Mage.Common/src/mage/remote/method/StartReplay.java deleted file mode 100644 index 3dbdb8a0f63..00000000000 --- a/Mage.Common/src/mage/remote/method/StartReplay.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class StartReplay extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public StartReplay(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "StartReplay", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.startReplay(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/StartTournament.java b/Mage.Common/src/mage/remote/method/StartTournament.java deleted file mode 100644 index ac2011d1ef4..00000000000 --- a/Mage.Common/src/mage/remote/method/StartTournament.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class StartTournament extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - - public StartTournament(Connection connection, UUID sessionId, UUID roomId, UUID tableId) { - super(connection, "StartTournament", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.startTournament(sessionId, roomId, tableId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/StopReplay.java b/Mage.Common/src/mage/remote/method/StopReplay.java deleted file mode 100644 index cf6a055eb55..00000000000 --- a/Mage.Common/src/mage/remote/method/StopReplay.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class StopReplay extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public StopReplay(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "StopReplay", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.stopReplay(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/StopWatching.java b/Mage.Common/src/mage/remote/method/StopWatching.java deleted file mode 100644 index 31a4a6964a8..00000000000 --- a/Mage.Common/src/mage/remote/method/StopWatching.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class StopWatching extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public StopWatching(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "StopWatching", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.stopWatching(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/SubmitDeck.java b/Mage.Common/src/mage/remote/method/SubmitDeck.java deleted file mode 100644 index cc6fabb3ebb..00000000000 --- a/Mage.Common/src/mage/remote/method/SubmitDeck.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.cards.decks.DeckCardLists; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.game.GameException; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SubmitDeck extends RemoteMethodCall { - - private UUID tableId; - private UUID sessionId; - private DeckCardLists deckList; - - public SubmitDeck(Connection connection, UUID sessionId, UUID tableId, DeckCardLists deckList) { - super(connection, "SubmitDeck", SessionState.CONNECTED); - this.tableId = tableId; - this.sessionId = sessionId; - this.deckList = deckList; - } - - @Override - protected Boolean performRemoteCall(Server server) throws MageException, GameException, RemoteException { - return server.submitDeck(sessionId, tableId, deckList); - } - -} diff --git a/Mage.Common/src/mage/remote/method/SwapSeats.java b/Mage.Common/src/mage/remote/method/SwapSeats.java deleted file mode 100644 index 56339984c97..00000000000 --- a/Mage.Common/src/mage/remote/method/SwapSeats.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SwapSeats extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - private int seat1; - private int seat2; - - public SwapSeats(Connection connection, UUID sessionId, UUID roomId, UUID tableId, int seat1, int seat2) { - super(connection, "SwapSeats", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - this.seat1 = seat1; - this.seat2 = seat2; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.swapSeats(sessionId, roomId, tableId, seat1, seat2); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/WatchGame.java b/Mage.Common/src/mage/remote/method/WatchGame.java deleted file mode 100644 index 943ef580281..00000000000 --- a/Mage.Common/src/mage/remote/method/WatchGame.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ - -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class WatchGame extends RemoteMethodCall { - - private UUID gameId; - private UUID sessionId; - - public WatchGame(Connection connection, UUID sessionId, UUID gameId) { - super(connection, "WatchGame", SessionState.CONNECTED); - this.gameId = gameId; - this.sessionId = sessionId; - } - - @Override - protected Void performRemoteCall(Server server) throws RemoteException, MageException { - server.watchGame(gameId, sessionId); - return null; - } - -} diff --git a/Mage.Common/src/mage/remote/method/WatchTable.java b/Mage.Common/src/mage/remote/method/WatchTable.java deleted file mode 100644 index ab446e5e2d8..00000000000 --- a/Mage.Common/src/mage/remote/method/WatchTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -package mage.remote.method; - -import java.rmi.RemoteException; -import java.util.UUID; -import mage.MageException; -import mage.constants.Constants.SessionState; -import mage.interfaces.Server; -import mage.remote.Connection; -import mage.remote.RemoteMethodCall; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class WatchTable extends RemoteMethodCall { - - private UUID roomId; - private UUID tableId; - private UUID sessionId; - - public WatchTable(Connection connection, UUID sessionId, UUID roomId, UUID tableId) { - super(connection, "WatchTable", SessionState.CONNECTED); - this.roomId = roomId; - this.tableId = tableId; - this.sessionId = sessionId; - } - - @Override - protected Boolean performRemoteCall(Server server) throws RemoteException, MageException { - return server.watchTable(sessionId, roomId, tableId); - } - -} diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/utils/Connection.java similarity index 81% rename from Mage.Common/src/mage/remote/Connection.java rename to Mage.Common/src/mage/utils/Connection.java index c908c3b57e6..e00d78740de 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/utils/Connection.java @@ -26,11 +26,7 @@ * or implied, of BetaSteward_at_googlemail.com. */ -package mage.remote; - -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; -import mage.interfaces.Server; +package mage.utils; /** * @@ -48,35 +44,6 @@ public class Connection { private String proxyUsername; private String proxyPassword; - protected Server getServer() { - Server server = null; - try { - Registry reg = LocateRegistry.getRegistry(host, port); - server = (Server) reg.lookup("mage-server"); - } - catch (Exception ignored) {} - return server; - } - - @Override - public int hashCode() { - return (host + Integer.toString(port) + proxyType.toString()).hashCode(); - } - - @Override - public boolean equals(Object object) { - if (! (object instanceof Connection)) { - return false; - } - Connection otherConnection = (Connection) object; - return hashCode() == otherConnection.hashCode(); - } - - @Override - public String toString() { - return host + ":" + Integer.toString(port); - } - public ProxyType getProxyType() { return proxyType; } diff --git a/Mage.Server.Console/src/main/java/mage/server/console/remote/Session.java b/Mage.Server.Console/src/main/java/mage/server/console/remote/Session.java index 7f2f4fa7066..68409c4cf5f 100644 --- a/Mage.Server.Console/src/main/java/mage/server/console/remote/Session.java +++ b/Mage.Server.Console/src/main/java/mage/server/console/remote/Session.java @@ -101,10 +101,6 @@ public class Session { frame.setStatusText("Connected to " + serverName + ":" + port + " "); frame.enableButtons(); return true; - } catch (MageException ex) { - logger.fatal("", ex); - disconnect(); - JOptionPane.showMessageDialog(frame, "Unable to connect to server. " + ex.getMessage()); } catch (RemoteException ex) { logger.fatal("Unable to connect to server - ", ex); disconnect(); diff --git a/Mage.Server/src/main/java/mage/server/ChatSession.java b/Mage.Server/src/main/java/mage/server/ChatSession.java index 20cddc95cd9..8ecc32714f4 100644 --- a/Mage.Server/src/main/java/mage/server/ChatSession.java +++ b/Mage.Server/src/main/java/mage/server/ChatSession.java @@ -82,11 +82,7 @@ public class ChatSession { for (UUID sessionId: clients.keySet()) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) - try { - session.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color))); - } catch (CallbackException ex) { - logger.fatal("broadcast error", ex); - } + session.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color))); else kill(sessionId); } diff --git a/Mage.Server/src/main/java/mage/server/ServerImpl.java b/Mage.Server/src/main/java/mage/server/ServerImpl.java index 7f1f8e8be35..7b8852c4157 100644 --- a/Mage.Server/src/main/java/mage/server/ServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/ServerImpl.java @@ -38,16 +38,13 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutorService; -import java.util.logging.Level; +import mage.MageException; import mage.cards.decks.DeckCardLists; import mage.game.GameException; -import mage.MageException; -import mage.cards.decks.InvalidDeckException; import mage.game.match.MatchOptions; import mage.game.tournament.TournamentOptions; import mage.interfaces.Server; import mage.interfaces.ServerState; -import mage.interfaces.callback.CallbackException; import mage.interfaces.callback.ClientCallback; import mage.server.game.DeckValidatorFactory; import mage.server.draft.DraftManager; @@ -108,8 +105,8 @@ public class ServerImpl extends RemoteServer implements Server { } @Override - public void ack(int messageId, UUID sessionId) throws RemoteException, CallbackException { - SessionManager.getInstance().getSession(sessionId).ack(messageId); + public void ack(String message, UUID sessionId) throws RemoteException, MageException { + SessionManager.getInstance().getSession(sessionId).ack(message); } @Override @@ -212,13 +209,9 @@ public class ServerImpl extends RemoteServer implements Server { return ret; } } - catch (InvalidDeckException ex) { - throw ex; - } - catch (GameException ex) { - throw ex; - } catch (Exception ex) { + if (ex instanceof GameException) + throw (GameException)ex; handleException(ex); } return false; @@ -233,10 +226,9 @@ public class ServerImpl extends RemoteServer implements Server { return ret; } } - catch (GameException ex) { - throw ex; - } catch (Exception ex) { + if (ex instanceof GameException) + throw (GameException)ex; handleException(ex); } return false; diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index 982d9eb4118..feb81ba83ed 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -30,12 +30,7 @@ package mage.server; import java.util.Date; import java.util.UUID; -import java.util.logging.Level; import mage.cards.decks.Deck; -import mage.game.GameException; -import mage.MageException; -import mage.interfaces.callback.CallbackAck; -import mage.interfaces.callback.CallbackException; import mage.interfaces.callback.CallbackServerSession; import mage.interfaces.callback.ClientCallback; import mage.server.game.GameManager; @@ -55,12 +50,11 @@ public class Session { private String username; private String host; private int messageId = 0; + private String ackMessage; private Date timeConnected; private long lastPing; private boolean isAdmin = false; - private boolean killed = false; private final CallbackServerSession callback = new CallbackServerSession(); - private final CallbackAck ackResponse = new CallbackAck(); public Session(String userName, String host, UUID clientId) { sessionId = UUID.randomUUID(); @@ -90,10 +84,6 @@ public class Session { } public void kill() { - this.killed = true; - synchronized(ackResponse) { - ackResponse.notify(); - } SessionManager.getInstance().removeSession(sessionId); TableManager.getInstance().removeSession(sessionId); GameManager.getInstance().removeSession(sessionId); @@ -109,116 +99,55 @@ public class Session { return null; } - public synchronized void fireCallback(final ClientCallback call) throws CallbackException { + public synchronized void fireCallback(final ClientCallback call) { call.setMessageId(messageId++); if (logger.isDebugEnabled()) logger.debug(sessionId + " - " + call.getMessageId() + " - " + call.getMethod()); try { - int retryCount = 0; - while (retryCount < 3) { - callback.setCallback(call); - if (waitForAck(call.getMessageId())) - return; - retryCount++; - try { - Thread.sleep(2000 * retryCount); - } - catch (InterruptedException ignored) {} - } + callback.setCallback(call); } catch (InterruptedException ex) { logger.fatal("Session fireCallback error", ex); } - throw new CallbackException("Callback failed for " + call.getMethod()); - } - - protected boolean waitForAck(int messageId) { - ackResponse.clear(); - if (logger.isDebugEnabled()) - logger.debug(sessionId + " - waiting for ack: " + messageId); - synchronized(ackResponse) { - try { - if (!ackResponse.isAck()) - ackResponse.wait(10000); - if (logger.isDebugEnabled()) { - if (!ackResponse.isAck()) - logger.debug(sessionId + " - ack timed out waiting for " + messageId); - else - logger.debug(sessionId + " - ack received: " + messageId); - } - return ackResponse.getValue() == messageId; - } catch (InterruptedException ex) { } - } - return false; } - public void gameStarted(final UUID gameId, final UUID playerId) throws GameException { - try { - fireCallback(new ClientCallback("startGame", gameId, new TableClientMessage(gameId, playerId))); - } catch (CallbackException ex) { - logger.fatal("gameStarted exception", ex); - throw new GameException("callback failed"); - } + public void gameStarted(final UUID gameId, final UUID playerId) { + fireCallback(new ClientCallback("startGame", gameId, new TableClientMessage(gameId, playerId))); } - public void draftStarted(final UUID draftId, final UUID playerId) throws MageException { - try { - fireCallback(new ClientCallback("startDraft", draftId, new TableClientMessage(draftId, playerId))); - } catch (CallbackException ex) { - logger.fatal("draftStarted exception", ex); - throw new MageException("callback failed"); - } + public void draftStarted(final UUID draftId, final UUID playerId) { + fireCallback(new ClientCallback("startDraft", draftId, new TableClientMessage(draftId, playerId))); } - public void tournamentStarted(final UUID tournamentId, final UUID playerId) throws MageException { - try { - fireCallback(new ClientCallback("startTournament", tournamentId, new TableClientMessage(tournamentId, playerId))); - } catch (CallbackException ex) { - logger.fatal("tournamentStarted exception", ex); - throw new MageException("callback failed"); - } + public void tournamentStarted(final UUID tournamentId, final UUID playerId) { + fireCallback(new ClientCallback("startTournament", tournamentId, new TableClientMessage(tournamentId, playerId))); } - public void sideboard(final Deck deck, final UUID tableId, final int time) throws MageException { - try { - fireCallback(new ClientCallback("sideboard", tableId, new TableClientMessage(deck, tableId, time))); - } catch (CallbackException ex) { - logger.fatal("sideboard exception", ex); - throw new MageException("callback failed"); - } + public void sideboard(final Deck deck, final UUID tableId, final int time) { + fireCallback(new ClientCallback("sideboard", tableId, new TableClientMessage(deck, tableId, time))); } - public void construct(final Deck deck, final UUID tableId, final int time) throws MageException { - try { - fireCallback(new ClientCallback("construct", tableId, new TableClientMessage(deck, tableId, time))); - } catch (CallbackException ex) { - logger.fatal("construct exception", ex); - throw new MageException("callback failed"); - } + public void construct(final Deck deck, final UUID tableId, final int time) { + fireCallback(new ClientCallback("construct", tableId, new TableClientMessage(deck, tableId, time))); } - public void watchGame(final UUID gameId) throws MageException { - try { - fireCallback(new ClientCallback("watchGame", gameId)); - } catch (CallbackException ex) { - logger.fatal("watchGame exception", ex); - throw new MageException("callback failed"); - } + public void watchGame(final UUID gameId) { + fireCallback(new ClientCallback("watchGame", gameId)); } public void replayGame(final UUID gameId) { - try { - fireCallback(new ClientCallback("replayGame", gameId)); - } catch (CallbackException ex) { - logger.fatal("replayGame exception", ex); - } + fireCallback(new ClientCallback("replayGame", gameId)); } - public void ack(int messageId) { - synchronized(ackResponse) { - ackResponse.setAck(true); - ackResponse.setValue(messageId); - ackResponse.notify(); - } + public void ack(String message) { + this.ackMessage = message; + } + + public String getAckMessage() { + return ackMessage; + } + + public void clearAck() { + this.ackMessage = ""; } public String getUsername() { diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index 463f7b2db02..59855cd257f 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -209,13 +209,8 @@ public class TableController { if (table.getState() != TableState.DUELING) { return false; } - try { - SessionManager.getInstance().getSession(sessionId).watchGame(match.getGame().getId()); - return true; - } catch (MageException ex) { - logger.fatal("watchTable error", ex); - } - return false; + SessionManager.getInstance().getSession(sessionId).watchGame(match.getGame().getId()); + return true; } public boolean replayTable(UUID sessionId) { @@ -341,12 +336,8 @@ public class TableController { table.initDraft(); DraftManager.getInstance().createDraftSession(draft, sessionPlayerMap, table.getId()); SessionManager sessionManager = SessionManager.getInstance(); - try { - for (Entry entry: sessionPlayerMap.entrySet()) { - sessionManager.getSession(entry.getKey()).draftStarted(draft.getId(), entry.getValue()); - } - } catch (MageException ex) { - logger.fatal("startDraft error", ex); + for (Entry entry: sessionPlayerMap.entrySet()) { + sessionManager.getSession(entry.getKey()).draftStarted(draft.getId(), entry.getValue()); } } diff --git a/Mage.Server/src/main/java/mage/server/draft/DraftSession.java b/Mage.Server/src/main/java/mage/server/draft/DraftSession.java index 7d2630ab5bb..ebbb207833b 100644 --- a/Mage.Server/src/main/java/mage/server/draft/DraftSession.java +++ b/Mage.Server/src/main/java/mage/server/draft/DraftSession.java @@ -72,13 +72,8 @@ public class DraftSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("draftInit", draft.getId(), draftView)); - return true; - } catch (CallbackException ex) { - logger.fatal("Unable to start draft ", ex); - return false; - } + session.fireCallback(new ClientCallback("draftInit", draft.getId(), draftView)); + return true; } } return false; @@ -96,11 +91,7 @@ public class DraftSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("draftUpdate", draft.getId(), draftView)); - } catch (CallbackException ex) { - logger.fatal("update draft exception", ex); - } + session.fireCallback(new ClientCallback("draftUpdate", draft.getId(), draftView)); } } } @@ -109,11 +100,7 @@ public class DraftSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("draftInform", draft.getId(), new DraftClientMessage(draftView, message))); - } catch (CallbackException ex) { - logger.fatal("draft inform exception", ex); - } + session.fireCallback(new ClientCallback("draftInform", draft.getId(), new DraftClientMessage(draftView, message))); } } } @@ -122,11 +109,7 @@ public class DraftSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("draftOver", draft.getId())); - } catch (CallbackException ex) { - logger.fatal("draft end exception", ex); - } + session.fireCallback(new ClientCallback("draftOver", draft.getId())); } } } @@ -136,11 +119,7 @@ public class DraftSession { setupTimeout(timeout); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("draftPick", draft.getId(), new DraftClientMessage(draftPickView))); - } catch (CallbackException ex) { - logger.fatal("draft pick exception", ex); - } + session.fireCallback(new ClientCallback("draftPick", draft.getId(), new DraftClientMessage(draftPickView))); } } } diff --git a/Mage.Server/src/main/java/mage/server/game/GameSession.java b/Mage.Server/src/main/java/mage/server/game/GameSession.java index 550bbcc832d..1e1255189f6 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameSession.java +++ b/Mage.Server/src/main/java/mage/server/game/GameSession.java @@ -71,11 +71,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameAsk", game.getId(), new GameClientMessage(gameView, question))); - } catch (CallbackException ex) { - logger.fatal("game ask exception", ex); - } + session.fireCallback(new ClientCallback("gameAsk", game.getId(), new GameClientMessage(gameView, question))); } } } @@ -85,11 +81,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameTarget", game.getId(), new GameClientMessage(gameView, question, cardView, targets, required, options))); - } catch (CallbackException ex) { - logger.fatal("game target exception", ex); - } + session.fireCallback(new ClientCallback("gameTarget", game.getId(), new GameClientMessage(gameView, question, cardView, targets, required, options))); } } } @@ -99,11 +91,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameSelect", game.getId(), new GameClientMessage(gameView, message))); - } catch (CallbackException ex) { - logger.fatal("game select exception", ex); - } + session.fireCallback(new ClientCallback("gameSelect", game.getId(), new GameClientMessage(gameView, message))); } } } @@ -113,11 +101,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameChooseAbility", game.getId(), abilities)); - } catch (CallbackException ex) { - logger.fatal("game choose ability exception", ex); - } + session.fireCallback(new ClientCallback("gameChooseAbility", game.getId(), abilities)); } } } @@ -127,11 +111,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameChoose", game.getId(), new GameClientMessage(choices.toArray(new String[0]), message))); - } catch (CallbackException ex) { - logger.fatal("game choose exception", ex); - } + session.fireCallback(new ClientCallback("gameChoose", game.getId(), new GameClientMessage(choices.toArray(new String[0]), message))); } } } @@ -141,11 +121,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gamePlayMana", game.getId(), new GameClientMessage(gameView, message))); - } catch (CallbackException ex) { - logger.fatal("game play mana exception", ex); - } + session.fireCallback(new ClientCallback("gamePlayMana", game.getId(), new GameClientMessage(gameView, message))); } } } @@ -155,11 +131,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gamePlayXMana", game.getId(), new GameClientMessage(gameView, message))); - } catch (CallbackException ex) { - logger.fatal("game play x mana exception", ex); - } + session.fireCallback(new ClientCallback("gamePlayXMana", game.getId(), new GameClientMessage(gameView, message))); } } } @@ -169,11 +141,7 @@ public class GameSession extends GameWatcher { setupTimeout(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameSelectAmount", game.getId(), new GameClientMessage(message, min, max))); - } catch (CallbackException ex) { - logger.fatal("game select amount exception", ex); - } + session.fireCallback(new ClientCallback("gameSelectAmount", game.getId(), new GameClientMessage(message, min, max))); } } } @@ -182,11 +150,7 @@ public class GameSession extends GameWatcher { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameReveal", game.getId(), new GameClientMessage(cardView, name))); - } catch (CallbackException ex) { - logger.fatal("game reveal exception", ex); - } + session.fireCallback(new ClientCallback("gameReveal", game.getId(), new GameClientMessage(cardView, name))); } } } diff --git a/Mage.Server/src/main/java/mage/server/game/GameWatcher.java b/Mage.Server/src/main/java/mage/server/game/GameWatcher.java index 3fd5bbd08ec..872f73dbbd2 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameWatcher.java +++ b/Mage.Server/src/main/java/mage/server/game/GameWatcher.java @@ -61,13 +61,8 @@ public class GameWatcher { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameInit", gameId, gameView)); - return true; - } catch (CallbackException ex) { - logger.fatal("Unable to start watching ", ex); - return false; - } + session.fireCallback(new ClientCallback("gameInit", gameId, gameView)); + return true; } } return false; @@ -77,11 +72,7 @@ public class GameWatcher { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameUpdate", gameId, gameView)); - } catch (CallbackException ex) { - logger.fatal("game update exception", ex); - } + session.fireCallback(new ClientCallback("gameUpdate", gameId, gameView)); } } } @@ -90,11 +81,7 @@ public class GameWatcher { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameInform", gameId, new GameClientMessage(gameView, message))); - } catch (CallbackException ex) { - logger.fatal("game inform exception", ex); - } + session.fireCallback(new ClientCallback("gameInform", gameId, new GameClientMessage(gameView, message))); } } } @@ -103,11 +90,7 @@ public class GameWatcher { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("gameOver", gameId, message)); - } catch (CallbackException ex) { - logger.fatal("game select exception", ex); - } + session.fireCallback(new ClientCallback("gameOver", gameId, message)); } } } diff --git a/Mage.Server/src/main/java/mage/server/game/ReplaySession.java b/Mage.Server/src/main/java/mage/server/game/ReplaySession.java index 15af8d48b64..7b24aaf0925 100644 --- a/Mage.Server/src/main/java/mage/server/game/ReplaySession.java +++ b/Mage.Server/src/main/java/mage/server/game/ReplaySession.java @@ -58,11 +58,7 @@ public class ReplaySession implements GameCallback { replay.start(); Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("replayInit", replay.getGame().getId(), new GameView(replay.next(), replay.getGame()))); - } catch (CallbackException ex) { - logger.fatal("replay init exception", ex); - } + session.fireCallback(new ClientCallback("replayInit", replay.getGame().getId(), new GameView(replay.next(), replay.getGame()))); } } @@ -82,11 +78,7 @@ public class ReplaySession implements GameCallback { public void gameResult(final String result) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("replayDone", replay.getGame().getId(), result)); - } catch (CallbackException ex) { - logger.fatal("replay done exception", ex); - } + session.fireCallback(new ClientCallback("replayDone", replay.getGame().getId(), result)); } } @@ -97,11 +89,7 @@ public class ReplaySession implements GameCallback { else { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("replayUpdate", replay.getGame().getId(), new GameView(state, game))); - } catch (CallbackException ex) { - logger.fatal("replay update exception", ex); - } + session.fireCallback(new ClientCallback("replayUpdate", replay.getGame().getId(), new GameView(state, game))); } } } diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentSession.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentSession.java index 68bc794437b..20f317407a9 100644 --- a/Mage.Server/src/main/java/mage/server/tournament/TournamentSession.java +++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentSession.java @@ -72,12 +72,8 @@ public class TournamentSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("tournamentInit", tournament.getId(), tournamentView)); - return true; - } catch (CallbackException ex) { - logger.fatal("Unable to start tournament", ex); - } + session.fireCallback(new ClientCallback("tournamentInit", tournament.getId(), tournamentView)); + return true; } } return false; @@ -95,11 +91,7 @@ public class TournamentSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("tournamentUpdate", tournament.getId(), tournamentView)); - } catch (CallbackException ex) { - logger.fatal("tournament update error", ex); - } + session.fireCallback(new ClientCallback("tournamentUpdate", tournament.getId(), tournamentView)); } } } @@ -108,11 +100,7 @@ public class TournamentSession { if (!killed) { Session session = SessionManager.getInstance().getSession(sessionId); if (session != null) { - try { - session.fireCallback(new ClientCallback("tournamentOver", tournament.getId(), message)); - } catch (CallbackException ex) { - logger.fatal("tournament over error", ex); - } + session.fireCallback(new ClientCallback("tournamentOver", tournament.getId(), message)); } } }