com.threerings.parlor.server

## Class TableManager

- java.lang.Object
- - com.threerings.parlor.server.TableManager

All Implemented Interfaces:
  ParlorCodes, TableProvider, com.threerings.presents.data.InvocationCodes, com.threerings.presents.server.InvocationProvider

    public class TableManager
    extends Object
    implements ParlorCodes, TableProvider

A table manager can be used by a place manager (or other entity) to take care of the management of a table matchmaking service on a particular distributed object.

### Field Summary

### Fields inherited from interface com.threerings.parlor.data.ParlorCodes

`ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED`

### Fields inherited from interface com.threerings.presents.data.InvocationCodes

`ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR`

### Constructor Summary

Constructors
Constructor and Description
`TableManager(com.threerings.presents.dobj.RootDObjectManager omgr, com.threerings.presents.server.InvocationManager invmgr, com.threerings.crowd.server.PlaceRegistry plreg, com.threerings.presents.dobj.DObject tableObject)` Creates a table manager that will manage tables in the supplied distributed object (which must implement `TableLobbyObject`.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `bootPlayer(com.threerings.presents.data.ClientObject caller, int tableId, com.threerings.util.Name target, com.threerings.presents.client.InvocationService.InvocationListener listener)` Handles a `TableService.bootPlayer(int, com.threerings.util.Name, com.threerings.presents.client.InvocationService.InvocationListener)` request.
`Table` `createTable(com.threerings.crowd.data.BodyObject creator, TableConfig tableConfig, GameConfig config)` Creates a table for the specified creator and returns said table.
`void` `createTable(com.threerings.presents.data.ClientObject caller, TableConfig tableConfig, GameConfig config, com.threerings.presents.client.InvocationService.ResultListener listener)` Handles a `TableService.createTable(com.threerings.parlor.data.TableConfig, com.threerings.parlor.game.data.GameConfig, com.threerings.presents.client.InvocationService.ResultListener)` request.
`int` `getTableCount()` Returns the number of tables being managed currently.
`void` `joinTable(com.threerings.presents.data.ClientObject caller, int tableId, int position, com.threerings.presents.client.InvocationService.InvocationListener listener)` Handles a `TableService.joinTable(int, int, com.threerings.presents.client.InvocationService.InvocationListener)` request.
`void` `leaveTable(com.threerings.presents.data.ClientObject caller, int tableId, com.threerings.presents.client.InvocationService.InvocationListener listener)` Handles a `TableService.leaveTable(int, com.threerings.presents.client.InvocationService.InvocationListener)` request.
`void` `setAllowBooting(boolean allowBooting)` Allow a player in the first position of a table to boot others.
`void` `setTableClass(Class<? extends Table> tableClass)` Set the subclass of Table that this instance should generate.
`void` `setTableObject(com.threerings.presents.dobj.DObject tableObject)` Initialize the TableLobbyObject.
`void` `shutdown()` This must be called when the table manager is no longer needed.
`void` `startTableNow(com.threerings.presents.data.ClientObject caller, int tableId, com.threerings.presents.client.InvocationService.InvocationListener listener)` Handles a `TableService.startTableNow(int, com.threerings.presents.client.InvocationService.InvocationListener)` request.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TableManager

    public TableManager(com.threerings.presents.dobj.RootDObjectManager omgr,
                        com.threerings.presents.server.InvocationManager invmgr,
                        com.threerings.crowd.server.PlaceRegistry plreg,
                        com.threerings.presents.dobj.DObject tableObject)

Creates a table manager that will manage tables in the supplied distributed object (which must implement `TableLobbyObject`.

### Method Detail

#### setTableObject

    public void setTableObject(com.threerings.presents.dobj.DObject tableObject)

Initialize the TableLobbyObject. Do not call this more than once.

#### getTableCount

    public int getTableCount()

Returns the number of tables being managed currently.

#### shutdown

    public void shutdown()

This must be called when the table manager is no longer needed.

#### setTableClass

    public void setTableClass(Class<? extends Table> tableClass)

Set the subclass of Table that this instance should generate.

#### setAllowBooting

    public void setAllowBooting(boolean allowBooting)

Allow a player in the first position of a table to boot others.

#### createTable

    public Table createTable(com.threerings.crowd.data.BodyObject creator,
                             TableConfig tableConfig,
                             GameConfig config)
                      throws com.threerings.presents.server.InvocationException

Creates a table for the specified creator and returns said table.

Throws:
  `com.threerings.presents.server.InvocationException` - thrown if the table could not be created for any reason.

#### createTable

    public void createTable(com.threerings.presents.data.ClientObject caller,
                            TableConfig tableConfig,
                            GameConfig config,
                            com.threerings.presents.client.InvocationService.ResultListener listener)
                     throws com.threerings.presents.server.InvocationException

Description copied from interface: `TableProvider`
Handles a `TableService.createTable(com.threerings.parlor.data.TableConfig, com.threerings.parlor.game.data.GameConfig, com.threerings.presents.client.InvocationService.ResultListener)` request.

Specified by:
  `createTable` in interface `TableProvider`
Throws:
  `com.threerings.presents.server.InvocationException`

#### joinTable

    public void joinTable(com.threerings.presents.data.ClientObject caller,
                          int tableId,
                          int position,
                          com.threerings.presents.client.InvocationService.InvocationListener listener)
                   throws com.threerings.presents.server.InvocationException

Description copied from interface: `TableProvider`
Handles a `TableService.joinTable(int, int, com.threerings.presents.client.InvocationService.InvocationListener)` request.

Specified by:
  `joinTable` in interface `TableProvider`
Throws:
  `com.threerings.presents.server.InvocationException`

#### leaveTable

    public void leaveTable(com.threerings.presents.data.ClientObject caller,
                           int tableId,
                           com.threerings.presents.client.InvocationService.InvocationListener listener)
                    throws com.threerings.presents.server.InvocationException

Description copied from interface: `TableProvider`
Handles a `TableService.leaveTable(int, com.threerings.presents.client.InvocationService.InvocationListener)` request.

Specified by:
  `leaveTable` in interface `TableProvider`
Throws:
  `com.threerings.presents.server.InvocationException`

#### startTableNow

    public void startTableNow(com.threerings.presents.data.ClientObject caller,
                              int tableId,
                              com.threerings.presents.client.InvocationService.InvocationListener listener)
                       throws com.threerings.presents.server.InvocationException

Description copied from interface: `TableProvider`
Handles a `TableService.startTableNow(int, com.threerings.presents.client.InvocationService.InvocationListener)` request.

Specified by:
  `startTableNow` in interface `TableProvider`
Throws:
  `com.threerings.presents.server.InvocationException`

#### bootPlayer

    public void bootPlayer(com.threerings.presents.data.ClientObject caller,
                           int tableId,
                           com.threerings.util.Name target,
                           com.threerings.presents.client.InvocationService.InvocationListener listener)
                    throws com.threerings.presents.server.InvocationException

Description copied from interface: `TableProvider`
Handles a `TableService.bootPlayer(int, com.threerings.util.Name, com.threerings.presents.client.InvocationService.InvocationListener)` request.

Specified by:
  `bootPlayer` in interface `TableProvider`
Throws:
  `com.threerings.presents.server.InvocationException`