com.threerings.micasa.lobby

## Class LobbyRegistry

- java.lang.Object
- - com.threerings.micasa.lobby.LobbyRegistry

All Implemented Interfaces:
  LobbyProvider, com.threerings.presents.server.InvocationProvider

    public class LobbyRegistry
    extends Object
    implements LobbyProvider

The lobby registry is the primary class that coordinates the lobby services on the client. It sets up the necessary invocation services and keeps track of the lobbies in operation on the server. Only one lobby registry should be created on a server.

Presently, the lobby registry is configured with lobbies via the server configuration. An example configuration follows:

     lobby_ids = foolobby, barlobby, bazlobby

     foolobby.mgrclass = com.threerings.micasa.lobby.LobbyManager
     foolobby.ugi = <universal game identifier>
     foolobby.name = <human readable lobby name>
     foolobby.config1 = some config value
     foolobby.config2 = some other config value

     barlobby.mgrclass = com.threerings.micasa.lobby.LobbyManager
     barlobby.ugi = <universal game identifier>
     barlobby.name = <human readable lobby name>
     ...

This information will be loaded from the MiCasa server configuration which means that it should live in `rsrc/config/micasa/server.properties` somwhere in the classpath where it will override the default MiCasa server properties file.

The `UGI` or universal game identifier is a string that is used to uniquely identify every type of game and also to classify it according to meaningful keywords. It is best described with a few examples:

     backgammon,board,strategy
     spades,card,partner
     yahtzee,dice

As you can see, a UGI should start with an identifier uniquely identifying the type of game and can be followed by a list of keywords that classify it as a member of a particular category of games (eg. board, card, dice, partner game, strategy game). A game can belong to multiple categories.

As long as the UGIs in use by a particular server make some kind of sense, the client will be able to use them to search for lobbies containing games of similar types using the provided facilities.

### Constructor Summary

Constructors
Constructor and Description
`LobbyRegistry(com.threerings.presents.server.InvocationManager invmgr)`

### Method Summary

All Methods Instance Methods Concrete Methods
`String[]` `getCategories(com.threerings.crowd.data.BodyObject requester)` Returns an array containing the category identifiers of all the categories in which lobbies have been registered with the registry.
`void` `getCategories(com.threerings.presents.data.ClientObject caller, LobbyService.CategoriesListener listener)` Processes a request by the client to obtain a list of the lobby categories available on this server.
`int` `getDefaultLobbyOid()` Returns the oid of the default lobby.
`void` `getLobbies(com.threerings.crowd.data.BodyObject requester, String category, List<Lobby> target)` Returns information about all lobbies hosting games in the specified category.
`void` `getLobbies(com.threerings.presents.data.ClientObject caller, String category, LobbyService.LobbiesListener listener)` Processes a request by the client to obtain a list of lobbies matching the supplied category string.
`void` `init()` Initializes the registry, creating our default lobbies.

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

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

### Constructor Detail

#### LobbyRegistry

    @Inject
    public LobbyRegistry(com.threerings.presents.server.InvocationManager invmgr)

### Method Detail

#### init

    public void init()

Initializes the registry, creating our default lobbies.

#### getDefaultLobbyOid

    public int getDefaultLobbyOid()

Returns the oid of the default lobby.

#### getLobbies

    public void getLobbies(com.threerings.crowd.data.BodyObject requester,
                           String category,
                           List<Lobby> target)

Returns information about all lobbies hosting games in the specified category.

Parameters:
  `requester` - the body object of the client requesting the lobby list (which can be used to filter the list based on their capabilities).
  `category` - the category of game for which the lobbies are desired.
  `target` - the list into which the matching lobbies will be deposited.

#### getCategories

    public String[] getCategories(com.threerings.crowd.data.BodyObject requester)

Returns an array containing the category identifiers of all the categories in which lobbies have been registered with the registry.

Parameters:
  `requester` - the body object of the client requesting the category list (which can be used to filter the list based on their capabilities).

#### getCategories

    public void getCategories(com.threerings.presents.data.ClientObject caller,
                              LobbyService.CategoriesListener listener)

Processes a request by the client to obtain a list of the lobby categories available on this server.

Specified by:
  `getCategories` in interface `LobbyProvider`

#### getLobbies

    public void getLobbies(com.threerings.presents.data.ClientObject caller,
                           String category,
                           LobbyService.LobbiesListener listener)

Processes a request by the client to obtain a list of lobbies matching the supplied category string.

Specified by:
  `getLobbies` in interface `LobbyProvider`