diff --git a/src/main/java/com/threerings/micasa/lobby/LobbyDispatcher.java b/src/main/java/com/threerings/micasa/lobby/LobbyDispatcher.java deleted file mode 100644 index a565e73e..00000000 --- a/src/main/java/com/threerings/micasa/lobby/LobbyDispatcher.java +++ /dev/null @@ -1,75 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.micasa.lobby; - -import javax.annotation.Generated; - -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; - -/** - * Dispatches requests to the {@link LobbyProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from LobbyService.java.") -public class LobbyDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public LobbyDispatcher (LobbyProvider provider) - { - this.provider = provider; - } - - @Override - public LobbyMarshaller createMarshaller () - { - return new LobbyMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case LobbyMarshaller.GET_CATEGORIES: - ((LobbyProvider)provider).getCategories( - source, (LobbyService.CategoriesListener)args[0] - ); - return; - - case LobbyMarshaller.GET_LOBBIES: - ((LobbyProvider)provider).getLobbies( - source, (String)args[0], (LobbyService.LobbiesListener)args[1] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/micasa/lobby/LobbyRegistry.java b/src/main/java/com/threerings/micasa/lobby/LobbyRegistry.java index c2932058..57dfc707 100644 --- a/src/main/java/com/threerings/micasa/lobby/LobbyRegistry.java +++ b/src/main/java/com/threerings/micasa/lobby/LobbyRegistry.java @@ -42,6 +42,7 @@ import com.threerings.presents.server.InvocationManager; import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.server.PlaceRegistry; +import com.threerings.micasa.lobby.LobbyMarshaller; import com.threerings.micasa.lobby.LobbyService.CategoriesListener; import com.threerings.micasa.lobby.LobbyService.LobbiesListener; import com.threerings.micasa.server.MiCasaConfig; @@ -100,7 +101,7 @@ public class LobbyRegistry @Inject public LobbyRegistry (InvocationManager invmgr) { // register ourselves as an invocation service handler - invmgr.registerDispatcher(new LobbyDispatcher(this), InvocationCodes.GLOBAL_GROUP); + invmgr.registerProvider(this, LobbyMarshaller.class, InvocationCodes.GLOBAL_GROUP); } /** diff --git a/src/main/java/com/threerings/micasa/simulator/server/SimulatorDispatcher.java b/src/main/java/com/threerings/micasa/simulator/server/SimulatorDispatcher.java deleted file mode 100644 index 285c04c0..00000000 --- a/src/main/java/com/threerings/micasa/simulator/server/SimulatorDispatcher.java +++ /dev/null @@ -1,71 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.micasa.simulator.server; - -import javax.annotation.Generated; - -import com.threerings.micasa.simulator.data.SimulatorMarshaller; -import com.threerings.parlor.game.data.GameConfig; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; - -/** - * Dispatches requests to the {@link SimulatorProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from SimulatorService.java.") -public class SimulatorDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public SimulatorDispatcher (SimulatorProvider provider) - { - this.provider = provider; - } - - @Override - public SimulatorMarshaller createMarshaller () - { - return new SimulatorMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case SimulatorMarshaller.CREATE_GAME: - ((SimulatorProvider)provider).createGame( - source, (GameConfig)args[0], (String)args[1], ((Integer)args[2]).intValue() - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/micasa/simulator/server/SimulatorManager.java b/src/main/java/com/threerings/micasa/simulator/server/SimulatorManager.java index c50d211a..ce88b861 100644 --- a/src/main/java/com/threerings/micasa/simulator/server/SimulatorManager.java +++ b/src/main/java/com/threerings/micasa/simulator/server/SimulatorManager.java @@ -27,6 +27,7 @@ import com.google.common.collect.Lists; import com.google.inject.Inject; import com.google.inject.Singleton; +import com.threerings.micasa.simulator.data.SimulatorMarshaller; import com.threerings.util.Name; import com.threerings.presents.data.ClientObject; @@ -57,7 +58,7 @@ public class SimulatorManager { // register our simulator provider SimulatorProvider sprov = new SimulatorProvider(this); - invmgr.registerDispatcher(new SimulatorDispatcher(sprov), InvocationCodes.GLOBAL_GROUP); + invmgr.registerProvider(sprov, SimulatorMarshaller.class, InvocationCodes.GLOBAL_GROUP); } /** diff --git a/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameDispatcher.java b/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameDispatcher.java deleted file mode 100644 index 13d0ba13..00000000 --- a/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameDispatcher.java +++ /dev/null @@ -1,83 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.parlor.card.trick.server; - -import javax.annotation.Generated; - -import com.threerings.parlor.card.data.Card; -import com.threerings.parlor.card.trick.data.TrickCardGameMarshaller; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; - -/** - * Dispatches requests to the {@link TrickCardGameProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from TrickCardGameService.java.") -public class TrickCardGameDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public TrickCardGameDispatcher (TrickCardGameProvider provider) - { - this.provider = provider; - } - - @Override - public TrickCardGameMarshaller createMarshaller () - { - return new TrickCardGameMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case TrickCardGameMarshaller.PLAY_CARD: - ((TrickCardGameProvider)provider).playCard( - source, (Card)args[0], ((Integer)args[1]).intValue() - ); - return; - - case TrickCardGameMarshaller.REQUEST_REMATCH: - ((TrickCardGameProvider)provider).requestRematch( - source - ); - return; - - case TrickCardGameMarshaller.SEND_CARDS_TO_PLAYER: - ((TrickCardGameProvider)provider).sendCardsToPlayer( - source, ((Integer)args[0]).intValue(), (Card[])args[1] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java b/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java index 943addc3..9182e79f 100644 --- a/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java +++ b/src/main/java/com/threerings/parlor/card/trick/server/TrickCardGameManagerDelegate.java @@ -47,6 +47,7 @@ import com.threerings.parlor.card.data.Deck; import com.threerings.parlor.card.data.Hand; import com.threerings.parlor.card.data.PlayerCard; import com.threerings.parlor.card.server.CardGameManager; +import com.threerings.parlor.card.trick.data.TrickCardGameMarshaller; import com.threerings.parlor.card.trick.data.TrickCardGameObject; import com.threerings.parlor.turn.server.TurnGameManagerDelegate; @@ -105,7 +106,7 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate _deck = new Deck(); _trickCardGame = (TrickCardGameObject)plobj; _cardGame = (CardGameObject)plobj; - _trickCardGame.setTrickCardGameService(addDispatcher(new TrickCardGameDispatcher(this))); + _trickCardGame.setTrickCardGameService(addProvider(this, TrickCardGameMarshaller.class)); } @Override diff --git a/src/main/java/com/threerings/parlor/server/ParlorDispatcher.java b/src/main/java/com/threerings/parlor/server/ParlorDispatcher.java deleted file mode 100644 index e1b093dc..00000000 --- a/src/main/java/com/threerings/parlor/server/ParlorDispatcher.java +++ /dev/null @@ -1,92 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.parlor.server; - -import javax.annotation.Generated; - -import com.threerings.parlor.client.ParlorService; -import com.threerings.parlor.data.ParlorMarshaller; -import com.threerings.parlor.game.data.GameConfig; -import com.threerings.presents.client.InvocationService; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.util.Name; - -/** - * Dispatches requests to the {@link ParlorProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from ParlorService.java.") -public class ParlorDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public ParlorDispatcher (ParlorProvider provider) - { - this.provider = provider; - } - - @Override - public ParlorMarshaller createMarshaller () - { - return new ParlorMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case ParlorMarshaller.CANCEL: - ((ParlorProvider)provider).cancel( - source, ((Integer)args[0]).intValue(), (InvocationService.InvocationListener)args[1] - ); - return; - - case ParlorMarshaller.INVITE: - ((ParlorProvider)provider).invite( - source, (Name)args[0], (GameConfig)args[1], (ParlorService.InviteListener)args[2] - ); - return; - - case ParlorMarshaller.RESPOND: - ((ParlorProvider)provider).respond( - source, ((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), args[2], (InvocationService.InvocationListener)args[3] - ); - return; - - case ParlorMarshaller.START_SOLITAIRE: - ((ParlorProvider)provider).startSolitaire( - source, (GameConfig)args[0], (InvocationService.ConfirmListener)args[1] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/parlor/server/ParlorManager.java b/src/main/java/com/threerings/parlor/server/ParlorManager.java index 0188e3b2..ddb3cc0d 100644 --- a/src/main/java/com/threerings/parlor/server/ParlorManager.java +++ b/src/main/java/com/threerings/parlor/server/ParlorManager.java @@ -38,6 +38,7 @@ import com.threerings.crowd.server.PlaceRegistry; import com.threerings.parlor.client.ParlorService; import com.threerings.parlor.data.ParlorCodes; +import com.threerings.parlor.data.ParlorMarshaller; import com.threerings.parlor.game.data.GameConfig; import static com.threerings.parlor.Log.log; @@ -53,7 +54,7 @@ public class ParlorManager { @Inject public ParlorManager (InvocationManager invmgr) { - invmgr.registerDispatcher(new ParlorDispatcher(this), PARLOR_GROUP); + invmgr.registerProvider(this, ParlorMarshaller.class, PARLOR_GROUP); } // from interface ParlorProvider diff --git a/src/main/java/com/threerings/parlor/server/TableDispatcher.java b/src/main/java/com/threerings/parlor/server/TableDispatcher.java deleted file mode 100644 index 1c9d388f..00000000 --- a/src/main/java/com/threerings/parlor/server/TableDispatcher.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.parlor.server; - -import javax.annotation.Generated; - -import com.threerings.parlor.data.TableConfig; -import com.threerings.parlor.data.TableMarshaller; -import com.threerings.parlor.game.data.GameConfig; -import com.threerings.presents.client.InvocationService; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.util.Name; - -/** - * Dispatches requests to the {@link TableProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from TableService.java.") -public class TableDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public TableDispatcher (TableProvider provider) - { - this.provider = provider; - } - - @Override - public TableMarshaller createMarshaller () - { - return new TableMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case TableMarshaller.BOOT_PLAYER: - ((TableProvider)provider).bootPlayer( - source, ((Integer)args[0]).intValue(), (Name)args[1], (InvocationService.InvocationListener)args[2] - ); - return; - - case TableMarshaller.CREATE_TABLE: - ((TableProvider)provider).createTable( - source, (TableConfig)args[0], (GameConfig)args[1], (InvocationService.ResultListener)args[2] - ); - return; - - case TableMarshaller.JOIN_TABLE: - ((TableProvider)provider).joinTable( - source, ((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), (InvocationService.InvocationListener)args[2] - ); - return; - - case TableMarshaller.LEAVE_TABLE: - ((TableProvider)provider).leaveTable( - source, ((Integer)args[0]).intValue(), (InvocationService.InvocationListener)args[1] - ); - return; - - case TableMarshaller.START_TABLE_NOW: - ((TableProvider)provider).startTableNow( - source, ((Integer)args[0]).intValue(), (InvocationService.InvocationListener)args[1] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/parlor/server/TableManager.java b/src/main/java/com/threerings/parlor/server/TableManager.java index ece5cf45..efb4e77e 100644 --- a/src/main/java/com/threerings/parlor/server/TableManager.java +++ b/src/main/java/com/threerings/parlor/server/TableManager.java @@ -54,6 +54,7 @@ import com.threerings.parlor.data.ParlorCodes; import com.threerings.parlor.data.Table; import com.threerings.parlor.data.TableConfig; import com.threerings.parlor.data.TableLobbyObject; +import com.threerings.parlor.data.TableMarshaller; import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.game.data.GameObject; import com.threerings.parlor.game.server.GameManager; @@ -92,7 +93,7 @@ public class TableManager // set up our object references _tlobj = (TableLobbyObject)tableObject; - _tlobj.setTableService(_invmgr.registerDispatcher(new TableDispatcher(this))); + _tlobj.setTableService(_invmgr.registerProvider(this, TableMarshaller.class)); _dobj = tableObject; // if our table is in a "place" add ourselves as a listener so that we can tell if a user diff --git a/src/main/java/com/threerings/parlor/tourney/server/TourneyDispatcher.java b/src/main/java/com/threerings/parlor/tourney/server/TourneyDispatcher.java deleted file mode 100644 index 6a0f0e5b..00000000 --- a/src/main/java/com/threerings/parlor/tourney/server/TourneyDispatcher.java +++ /dev/null @@ -1,83 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.parlor.tourney.server; - -import javax.annotation.Generated; - -import com.threerings.parlor.tourney.data.TourneyMarshaller; -import com.threerings.presents.client.InvocationService; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; - -/** - * Dispatches requests to the {@link TourneyProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from TourneyService.java.") -public class TourneyDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public TourneyDispatcher (TourneyProvider provider) - { - this.provider = provider; - } - - @Override - public TourneyMarshaller createMarshaller () - { - return new TourneyMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case TourneyMarshaller.CANCEL: - ((TourneyProvider)provider).cancel( - source, (InvocationService.ConfirmListener)args[0] - ); - return; - - case TourneyMarshaller.JOIN: - ((TourneyProvider)provider).join( - source, (InvocationService.ConfirmListener)args[0] - ); - return; - - case TourneyMarshaller.LEAVE: - ((TourneyProvider)provider).leave( - source, (InvocationService.ConfirmListener)args[0] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/parlor/tourney/server/TourneyManager.java b/src/main/java/com/threerings/parlor/tourney/server/TourneyManager.java index 6ef6cfdb..920c8648 100644 --- a/src/main/java/com/threerings/parlor/tourney/server/TourneyManager.java +++ b/src/main/java/com/threerings/parlor/tourney/server/TourneyManager.java @@ -38,6 +38,7 @@ import com.threerings.crowd.server.BodyLocator; import com.threerings.parlor.tourney.data.Participant; import com.threerings.parlor.tourney.data.TourneyCodes; import com.threerings.parlor.tourney.data.TourneyConfig; +import com.threerings.parlor.tourney.data.TourneyMarshaller; import com.threerings.parlor.tourney.data.TourneyObject; /** @@ -58,7 +59,7 @@ public abstract class TourneyManager // creare and configure our Tourney object _trobj = _omgr.registerObject(new TourneyObject()); - _trobj.setTourneyService(_invmgr.registerDispatcher(new TourneyDispatcher(this))); + _trobj.setTourneyService(_invmgr.registerProvider(this, TourneyMarshaller.class)); _trobj.config = config; diff --git a/src/main/java/com/threerings/parlor/tourney/server/TourniesDispatcher.java b/src/main/java/com/threerings/parlor/tourney/server/TourniesDispatcher.java deleted file mode 100644 index 1d0a8f60..00000000 --- a/src/main/java/com/threerings/parlor/tourney/server/TourniesDispatcher.java +++ /dev/null @@ -1,72 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.parlor.tourney.server; - -import javax.annotation.Generated; - -import com.threerings.parlor.tourney.data.TourneyConfig; -import com.threerings.parlor.tourney.data.TourniesMarshaller; -import com.threerings.presents.client.InvocationService; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; - -/** - * Dispatches requests to the {@link TourniesProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from TourniesService.java.") -public class TourniesDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public TourniesDispatcher (TourniesProvider provider) - { - this.provider = provider; - } - - @Override - public TourniesMarshaller createMarshaller () - { - return new TourniesMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case TourniesMarshaller.CREATE_TOURNEY: - ((TourniesProvider)provider).createTourney( - source, (TourneyConfig)args[0], (InvocationService.ResultListener)args[1] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/puzzle/server/PuzzleGameDispatcher.java b/src/main/java/com/threerings/puzzle/server/PuzzleGameDispatcher.java deleted file mode 100644 index e538b067..00000000 --- a/src/main/java/com/threerings/puzzle/server/PuzzleGameDispatcher.java +++ /dev/null @@ -1,77 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.puzzle.server; - -import javax.annotation.Generated; - -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.puzzle.data.Board; -import com.threerings.puzzle.data.PuzzleGameMarshaller; - -/** - * Dispatches requests to the {@link PuzzleGameProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from PuzzleGameService.java.") -public class PuzzleGameDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public PuzzleGameDispatcher (PuzzleGameProvider provider) - { - this.provider = provider; - } - - @Override - public PuzzleGameMarshaller createMarshaller () - { - return new PuzzleGameMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case PuzzleGameMarshaller.UPDATE_PROGRESS: - ((PuzzleGameProvider)provider).updateProgress( - source, ((Integer)args[0]).intValue(), (int[])args[1] - ); - return; - - case PuzzleGameMarshaller.UPDATE_PROGRESS_SYNC: - ((PuzzleGameProvider)provider).updateProgressSync( - source, ((Integer)args[0]).intValue(), (int[])args[1], (Board[])args[2] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/puzzle/server/PuzzleManager.java b/src/main/java/com/threerings/puzzle/server/PuzzleManager.java index 6720d140..69e41cd6 100644 --- a/src/main/java/com/threerings/puzzle/server/PuzzleManager.java +++ b/src/main/java/com/threerings/puzzle/server/PuzzleManager.java @@ -34,6 +34,7 @@ import com.threerings.parlor.game.server.GameManager; import com.threerings.puzzle.data.Board; import com.threerings.puzzle.data.BoardSummary; import com.threerings.puzzle.data.PuzzleCodes; +import com.threerings.puzzle.data.PuzzleGameMarshaller; import com.threerings.puzzle.data.PuzzleObject; import static com.threerings.puzzle.Log.log; @@ -157,7 +158,7 @@ public abstract class PuzzleManager extends GameManager _puzobj = (PuzzleObject)_gameobj; // create and fill in our game service object - _puzobj.setPuzzleGameService(addDispatcher(new PuzzleGameDispatcher(this))); + _puzobj.setPuzzleGameService(addProvider(this, PuzzleGameMarshaller.class)); } @Override diff --git a/src/main/java/com/threerings/stage/server/StageSceneDispatcher.java b/src/main/java/com/threerings/stage/server/StageSceneDispatcher.java deleted file mode 100644 index 2160a5e3..00000000 --- a/src/main/java/com/threerings/stage/server/StageSceneDispatcher.java +++ /dev/null @@ -1,78 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.stage.server; - -import javax.annotation.Generated; - -import com.threerings.miso.data.ObjectInfo; -import com.threerings.presents.client.InvocationService; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.stage.data.StageSceneMarshaller; - -/** - * Dispatches requests to the {@link StageSceneProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from StageSceneService.java.") -public class StageSceneDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public StageSceneDispatcher (StageSceneProvider provider) - { - this.provider = provider; - } - - @Override - public StageSceneMarshaller createMarshaller () - { - return new StageSceneMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case StageSceneMarshaller.ADD_OBJECT: - ((StageSceneProvider)provider).addObject( - source, (ObjectInfo)args[0], (InvocationService.ConfirmListener)args[1] - ); - return; - - case StageSceneMarshaller.REMOVE_OBJECTS: - ((StageSceneProvider)provider).removeObjects( - source, (ObjectInfo[])args[0], (InvocationService.ConfirmListener)args[1] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/stage/server/StageSceneManager.java b/src/main/java/com/threerings/stage/server/StageSceneManager.java index 6e9880ee..c5a6dede 100644 --- a/src/main/java/com/threerings/stage/server/StageSceneManager.java +++ b/src/main/java/com/threerings/stage/server/StageSceneManager.java @@ -63,6 +63,7 @@ import com.threerings.stage.data.StageLocation; import com.threerings.stage.data.StageMisoSceneModel; import com.threerings.stage.data.StageOccupantInfo; import com.threerings.stage.data.StageScene; +import com.threerings.stage.data.StageSceneMarshaller; import com.threerings.stage.data.StageSceneModel; import com.threerings.stage.data.StageSceneObject; import com.threerings.stage.util.StageSceneUtil; @@ -257,7 +258,7 @@ public class StageSceneManager extends SpotSceneManager _ssobj = (StageSceneObject)_plobj; // register and fill in our stage scene service - _ssobj.setStageSceneService(addDispatcher(new StageSceneDispatcher(this))); + _ssobj.setStageSceneService(addProvider(this, StageSceneMarshaller.class)); } @Override diff --git a/src/main/java/com/threerings/whirled/server/SceneDispatcher.java b/src/main/java/com/threerings/whirled/server/SceneDispatcher.java deleted file mode 100644 index 0bd3db7a..00000000 --- a/src/main/java/com/threerings/whirled/server/SceneDispatcher.java +++ /dev/null @@ -1,71 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.whirled.server; - -import javax.annotation.Generated; - -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.whirled.client.SceneService; -import com.threerings.whirled.data.SceneMarshaller; - -/** - * Dispatches requests to the {@link SceneProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from SceneService.java.") -public class SceneDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public SceneDispatcher (SceneProvider provider) - { - this.provider = provider; - } - - @Override - public SceneMarshaller createMarshaller () - { - return new SceneMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case SceneMarshaller.MOVE_TO: - ((SceneProvider)provider).moveTo( - source, ((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), (SceneService.SceneMoveListener)args[2] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/whirled/server/SceneRegistry.java b/src/main/java/com/threerings/whirled/server/SceneRegistry.java index 62bc1c8c..1bb2f1fe 100644 --- a/src/main/java/com/threerings/whirled/server/SceneRegistry.java +++ b/src/main/java/com/threerings/whirled/server/SceneRegistry.java @@ -48,6 +48,7 @@ import com.threerings.crowd.server.PlaceRegistry; import com.threerings.whirled.client.SceneService; import com.threerings.whirled.data.Scene; import com.threerings.whirled.data.SceneCodes; +import com.threerings.whirled.data.SceneMarshaller; import com.threerings.whirled.data.SceneModel; import com.threerings.whirled.server.persist.SceneRepository; import com.threerings.whirled.util.NoSuchSceneException; @@ -110,7 +111,7 @@ public class SceneRegistry @Inject public SceneRegistry (InvocationManager invmgr) { // register our scene service - invmgr.registerDispatcher(new SceneDispatcher(this), SceneCodes.WHIRLED_GROUP); + invmgr.registerProvider(this, SceneMarshaller.class, SceneCodes.WHIRLED_GROUP); } /** diff --git a/src/main/java/com/threerings/whirled/spot/server/SpotDispatcher.java b/src/main/java/com/threerings/whirled/spot/server/SpotDispatcher.java deleted file mode 100644 index 83229c53..00000000 --- a/src/main/java/com/threerings/whirled/spot/server/SpotDispatcher.java +++ /dev/null @@ -1,91 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.whirled.spot.server; - -import javax.annotation.Generated; - -import com.threerings.presents.client.InvocationService; -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.whirled.spot.client.SpotService; -import com.threerings.whirled.spot.data.Location; -import com.threerings.whirled.spot.data.SpotMarshaller; - -/** - * Dispatches requests to the {@link SpotProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from SpotService.java.") -public class SpotDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public SpotDispatcher (SpotProvider provider) - { - this.provider = provider; - } - - @Override - public SpotMarshaller createMarshaller () - { - return new SpotMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case SpotMarshaller.CHANGE_LOCATION: - ((SpotProvider)provider).changeLocation( - source, ((Integer)args[0]).intValue(), (Location)args[1], (InvocationService.ConfirmListener)args[2] - ); - return; - - case SpotMarshaller.CLUSTER_SPEAK: - ((SpotProvider)provider).clusterSpeak( - source, (String)args[0], ((Byte)args[1]).byteValue() - ); - return; - - case SpotMarshaller.JOIN_CLUSTER: - ((SpotProvider)provider).joinCluster( - source, ((Integer)args[0]).intValue(), (InvocationService.ConfirmListener)args[1] - ); - return; - - case SpotMarshaller.TRAVERSE_PORTAL: - ((SpotProvider)provider).traversePortal( - source, ((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), ((Integer)args[2]).intValue(), (SpotService.SpotSceneMoveListener)args[3] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/whirled/spot/server/SpotSceneRegistry.java b/src/main/java/com/threerings/whirled/spot/server/SpotSceneRegistry.java index 7b723f11..c76df4db 100644 --- a/src/main/java/com/threerings/whirled/spot/server/SpotSceneRegistry.java +++ b/src/main/java/com/threerings/whirled/spot/server/SpotSceneRegistry.java @@ -43,6 +43,7 @@ import com.threerings.whirled.spot.client.SpotService; import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Portal; import com.threerings.whirled.spot.data.SpotCodes; +import com.threerings.whirled.spot.data.SpotMarshaller; import com.threerings.whirled.spot.data.SpotScene; import static com.threerings.whirled.spot.Log.log; @@ -60,7 +61,7 @@ public class SpotSceneRegistry extends SceneRegistry @Inject public SpotSceneRegistry (InvocationManager invmgr) { super(invmgr); - invmgr.registerDispatcher(new SpotDispatcher(this), SceneCodes.WHIRLED_GROUP); + invmgr.registerProvider(this, SpotMarshaller.class, SceneCodes.WHIRLED_GROUP); } /** diff --git a/src/main/java/com/threerings/whirled/zone/server/ZoneDispatcher.java b/src/main/java/com/threerings/whirled/zone/server/ZoneDispatcher.java deleted file mode 100644 index d5c831e4..00000000 --- a/src/main/java/com/threerings/whirled/zone/server/ZoneDispatcher.java +++ /dev/null @@ -1,71 +0,0 @@ -// -// $Id$ -// -// Vilya library - tools for developing networked games -// Copyright (C) 2002-2010 Three Rings Design, Inc., All Rights Reserved -// http://code.google.com/p/vilya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.whirled.zone.server; - -import javax.annotation.Generated; - -import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.InvocationDispatcher; -import com.threerings.presents.server.InvocationException; -import com.threerings.whirled.zone.client.ZoneService; -import com.threerings.whirled.zone.data.ZoneMarshaller; - -/** - * Dispatches requests to the {@link ZoneProvider}. - */ -@Generated(value={"com.threerings.presents.tools.GenServiceTask"}, - comments="Derived from ZoneService.java.") -public class ZoneDispatcher extends InvocationDispatcher -{ - /** - * Creates a dispatcher that may be registered to dispatch invocation - * service requests for the specified provider. - */ - public ZoneDispatcher (ZoneProvider provider) - { - this.provider = provider; - } - - @Override - public ZoneMarshaller createMarshaller () - { - return new ZoneMarshaller(); - } - - @Override - public void dispatchRequest ( - ClientObject source, int methodId, Object[] args) - throws InvocationException - { - switch (methodId) { - case ZoneMarshaller.MOVE_TO: - ((ZoneProvider)provider).moveTo( - source, ((Integer)args[0]).intValue(), ((Integer)args[1]).intValue(), ((Integer)args[2]).intValue(), (ZoneService.ZoneMoveListener)args[3] - ); - return; - - default: - super.dispatchRequest(source, methodId, args); - return; - } - } -} diff --git a/src/main/java/com/threerings/whirled/zone/server/ZoneRegistry.java b/src/main/java/com/threerings/whirled/zone/server/ZoneRegistry.java index f2756e4b..ba336c33 100644 --- a/src/main/java/com/threerings/whirled/zone/server/ZoneRegistry.java +++ b/src/main/java/com/threerings/whirled/zone/server/ZoneRegistry.java @@ -39,6 +39,7 @@ import com.threerings.crowd.server.LocationProvider; import com.threerings.whirled.server.SceneRegistry; import com.threerings.whirled.zone.client.ZoneService; import com.threerings.whirled.zone.data.ZoneCodes; +import com.threerings.whirled.zone.data.ZoneMarshaller; import com.threerings.whirled.zone.data.ZonedBodyObject; import com.threerings.whirled.zone.util.ZoneUtil; @@ -56,7 +57,7 @@ public class ZoneRegistry */ @Inject public ZoneRegistry (InvocationManager invmgr) { - invmgr.registerDispatcher(new ZoneDispatcher(this), ZoneCodes.WHIRLED_GROUP); + invmgr.registerProvider(this, ZoneMarshaller.class, ZoneCodes.WHIRLED_GROUP); } /**