diff --git a/build.xml b/build.xml
index ee275bbe..1aa635e1 100644
--- a/build.xml
+++ b/build.xml
@@ -61,7 +61,6 @@
tableSet field. */
public static final String TABLE_SET = "tableSet";
+
+ /** The field name of the tableService field. */
+ public static final String TABLE_SERVICE = "tableService";
// AUTO-GENERATED: FIELDS END
/** A set containing all of the tables being managed by this lobby. */
public DSet tableSet = new DSet();
- // documentation inherited
+ /** Handles our table services. */
+ public TableMarshaller tableService;
+
+ // from interface TableLobbyObject
public DSet getTables ()
{
return tableSet;
}
- // documentation inherited from interface
+ // from interface TableLobbyObject
public void addToTables (Table table)
{
addToTableSet(table);
}
- // documentation inherited from interface
+ // from interface TableLobbyObject
public void updateTables (Table table)
{
updateTableSet(table);
}
- // documentation inherited from interface
+ // from interface TableLobbyObject
public void removeFromTables (Comparable key)
{
removeFromTableSet(key);
}
+ // from interface TableLobbyObject
+ public TableMarshaller getTableService ()
+ {
+ return tableService;
+ }
+
// AUTO-GENERATED: METHODS START
/**
* Requests that the specified entry be added to the
@@ -109,5 +122,21 @@ public class TableLobbyObject
(value == null) ? null : value.typedClone();
this.tableSet = clone;
}
+
+ /**
+ * Requests that the tableService field be set to the
+ * specified value. The local value will be updated immediately and an
+ * event will be propagated through the system to notify all listeners
+ * that the attribute did change. Proxied copies of this object (on
+ * clients) will apply the value change when they received the
+ * attribute changed notification.
+ */
+ public void setTableService (TableMarshaller value)
+ {
+ TableMarshaller ovalue = this.tableService;
+ requestAttributeChange(
+ TABLE_SERVICE, value, ovalue);
+ this.tableService = value;
+ }
// AUTO-GENERATED: METHODS END
}
diff --git a/src/java/com/threerings/parlor/client/ParlorService.java b/src/java/com/threerings/parlor/client/ParlorService.java
index 964aacdf..e29ebcec 100644
--- a/src/java/com/threerings/parlor/client/ParlorService.java
+++ b/src/java/com/threerings/parlor/client/ParlorService.java
@@ -26,16 +26,13 @@ import com.threerings.util.Name;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService;
-import com.threerings.parlor.data.TableConfig;
-
import com.threerings.parlor.game.data.GameConfig;
/**
- * Provides an interface to the various parlor invocation services.
- * Presently these services are limited to the various matchmaking
- * mechanisms. It is unlikely that client code will want to make direct
- * use of this class, instead they would make use of the programmatic
- * interface provided by the {@link ParlorDirector}.
+ * Provides an interface to the various parlor invocation services. Presently these services are
+ * limited to the various matchmaking mechanisms. It is unlikely that client code will want to make
+ * direct use of this class, instead they would make use of the programmatic interface provided by
+ * the {@link ParlorDirector}.
*/
public interface ParlorService extends InvocationService
{
@@ -51,124 +48,49 @@ public interface ParlorService extends InvocationService
}
/**
- * You probably don't want to call this directly, but want to generate
- * your invitation request via {@link ParlorDirector#invite}. Requests
- * that an invitation be delivered to the named user, requesting that
- * they join the inviting user in a game, the details of which are
+ * You probably don't want to call this directly, but want to generate your invitation request
+ * via {@link ParlorDirector#invite}. Requests that an invitation be delivered to the named
+ * user, requesting that they join the inviting user in a game, the details of which are
* specified in the supplied game config object.
*
* @param client a connected, operational client instance.
* @param invitee the username of the user to be invited.
- * @param config a game config object detailing the type and
- * configuration of the game to be created.
+ * @param config a game config object detailing the type and configuration of the game to be
+ * created.
* @param listener will receive and process the response.
*/
public void invite (Client client, Name invitee, GameConfig config,
InviteListener listener);
/**
- * You probably don't want to call this directly, but want to call one
- * of {@link Invitation#accept}, {@link Invitation#refuse}, or {@link
- * Invitation#counter}. Requests that an invitation response be
- * delivered with the specified parameters.
+ * You probably don't want to call this directly, but want to call one of {@link
+ * Invitation#accept}, {@link Invitation#refuse}, or {@link Invitation#counter}. Requests that
+ * an invitation response be delivered with the specified parameters.
*
* @param client a connected, operational client instance.
- * @param inviteId the unique id previously assigned by the server to
- * this invitation.
- * @param code the response code to use in responding to the
- * invitation.
- * @param arg the argument associated with the response (a string
- * message from the player explaining why the response was refused in
- * the case of an invitation refusal or an updated game configuration
- * object in the case of a counter-invitation, or null in the case of
- * an accepted invitation).
+ * @param inviteId the unique id previously assigned by the server to this invitation.
+ * @param code the response code to use in responding to the invitation.
+ * @param arg the argument associated with the response (a string message from the player
+ * explaining why the response was refused in the case of an invitation refusal or an updated
+ * game configuration object in the case of a counter-invitation, or null in the case of an
+ * accepted invitation).
* @param listener will receive and process the response.
*/
public void respond (Client client, int inviteId, int code, Object arg,
InvocationListener listener);
/**
- * You probably don't want to call this directly, but want to call
- * {@link Invitation#cancel}. Requests that an outstanding
- * invitation be cancelled.
+ * You probably don't want to call this directly, but want to call {@link
+ * Invitation#cancel}. Requests that an outstanding invitation be cancelled.
*
* @param client a connected, operational client instance.
- * @param inviteId the unique id previously assigned by the server to
- * this invitation.
+ * @param inviteId the unique id previously assigned by the server to this invitation.
* @param listener will receive and process the response.
*/
- public void cancel (Client client, int inviteId,
- InvocationListener listener);
+ public void cancel (Client client, int inviteId, InvocationListener listener);
/**
- * Used to communicate responses to {@link #createTable}, {@link
- * #joinTable}, and {@link #leaveTable} requests.
+ * Requests to start a single player game with the specified game configuration.
*/
- public static interface TableListener extends InvocationListener
- {
- public void tableCreated (int tableId);
- }
-
- /**
- * You probably don't want to call this directly, but want to call
- * {@link TableDirector#createTable}. Requests that a new table be
- * created.
- *
- * @param client a connected, operational client instance.
- * @param lobbyOid the oid of the lobby that will contain the newly
- * created table.
- * @param tableConfig the table configuration parameters.
- * @param config the game config for the game to be matchmade by the
- * table.
- * @param listener will receive and process the response.
- */
- public void createTable (Client client, int lobbyOid,
- TableConfig tableConfig, GameConfig config, TableListener listener);
-
- /**
- * You probably don't want to call this directly, but want to call
- * {@link TableDirector#joinTable}. Requests that the current user
- * be added to the specified table at the specified position.
- *
- * @param client a connected, operational client instance.
- * @param lobbyOid the oid of the lobby that contains the table.
- * @param tableId the unique id of the table to which this user wishes
- * to be added.
- * @param position the position at the table to which this user desires
- * to be added.
- * @param listener will receive and process the response.
- */
- public void joinTable (Client client, int lobbyOid, int tableId,
- int position, InvocationListener listener);
-
- /**
- * You probably don't want to call this directly, but want to call
- * {@link TableDirector#leaveTable}. Requests that the current user be
- * removed from the specified table.
- *
- * @param client a connected, operational client instance.
- * @param lobbyOid the oid of the lobby that contains the table.
- * @param tableId the unique id of the table from which this user
- * wishes to be removed.
- * @param listener will receive and process the response.
- */
- public void leaveTable (Client client, int lobbyOid, int tableId,
- InvocationListener listener);
-
- /**
- * You probably don't want to call this directly, but want to call
- * {@link TableDirector#startTableNow}. Requests that the specified
- * table be started now, even if all seats are not occupied. This
- * will always fail if called by any other player than that seated
- * in position 0 (usually the creator).
- */
- public void startTableNow (Client client, int lobbyOid, int tableId,
- InvocationListener listener);
-
- /**
- * Requests to start a single player game with the specified game
- * configuration.
- */
- public void startSolitaire (Client client, GameConfig config,
- ConfirmListener listener);
+ public void startSolitaire (Client client, GameConfig config, ConfirmListener listener);
}
diff --git a/src/java/com/threerings/parlor/client/TableDirector.java b/src/java/com/threerings/parlor/client/TableDirector.java
index 38edf82b..706cba5e 100644
--- a/src/java/com/threerings/parlor/client/TableDirector.java
+++ b/src/java/com/threerings/parlor/client/TableDirector.java
@@ -44,39 +44,32 @@ import com.threerings.parlor.game.data.GameConfig;
import com.threerings.parlor.util.ParlorContext;
/**
- * As tables are created and managed within the scope of a place (a
- * lobby), we want to fold the table management functionality into the
- * standard hierarchy of place controllers that deal with place-related
- * functionality on the client. Thus, instead of forcing places that
- * expect to have tables to extend a TableLobbyController or
- * something similar, we instead provide the table director which can be
- * instantiated by the place controller (or specific table related views)
- * to handle the table matchmaking services.
+ * As tables are created and managed within the scope of a place (a lobby), we want to fold the
+ * table management functionality into the standard hierarchy of place controllers that deal with
+ * place-related functionality on the client. Thus, instead of forcing places that expect to have
+ * tables to extend a TableLobbyController or something similar, we instead provide
+ * the table director which can be instantiated by the place controller (or specific table related
+ * views) to handle the table matchmaking services.
*
- *
Entites that do so, will need to implement the {@link - * TableObserver} interface so that the table director can notify them - * when table related things happen. + *
Entites that do so, will need to implement the {@link TableObserver} interface so that the + * table director can notify them when table related things happen. * - *
The table services expect that the place object being used as a - * lobby in which the table matchmaking takes place implements the {@link - * TableLobbyObject} interface. + *
The table services expect that the place object being used as a lobby in which the table
+ * matchmaking takes place implements the {@link TableLobbyObject} interface.
*/
public class TableDirector extends BasicDirector
- implements SetListener, ParlorService.TableListener
+ implements SetListener, TableService.ResultListener
{
/**
- * Creates a new table director to manage tables with the specified
- * observer which will receive callbacks when interesting table
- * related things happen.
+ * Creates a new table director to manage tables with the specified observer which will receive
+ * callbacks when interesting table related things happen.
*
* @param ctx the parlor context in use by the client.
- * @param tableField the field name of the distributed set that
- * contains the tables we will be managing.
- * @param observer the entity that will receive callbacks when things
- * happen to the tables.
+ * @param tableField the field name of the distributed set that contains the tables we will be
+ * managing.
+ * @param observer the entity that will receive callbacks when things happen to the tables.
*/
- public TableDirector (
- ParlorContext ctx, String tableField, TableObserver observer)
+ public TableDirector (ParlorContext ctx, String tableField, TableObserver observer)
{
super(ctx);
@@ -87,39 +80,33 @@ public class TableDirector extends BasicDirector
}
/**
- * This must be called by the entity that uses the table director when
- * the using entity prepares to enter and display a place. It is
- * assumed that the client is already subscribed to the provided place
- * object.
+ * This must be called by the entity that uses the table director when the using entity
+ * prepares to enter and display a place. It is assumed that the client is already subscribed
+ * to the provided place object.
*/
public void willEnterPlace (PlaceObject place)
{
// the place should be a TableLobbyObject
- _tlobj = (TableLobbyObject) place;
- _lobby = place;
-
+ _tlobj = (TableLobbyObject)place;
// add ourselves as a listener to the place object
place.addListener(this);
}
/**
- * This must be called by the entity that uses the table director when
- * the using entity has left and is done displaying a place.
+ * This must be called by the entity that uses the table director when the using entity has
+ * left and is done displaying a place.
*/
public void didLeavePlace (PlaceObject place)
{
// remove our listenership
place.removeListener(this);
-
- // clear out our lobby reference
- _lobby = null;
+ // clear out our reference
_tlobj = null;
}
/**
- * Requests that the specified observer be added to the list of
- * observers that are notified when this client sits down at or stands
- * up from a table.
+ * Requests that the specified observer be added to the list of observers that are notified
+ * when this client sits down at or stands up from a table.
*/
public void addSeatednessObserver (SeatednessObserver observer)
{
@@ -127,9 +114,8 @@ public class TableDirector extends BasicDirector
}
/**
- * Requests that the specified observer be removed from to the list of
- * observers that are notified when this client sits down at or stands
- * up from a table.
+ * Requests that the specified observer be removed from to the list of observers that are
+ * notified when this client sits down at or stands up from a table.
*/
public void removeSeatednessObserver (SeatednessObserver observer)
{
@@ -137,8 +123,7 @@ public class TableDirector extends BasicDirector
}
/**
- * Returns true if this client is currently seated at a table, false
- * if they are not.
+ * Returns true if this client is currently seated at a table, false if they are not.
*/
public boolean isSeated ()
{
@@ -146,117 +131,100 @@ public class TableDirector extends BasicDirector
}
/**
- * Sends a request to create a table with the specified game
- * configuration. This user will become the owner of this table and
- * will be added to the first position in the table. The response will
- * be communicated via the {@link TableObserver} interface.
+ * Sends a request to create a table with the specified game configuration. This user will
+ * become the owner of this table and will be added to the first position in the table. The
+ * response will be communicated via the {@link TableObserver} interface.
*/
public void createTable (TableConfig tableConfig, GameConfig config)
{
// if we're already in a table, refuse the request
if (_ourTable != null) {
- Log.warning("Ignoring request to create table as we're " +
- "already in a table [table=" + _ourTable + "].");
+ Log.warning("Ignoring request to create table as we're already in a table " +
+ "[table=" + _ourTable + "].");
return;
}
// make sure we're currently in a place
- if (_lobby == null) {
- Log.warning("Requested to create a table but we're not " +
- "currently in a place [config=" + config + "].");
+ if (_tlobj == null) {
+ Log.warning("Requested to create a table but we're not currently in a place " +
+ "[config=" + config + "].");
return;
}
// go ahead and issue the create request
- _pservice.createTable(_ctx.getClient(), _lobby.getOid(), tableConfig,
- config, this);
+ _tlobj.getTableService().createTable(_ctx.getClient(), tableConfig, config, this);
}
/**
- * Sends a request to join the specified table at the specified
- * position. The response will be communicated via the {@link
- * TableObserver} interface.
+ * Sends a request to join the specified table at the specified position. The response will be
+ * communicated via the {@link TableObserver} interface.
*/
public void joinTable (int tableId, int position)
{
// if we're already in a table, refuse the request
if (_ourTable != null) {
- Log.warning("Ignoring request to join table as we're " +
- "already in a table [table=" + _ourTable + "].");
+ Log.warning("Ignoring request to join table as we're already in a table " +
+ "[table=" + _ourTable + "].");
return;
}
// make sure we're currently in a place
- if (_lobby == null) {
- Log.warning("Requested to join a table but we're not " +
- "currently in a place [tableId=" + tableId + "].");
+ if (_tlobj == null) {
+ Log.warning("Requested to join a table but we're not currently in a place " +
+ "[tableId=" + tableId + "].");
return;
}
// issue the join request
- _pservice.joinTable(_ctx.getClient(), _lobby.getOid(), tableId,
- position, this);
+ _tlobj.getTableService().joinTable(_ctx.getClient(), tableId, position, this);
}
/**
- * Sends a request to leave the specified table at which we are
- * presumably seated. The response will be communicated via the {@link
- * TableObserver} interface.
+ * Sends a request to leave the specified table at which we are presumably seated. The response
+ * will be communicated via the {@link TableObserver} interface.
*/
public void leaveTable (int tableId)
{
// make sure we're currently in a place
- if (_lobby == null) {
- Log.warning("Requested to leave a table but we're not " +
- "currently in a place [tableId=" + tableId + "].");
+ if (_tlobj == null) {
+ Log.warning("Requested to leave a table but we're not currently in a place " +
+ "[tableId=" + tableId + "].");
return;
}
// issue the leave request
- _pservice.leaveTable(_ctx.getClient(), _lobby.getOid(), tableId, this);
+ _tlobj.getTableService().leaveTable(_ctx.getClient(), tableId, this);
}
/**
- * Sends a request to have the specified table start now, even if
- * all the seats have not yet been filled.
+ * Sends a request to have the specified table start now, even if all the seats have not yet
+ * been filled.
*/
public void startTableNow (int tableId)
{
- if (_lobby == null) {
- Log.warning("Requested to start a table but we're not " +
- "currently in a place [tableId=" + tableId + "].");
+ if (_tlobj == null) {
+ Log.warning("Requested to start a table but we're not currently in a place " +
+ "[tableId=" + tableId + "].");
return;
}
- _pservice.startTableNow(_ctx.getClient(), _lobby.getOid(),
- tableId, this);
+ _tlobj.getTableService().startTableNow(_ctx.getClient(), tableId, this);
}
// documentation inherited
public void clientDidLogoff (Client client)
{
super.clientDidLogoff(client);
- _pservice = null;
- _lobby = null;
_ourTable = null;
}
- // documentation inherited
- protected void fetchServices (Client client)
- {
- // get a handle on our parlor services
- _pservice = (ParlorService)client.requireService(ParlorService.class);
- }
-
// documentation inherited
public void entryAdded (EntryAddedEvent event)
{
if (event.getName().equals(_tableField)) {
Table table = (Table)event.getEntry();
-
// check to see if we just joined a table
checkSeatedness(table);
-
// now let the observer know what's up
_observer.tableAdded(table);
}
@@ -267,10 +235,8 @@ public class TableDirector extends BasicDirector
{
if (event.getName().equals(_tableField)) {
Table table = (Table)event.getEntry();
-
// check to see if we just joined or left a table
checkSeatedness(table);
-
// now let the observer know what's up
_observer.tableUpdated(table);
}
@@ -281,43 +247,42 @@ public class TableDirector extends BasicDirector
{
if (event.getName().equals(_tableField)) {
int tableId = ((Integer) event.getKey()).intValue();
-
// check to see if our table just disappeared
if (_ourTable != null && tableId == _ourTable.tableId) {
_ourTable = null;
notifySeatedness(false);
}
-
// now let the observer know what's up
_observer.tableRemoved(tableId);
}
}
- // documentation inherited from interface
- public void tableCreated (int tableId)
+ // from interface TableService.ResultListener
+ public void requestProcessed (Object result)
{
- if (_lobby == null) {
+ int tableId = (Integer)result;
+ if (_tlobj == null) {
// we've left, it's none of our concern anymore
Log.info("Table created, but no lobby. [tableId=" + tableId + "].");
return;
}
- // All this to check to see if we created a party game (and should now enter).
Table table = (Table) _tlobj.getTables().get(tableId);
if (table == null) {
Log.warning("Table created, but where is it? [tableId=" + tableId + "]");
return;
}
+
+ // All this to check to see if we created a party game (and should now enter).
if (table.gameOid != -1 && table.occupants.length == 0) {
- // let's boogie!
- _ctx.getParlorDirector().gameIsReady(table.gameOid);
+ _ctx.getParlorDirector().gameIsReady(table.gameOid); // let's boogie!
}
}
// documentation inherited from interface
public void requestFailed (String reason)
{
- Log.warning("Table creation failed [reason=" + reason + "].");
+ Log.warning("Table action failed [reason=" + reason + "].");
}
/**
@@ -328,9 +293,8 @@ public class TableDirector extends BasicDirector
{
Table oldTable = _ourTable;
- // if this is the same table as our table, clear out our table
- // reference and allow it to be added back if we are still in the
- // table
+ // if this is the same table as our table, clear out our table reference and allow it to be
+ // added back if we are still in the table
if (table.equals(_ourTable)) {
_ourTable = null;
}
@@ -355,25 +319,18 @@ public class TableDirector extends BasicDirector
*/
protected void notifySeatedness (final boolean isSeated)
{
- _seatedObservers.apply(
- new ObserverList.ObserverOpinviter to the invitee for a game as
* described by the supplied config object.
@@ -79,8 +145,7 @@ public class ParlorManager
* some reason (like the invited player has requested not to be disturbed). The explanation
* will be provided in the message data of the exception.
*/
- public int invite (BodyObject inviter, BodyObject invitee,
- GameConfig config)
+ public int invite (BodyObject inviter, BodyObject invitee, GameConfig config)
throws InvocationException
{
// Log.info("Received invitation request [inviter=" + inviter +
diff --git a/src/java/com/threerings/parlor/server/ParlorProvider.java b/src/java/com/threerings/parlor/server/ParlorProvider.java
index 4e75143e..eb22cba6 100644
--- a/src/java/com/threerings/parlor/server/ParlorProvider.java
+++ b/src/java/com/threerings/parlor/server/ParlorProvider.java
@@ -21,221 +21,41 @@
package com.threerings.parlor.server;
-import com.threerings.util.Name;
-
+import com.threerings.parlor.client.ParlorService;
+import com.threerings.parlor.game.data.GameConfig;
+import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService;
-import com.threerings.presents.client.InvocationService.InvocationListener;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationProvider;
-
-import com.threerings.crowd.data.BodyObject;
-import com.threerings.crowd.server.CrowdServer;
-import com.threerings.crowd.server.PlaceManager;
-
-import com.threerings.parlor.Log;
-import com.threerings.parlor.client.ParlorService;
-import com.threerings.parlor.data.ParlorCodes;
-import com.threerings.parlor.data.TableConfig;
-import com.threerings.parlor.game.data.GameConfig;
-import com.threerings.parlor.game.server.GameManager;
+import com.threerings.util.Name;
/**
- * The parlor provider handles the server side of the various Parlor
- * services that are made available for direct invocation by the client.
- * Primarily these are the matchmaking mechanisms.
+ * Defines the server-side of the {@link ParlorService}.
*/
-public class ParlorProvider
- implements InvocationProvider, ParlorCodes
+public interface ParlorProvider extends InvocationProvider
{
/**
- * Constructs a parlor provider instance which will be used to handle
- * all parlor-related invocation service requests. This is
- * automatically taken care of by the parlor manager, so no other
- * entity need instantiate and register a parlor provider.
- *
- * @param pmgr a reference to the parlor manager active in this
- * server.
+ * Handles a {@link ParlorService#cancel} request.
*/
- public ParlorProvider (ParlorManager pmgr)
- {
- _pmgr = pmgr;
- }
+ public void cancel (ClientObject caller, int arg1, InvocationService.InvocationListener arg2)
+ throws InvocationException;
/**
- * Processes a request from the client to invite another user to play
- * a game.
+ * Handles a {@link ParlorService#invite} request.
*/
- public void invite (ClientObject caller, Name invitee, GameConfig config,
- ParlorService.InviteListener listener)
- throws InvocationException
- {
-// Log.info("Handling invite request [source=" + source +
-// ", invitee=" + invitee + ", config=" + config + "].");
-
- BodyObject source = (BodyObject)caller;
- String rsp = null;
-
- // ensure that the invitee is online at present
- BodyObject target = CrowdServer.lookupBody(invitee);
- if (target == null) {
- throw new InvocationException(INVITEE_NOT_ONLINE);
- }
-
- // submit the invite request to the parlor manager
- int inviteId = _pmgr.invite(source, target, config);
- listener.inviteReceived(inviteId);
- }
+ public void invite (ClientObject caller, Name arg1, GameConfig arg2, ParlorService.InviteListener arg3)
+ throws InvocationException;
/**
- * Processes a request from the client to respond to an outstanding
- * invitation by accepting, refusing, or countering it.
+ * Handles a {@link ParlorService#respond} request.
*/
- public void respond (ClientObject caller, int inviteId, int code,
- Object arg, InvocationListener listener)
- {
- // pass this on to the parlor manager
- _pmgr.respondToInvite((BodyObject)caller, inviteId, code, arg);
- }
-
- /**
- * Processes a request from the client to cancel an outstanding
- * invitation.
- */
- public void cancel (ClientObject caller, int inviteId,
- InvocationListener listener)
- {
- // pass this on to the parlor manager
- _pmgr.cancelInvite((BodyObject)caller, inviteId);
- }
-
- /**
- * Processes a request from the client to create a new table.
- */
- public void createTable (
- ClientObject caller, int lobbyOid, TableConfig tableConfig,
- GameConfig config, ParlorService.TableListener listener)
- throws InvocationException
- {
- Log.info("Handling create table request [caller=" + caller.who() +
- ", lobbyOid=" + lobbyOid + ", config=" + config + "].");
-
- // pass the creation request on to the table manager
- TableManager tmgr = getTableManager(lobbyOid);
- int tableId = tmgr.createTable((BodyObject)caller, tableConfig, config);
- listener.tableCreated(tableId);
- }
-
- /**
- * Processes a request from the client to join an existing table.
- */
- public void joinTable (ClientObject caller, int lobbyOid, int tableId,
- int position, InvocationListener listener)
- throws InvocationException
- {
- Log.info("Handling join table request [caller=" + caller.who() +
- ", lobbyOid=" + lobbyOid + ", tableId=" + tableId +
- ", position=" + position + "].");
-
- // pass the join request on to the table manager
- TableManager tmgr = getTableManager(lobbyOid);
- tmgr.joinTable((BodyObject)caller, tableId, position);
-
- // there is normally no success response. the client will see
- // themselves show up in the table that they joined
- }
-
- /**
- * Processes a request from the client to leave an existing table.
- */
- public void leaveTable (ClientObject caller, int lobbyOid, int tableId,
- InvocationListener listener)
- throws InvocationException
- {
- Log.info("Handling leave table request [caller=" + caller.who() +
- ", lobbyOid=" + lobbyOid + ", tableId=" + tableId + "].");
-
- // pass the join request on to the table manager
- TableManager tmgr = getTableManager(lobbyOid);
- tmgr.leaveTable((BodyObject)caller, tableId);
-
- // there is normally no success response. the client will see
- // themselves removed from the table they just left
- }
+ public void respond (ClientObject caller, int arg1, int arg2, Object arg3, InvocationService.InvocationListener arg4)
+ throws InvocationException;
/**
* Handles a {@link ParlorService#startSolitaire} request.
*/
- public void startTableNow (ClientObject caller, int lobbyOid, int tableId,
- InvocationService.InvocationListener listener)
- throws InvocationException
- {
- TableManager tmgr = getTableManager(lobbyOid);
- tmgr.startTableNow((BodyObject) caller, tableId);
- }
-
- /**
- * Handles a {@link ParlorService#startSolitaire} request.
- */
- public void startSolitaire (ClientObject caller, GameConfig config,
- InvocationService.ConfirmListener listener)
- throws InvocationException
- {
- BodyObject user = (BodyObject)caller;
-
- Log.debug("Processing start puzzle [caller=" + user.who() +
- ", config=" + config + "].");
-
- try {
- // just this fellow will be playing
- if (config.players == null || config.players.length == 0) {
- config.players = new Name[] { user.getVisibleName() };
- }
-
- // create the game manager and begin its initialization process
- CrowdServer.plreg.createPlace(config);
-
- // the game manager will notify the player that their game is
- // "ready", but tell the caller that we processed their request
- listener.requestProcessed();
-
- } catch (InstantiationException ie) {
- Log.warning("Error instantiating game manager " +
- "[for=" + caller.who() + ", config=" + config + "].");
- Log.logStackTrace(ie);
- throw new InvocationException(INTERNAL_ERROR);
- }
- }
-
- /**
- * Looks up the place manager associated with the supplied lobby oid,
- * casts it to a table lobby manager and obtains the associated table
- * manager reference.
- *
- * @exception InvocationException thrown if something goes wrong
- * along the way like no place manager exists or the place manager
- * that does exist doesn't implement table lobby manager.
- */
- protected TableManager getTableManager (int lobbyOid)
- throws InvocationException
- {
- PlaceManager plmgr = CrowdServer.plreg.getPlaceManager(lobbyOid);
- if (plmgr == null) {
- Log.warning("No place manager exists from which to obtain " +
- "table manager reference [ploid=" + lobbyOid + "].");
- throw new InvocationException(INTERNAL_ERROR);
- }
-
- // sanity check
- if (!(plmgr instanceof TableManagerProvider)) {
- Log.warning("Place manager not a table lobby manager " +
- "[plmgr=" + plmgr + "].");
- throw new InvocationException(INTERNAL_ERROR);
- }
-
- return ((TableManagerProvider)plmgr).getTableManager();
- }
-
- /** A reference to the parlor manager we're working with. */
- protected ParlorManager _pmgr;
+ public void startSolitaire (ClientObject caller, GameConfig arg1, InvocationService.ConfirmListener arg2)
+ throws InvocationException;
}
diff --git a/src/java/com/threerings/parlor/server/TableDispatcher.java b/src/java/com/threerings/parlor/server/TableDispatcher.java
new file mode 100644
index 00000000..6ee19eb8
--- /dev/null
+++ b/src/java/com/threerings/parlor/server/TableDispatcher.java
@@ -0,0 +1,94 @@
+//
+// $Id$
+//
+// Vilya library - tools for developing networked games
+// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
+// http://www.threerings.net/code/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 com.threerings.parlor.client.TableService;
+import com.threerings.parlor.data.TableConfig;
+import com.threerings.parlor.data.TableMarshaller;
+import com.threerings.parlor.game.data.GameConfig;
+import com.threerings.presents.client.Client;
+import com.threerings.presents.client.InvocationService;
+import com.threerings.presents.data.ClientObject;
+import com.threerings.presents.data.InvocationMarshaller;
+import com.threerings.presents.server.InvocationDispatcher;
+import com.threerings.presents.server.InvocationException;
+
+/**
+ * Dispatches requests to the {@link TableProvider}.
+ */
+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;
+ }
+
+ // from InvocationDispatcher
+ public InvocationMarshaller createMarshaller ()
+ {
+ return new TableMarshaller();
+ }
+
+ @SuppressWarnings("unchecked") // from InvocationDispatcher
+ public void dispatchRequest (
+ ClientObject source, int methodId, Object[] args)
+ throws InvocationException
+ {
+ switch (methodId) {
+ 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/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java
index 59913580..5a1437d5 100644
--- a/src/java/com/threerings/parlor/server/TableManager.java
+++ b/src/java/com/threerings/parlor/server/TableManager.java
@@ -28,7 +28,8 @@ import com.samskivert.util.HashIntMap;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
-import com.threerings.presents.dobj.ChangeListener;
+import com.threerings.presents.data.ClientObject;
+import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.NamedEvent;
import com.threerings.presents.dobj.ObjectAddedEvent;
import com.threerings.presents.dobj.ObjectDeathListener;
@@ -44,39 +45,43 @@ import com.threerings.crowd.server.CrowdServer;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.parlor.Log;
+import com.threerings.parlor.client.TableService;
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;
/**
- * A table manager can be used by a place manager to take care of the
- * management of a table matchmaking service in the place managed by the
- * place manager. The place manager need instantiate a table manager and
- * implement the {@link TableManagerProvider} interface to provide access
- * to the table manager for the associated invocation services.
+ * A table manager can be used by a place manager (or other entity) to take care of the management
+ * of a table matchmaking service in the place managed by the place manager (or on some other
+ * distributed object). The place manager need instantiate a table manager and implement the {@link
+ * TableManagerProvider} interface to provide access to the table manager for the associated
+ * invocation services.
*/
public class TableManager
- implements ParlorCodes, OidListListener
+ implements ParlorCodes, OidListListener, TableProvider
{
/**
- * Creates a table manager that will work in tandem with the specified
- * place manager to manage a table matchmaking service in this place.
+ * Creates a table manager that will manage tables in the supplied distributed object (which
+ * must implement {@link TableLobbyObject}.
*/
- public TableManager (PlaceManager plmgr)
+ public TableManager (DObject tableObject)
{
- // get a reference to our place object
- _plobj = plmgr.getPlaceObject();
+ // set up our object references
+ _tlobj = (TableLobbyObject)tableObject;
+ _tlobj.setTableService(
+ (TableMarshaller)CrowdServer.invmgr.registerDispatcher(new TableDispatcher(this)));
+ _dobj = tableObject;
- // add ourselves as an oidlist listener to this lobby so that we
- // can tell if a user leaves the lobby without leaving their table
- _plobj.addListener(this);
-
- // make sure it implements table lobby object
- _tlobj = (TableLobbyObject)_plobj;
+ // if our table is in a "place" add ourselves as a listener so that we can tell if a user
+ // leaves the place without leaving their table
+ if (_dobj instanceof PlaceObject) {
+ _dobj.addListener(this);
+ }
}
/**
@@ -87,33 +92,19 @@ public class TableManager
_tableClass = tableClass;
}
- /**
- * Requests that a new table be created to matchmake the game
- * described by the supplied game config instance. The config instance
- * provided must implement the {@link TableConfig} interface so that
- * the parlor services can determine how to configure the table that
- * will be created.
- *
- * @param creator the body object that will own the new table.
- * @param tableConfig the configuration parameters for the table.
- * @param config the configuration of the game to be created.
- *
- * @return the id of the newly created table.
- *
- * @exception InvocationException thrown if the table creation was
- * not able processed for some reason. The explanation will be
- * provided in the message data of the exception.
- */
- public int createTable (BodyObject creator, TableConfig tableConfig,
- GameConfig config)
+ // from interface ParlorProvider
+ public void createTable (ClientObject caller, TableConfig tableConfig, GameConfig config,
+ TableService.ResultListener listener)
throws InvocationException
{
- // make sure the creator is an occupant of the lobby in which
- // they are requesting to create a table
- if (!_plobj.occupants.contains(creator.getOid())) {
- Log.warning("Requested to create a table in a lobby not " +
- "occupied by the creator [creator=" + creator +
- ", loboid=" + _plobj.getOid() + "].");
+ BodyObject creator = (BodyObject)caller;
+
+ // if we're managing tables in a place, make sure the creator is an occupant of the place
+ // in which they are requesting to create a table
+ if (_dobj instanceof PlaceObject &&
+ !((PlaceObject)_dobj).occupants.contains(creator.getOid())) {
+ Log.warning("Requested to create a table in a place not occupied by the creator " +
+ "[creator=" + creator + ", ploid=" + _dobj.getOid() + "].");
throw new InvocationException(INTERNAL_ERROR);
}
@@ -122,26 +113,25 @@ public class TableManager
try {
table = _tableClass.newInstance();
} catch (Exception e) {
- Log.warning("Unable to create a new table instance! " +
- "[tableClass=" + _tableClass + ", error=" + e + "].");
+ Log.warning("Unable to create a new table instance! [tableClass=" + _tableClass +
+ ", error=" + e + "].");
throw new InvocationException(INTERNAL_ERROR);
}
- table.init(_plobj.getOid(), tableConfig, config);
+ table.init(_dobj.getOid(), tableConfig, config);
if (table.bodyOids != null && table.bodyOids.length > 0) {
// stick the creator into the first non-AI position
int cpos = (config.ais == null) ? 0 : config.ais.length;
String error = table.setOccupant(cpos, creator);
if (error != null) {
- Log.warning("Unable to add creator to position zero of " +
- "table!? [table=" + table + ", creator=" + creator +
- ", error=" + error + "].");
+ Log.warning("Unable to add creator to position zero of table!? [table=" + table +
+ ", creator=" + creator + ", error=" + error + "].");
// bail out now and abort the table creation process
throw new InvocationException(error);
}
// make a mapping from the creator to this table
- _boidMap.put(creator.getOid(), table);
+ notePlayerAdded(table, creator.getOid());
}
// stick the table into the table lobby object
@@ -155,32 +145,16 @@ public class TableManager
int oid = createGame(table);
}
- // finally let the caller know what the new table id is
- return table.tableId;
+ listener.requestProcessed(table.tableId);
}
- /**
- * Requests that the specified user be added to the specified table at
- * the specified position. If the user successfully joins the table,
- * the function will return normally. If they are not able to join for
- * some reason (the slot is already full, etc.), a {@link
- * InvocationException} will be thrown with a message code that
- * describes the reason for failure. If the user does successfully
- * join, they will be added to the table entry in the tables set in
- * the place object that is hosting the table.
- *
- * @param joiner the body object of the user that wishes to join the
- * table.
- * @param tableId the id of the table to be joined.
- * @param position the position at which to join the table.
- *
- * @exception InvocationException thrown if the joining was not able
- * processed for some reason. The explanation will be provided in the
- * message data of the exception.
- */
- public void joinTable (BodyObject joiner, int tableId, int position)
+ // from interface ParlorProvider
+ public void joinTable (ClientObject caller, int tableId, int position,
+ TableService.InvocationListener listener)
throws InvocationException
{
+ BodyObject joiner = (BodyObject)caller;
+
// look the table up
Table table = _tables.get(tableId);
if (table == null) {
@@ -199,32 +173,23 @@ public class TableManager
createGame(table);
} else {
// make a mapping from this occupant to this table
- _boidMap.put(joiner.getOid(), table);
+ notePlayerAdded(table, joiner.getOid());
}
// update the table in the lobby
_tlobj.updateTables(table);
+
+ // there is normally no success response. the client will see
+ // themselves show up in the table that they joined
}
- /**
- * Requests that the specified user be removed from the specified
- * table. If the user successfully leaves the table, the function will
- * return normally. If they are not able to leave for some reason
- * (they aren't sitting at the table, etc.), a {@link
- * InvocationException} will be thrown with a message code that
- * describes the reason for failure.
- *
- * @param leaver the body object of the user that wishes to leave the
- * table.
- * @param tableId the id of the table to be left.
- *
- * @exception InvocationException thrown if the leaving was not able
- * processed for some reason. The explanation will be provided in the
- * message data of the exception.
- */
- public void leaveTable (BodyObject leaver, int tableId)
+ // from interface ParlorProvider
+ public void leaveTable (ClientObject caller, int tableId,
+ TableService.InvocationListener listener)
throws InvocationException
{
+ BodyObject leaver = (BodyObject)caller;
+
// look the table up
Table table = _tables.get(tableId);
if (table == null) {
@@ -237,57 +202,42 @@ public class TableManager
}
// remove the mapping from this user to the table
- if (_boidMap.remove(leaver.getOid()) == null) {
- Log.warning("No body to table mapping to clear? " +
- "[leaver=" + leaver + ", table=" + table + "].");
+ if (!notePlayerRemoved(table, leaver.getOid())) {
+ Log.warning("No body to table mapping to clear? [leaver=" + leaver +
+ ", table=" + table + "].");
}
- // either update or delete the table depending on whether or not
- // we just removed the last occupant
+ // either update or delete the table depending on whether or not we just removed the last
+ // occupant
if (table.isEmpty()) {
purgeTable(table);
} else {
_tlobj.updateTables(table);
}
+
+ // there is normally no success response. the client will see
+ // themselves removed from the table they just left
}
- /**
- * Requests that the specified table be started now, even if there are
- * some vacant seats. This may only be done if the minimum number of
- * players are already present at the table. By convention, only the
- * player at seat 0 may request to have the game start early, as they
- * are usually the creator.
- *
- * @param requester the body object of the user that wishes to start
- * the table.
- * @param tableId the id of the table to be started.
- *
- * @exception InvocationException thrown if the starting was not able
- * processed for some reason. The explanation will be provided in the
- * message data of the exception.
- */
- public void startTableNow (BodyObject requester, int tableId)
+ // from interface ParlorProvider
+ public void startTableNow (ClientObject caller, int tableId,
+ TableService.InvocationListener listener)
throws InvocationException
{
- // look the table up
+ BodyObject starter = (BodyObject)caller;
Table table = _tables.get(tableId);
if (table == null) {
throw new InvocationException(NO_SUCH_TABLE);
-
- } else if (requester.getOid() != table.bodyOids[0]) {
+ } else if (starter.getOid() != table.bodyOids[0]) {
throw new InvocationException(INVALID_TABLE_POSITION);
-
} else if (!table.mayBeStarted()) {
throw new InvocationException(INTERNAL_ERROR);
}
-
- // I guess we're ready to go!
createGame(table);
}
/**
- * Removes the table from all of our internal tables and from its
- * lobby's distributed object.
+ * Removes the table from all of our internal tables and from its lobby's distributed object.
*/
protected void purgeTable (Table table)
{
@@ -297,7 +247,7 @@ public class TableManager
// clear out all matching entries in the boid map
if (table.bodyOids != null) {
for (int ii = 0; ii < table.bodyOids.length; ii++) {
- _boidMap.remove(table.bodyOids[ii]);
+ notePlayerRemoved(table, table.bodyOids[ii]);
}
}
@@ -309,9 +259,30 @@ public class TableManager
}
/**
- * Called when we're ready to create a game (either an invitation has
- * been accepted or a table is ready to start. If there is a problem
- * creating the game manager, it should be reported in the logs.
+ * Called when a player is added to a table to set up our mappings.
+ */
+ protected void notePlayerAdded (Table table, int playerOid)
+ {
+ _boidMap.put(playerOid, table);
+
+ // TODO: if we're not in a place, listen to the player's BodyObject for object death so
+ // that we remove them from their table if they logoff
+ }
+
+ /**
+ * Called when a player leaves a table to clear our mappings.
+ */
+ protected boolean notePlayerRemoved (Table table, int playerOid)
+ {
+ boolean removed = (_boidMap.remove(playerOid) != null);
+ // TODO: remove our BodyObject death listener
+ return removed;
+ }
+
+ /**
+ * Called when we're ready to create a game (either an invitation has been accepted or a table
+ * is ready to start. If there is a problem creating the game manager, it should be reported in
+ * the logs.
*
* @return the oid of the newly-created game.
*/
@@ -325,8 +296,7 @@ public class TableManager
return gobj.getOid();
} catch (Throwable t) {
- Log.warning("Failed to create manager for game " +
- "[config=" + table.config + "]: " + t);
+ Log.warning("Failed to create manager for game [config=" + table.config + "]: " + t);
throw new InvocationException(INTERNAL_ERROR);
}
}
@@ -344,8 +314,8 @@ public class TableManager
}
/**
- * Called when our game has been created, we take this opportunity to clean
- * up the table and transition it to "in play" mode.
+ * Called when our game has been created, we take this opportunity to clean up the table and
+ * transition it to "in play" mode.
*/
protected void gameCreated (Table table, GameObject gameobj)
{
@@ -365,8 +335,7 @@ public class TableManager
}
}
- // add an object death listener to unmap the table when the game
- // finally goes away
+ // add an object death listener to unmap the table when the game finally goes away
gameobj.addListener(_gameListener);
// and then update the lobby object that contains the table
@@ -374,18 +343,16 @@ public class TableManager
}
/**
- * Called when a game created from a table managed by this table
- * manager was destroyed. We remove the associated table.
+ * Called when a game created from a table managed by this table manager was destroyed. We
+ * remove the associated table.
*/
protected void unmapTable (int gameOid)
{
Table table = _goidMap.get(gameOid);
if (table != null) {
purgeTable(table);
-
} else {
- Log.warning("Requested to unmap table that wasn't mapped " +
- "[gameOid=" + gameOid + "].");
+ Log.warning("Requested to unmap table that wasn't mapped [gameOid=" + gameOid + "].");
}
}
@@ -396,8 +363,7 @@ public class TableManager
{
Table table = _goidMap.get(gameOid);
if (table == null) {
- Log.warning("Unable to find table for running game " +
- "[gameOid=" + gameOid + "].");
+ Log.warning("Unable to find table for running game [gameOid=" + gameOid + "].");
return;
}
@@ -437,13 +403,13 @@ public class TableManager
// remove this occupant from the table
if (!pender.clearOccupantByOid(bodyOid)) {
- Log.warning("Attempt to remove body from mapped table failed " +
- "[table=" + pender + ", bodyOid=" + bodyOid + "].");
+ Log.warning("Attempt to remove body from mapped table failed [table=" + pender +
+ ", bodyOid=" + bodyOid + "].");
return;
}
- // either update or delete the table depending on whether or not
- // we just removed the last occupant
+ // either update or delete the table depending on whether or not we just removed the last
+ // occupant
if (pender.isEmpty()) {
purgeTable(pender);
} else {
@@ -451,15 +417,15 @@ public class TableManager
}
}
- /** A reference to the place object in which we're managing tables. */
- protected PlaceObject _plobj;
+ /** A reference to the distributed object in which we're managing tables. */
+ protected DObject _dobj;
+
+ /** A reference to our distributed object casted to a table lobby object. */
+ protected TableLobbyObject _tlobj;
/** The class of table we instantiate. */
protected Class extends Table> _tableClass = Table.class;
- /** A reference to our place object casted to a table lobby object. */
- protected TableLobbyObject _tlobj;
-
/** The table of pending tables. */
protected HashIntMap _tables = new HashIntMap
();
@@ -488,9 +454,7 @@ public class TableManager
maybeCheckOccupants(event);
}
- /**
- * Check to see if the set event causes us to update the table.
- */
+ /** Check to see if the set event causes us to update the table. */
protected void maybeCheckOccupants (NamedEvent event) {
if (GameObject.OCCUPANTS.equals(event.getName())) {
updateOccupants(event.getTargetOid());
@@ -499,5 +463,5 @@ public class TableManager
} // END: class GameDeathListener
/** A listener that prunes tables after the game dies. */
- protected ChangeListener _gameListener = new GameListener();
+ protected GameListener _gameListener = new GameListener();
}
diff --git a/src/java/com/threerings/parlor/server/TableManagerProvider.java b/src/java/com/threerings/parlor/server/TableManagerProvider.java
index f2f294ec..acd6577f 100644
--- a/src/java/com/threerings/parlor/server/TableManagerProvider.java
+++ b/src/java/com/threerings/parlor/server/TableManagerProvider.java
@@ -22,16 +22,15 @@
package com.threerings.parlor.server;
/**
- * A place manager that wishes to provide table matchmaking services in
- * its place needs to create a table manager and make it available by
- * implementing this interface. The table invocation services and the
- * table manager will take care of the rest.
+ * A place manager that wishes to provide table matchmaking services in its place needs to create a
+ * table manager and make it available by implementing this interface. The table invocation
+ * services and the table manager will take care of the rest.
*/
public interface TableManagerProvider
{
/**
- * Returns a reference to the table manager that is responsible for
- * table management in this lobby.
+ * Returns a reference to the table manager that is responsible for table management in this
+ * lobby.
*/
public TableManager getTableManager ();
}
diff --git a/src/java/com/threerings/parlor/server/TableProvider.java b/src/java/com/threerings/parlor/server/TableProvider.java
new file mode 100644
index 00000000..a7f345bc
--- /dev/null
+++ b/src/java/com/threerings/parlor/server/TableProvider.java
@@ -0,0 +1,61 @@
+//
+// $Id$
+//
+// Vilya library - tools for developing networked games
+// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
+// http://www.threerings.net/code/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 com.threerings.parlor.client.TableService;
+import com.threerings.parlor.data.TableConfig;
+import com.threerings.parlor.game.data.GameConfig;
+import com.threerings.presents.client.Client;
+import com.threerings.presents.client.InvocationService;
+import com.threerings.presents.data.ClientObject;
+import com.threerings.presents.server.InvocationException;
+import com.threerings.presents.server.InvocationProvider;
+
+/**
+ * Defines the server-side of the {@link TableService}.
+ */
+public interface TableProvider extends InvocationProvider
+{
+ /**
+ * Handles a {@link TableService#createTable} request.
+ */
+ public void createTable (ClientObject caller, TableConfig arg1, GameConfig arg2, InvocationService.ResultListener arg3)
+ throws InvocationException;
+
+ /**
+ * Handles a {@link TableService#joinTable} request.
+ */
+ public void joinTable (ClientObject caller, int arg1, int arg2, InvocationService.InvocationListener arg3)
+ throws InvocationException;
+
+ /**
+ * Handles a {@link TableService#leaveTable} request.
+ */
+ public void leaveTable (ClientObject caller, int arg1, InvocationService.InvocationListener arg2)
+ throws InvocationException;
+
+ /**
+ * Handles a {@link TableService#startTableNow} request.
+ */
+ public void startTableNow (ClientObject caller, int arg1, InvocationService.InvocationListener arg2)
+ throws InvocationException;
+}