com.threerings.whirled.zone.server
Class ZoneRegistry

java.lang.Object
  extended by com.threerings.whirled.zone.server.ZoneRegistry
All Implemented Interfaces:
com.threerings.presents.server.InvocationProvider, ZoneProvider
Direct Known Subclasses:
PeeredZoneRegistry

public class ZoneRegistry
extends Object
implements ZoneProvider

The zone registry takes care of mapping zone requests to the appropriate registered zone manager.


Constructor Summary
ZoneRegistry(com.threerings.presents.server.InvocationManager invmgr)
          Creates a zone manager with the supplied configuration.
 
Method Summary
 ZoneManager getZoneManager(int qualifiedZoneId)
          Returns the zone manager that handles the specified zone id.
 String leaveOccupiedZone(ZonedBodyObject source)
          Ejects the specified body from their current scene and zone.
 String moveBody(ZonedBodyObject source, int zoneId, int sceneId)
          Ejects the specified body from their current scene and sends them a request to move to the specified new zone and scene.
 void moveTo(com.threerings.presents.data.ClientObject caller, int zoneId, int sceneId, int sceneVer, ZoneService.ZoneMoveListener listener)
          Handles a ZoneService.moveTo(int, int, int, com.threerings.whirled.zone.client.ZoneService.ZoneMoveListener) request.
 void registerZoneManager(byte zoneType, ZoneManager manager)
          Registers the supplied zone manager as the manager for the specified zone type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZoneRegistry

@Inject
public ZoneRegistry(com.threerings.presents.server.InvocationManager invmgr)
Creates a zone manager with the supplied configuration.

Method Detail

registerZoneManager

public void registerZoneManager(byte zoneType,
                                ZoneManager manager)
Registers the supplied zone manager as the manager for the specified zone type. Zone types are 7 bits and managers are responsible for making sure they don't use a zone type that collides with another manager (given that we have only three zone types at present, this doesn't seem unreasonable).


getZoneManager

public ZoneManager getZoneManager(int qualifiedZoneId)
Returns the zone manager that handles the specified zone id.

Parameters:
qualifiedZoneId - the qualified zone id for which the manager should be looked up.

moveBody

public String moveBody(ZonedBodyObject source,
                       int zoneId,
                       int sceneId)
Ejects the specified body from their current scene and sends them a request to move to the specified new zone and scene. This is the zone-equivalent to LocationProvider.moveTo(com.threerings.presents.data.ClientObject, int, com.threerings.crowd.client.LocationService.MoveListener).

Returns:
null if the user was forcibly moved, or a string indicating the reason for denial of departure of their current zone (from ZoneManager.ratifyBodyExit(com.threerings.crowd.data.BodyObject)).

leaveOccupiedZone

public String leaveOccupiedZone(ZonedBodyObject source)
Ejects the specified body from their current scene and zone. This is the zone equivalent to LocationProvider.leavePlace(com.threerings.presents.data.ClientObject).

Returns:
null if the user was forcibly moved, or a string indicating the reason for denial of departure of their current zone (from ZoneManager.ratifyBodyExit(com.threerings.crowd.data.BodyObject)).

moveTo

public void moveTo(com.threerings.presents.data.ClientObject caller,
                   int zoneId,
                   int sceneId,
                   int sceneVer,
                   ZoneService.ZoneMoveListener listener)
            throws com.threerings.presents.server.InvocationException
Description copied from interface: ZoneProvider
Handles a ZoneService.moveTo(int, int, int, com.threerings.whirled.zone.client.ZoneService.ZoneMoveListener) request.

Specified by:
moveTo in interface ZoneProvider
Throws:
com.threerings.presents.server.InvocationException


Copyright © 2011. All Rights Reserved.