Created fooCodes interfaces to go along with invocation service
packages. These contain all the message codes as well as error response codes that are used by a particular invocation service. Also changed client.LocationManager to client.LocationDirector and chat.ChatManager to chat.ChatDirector to go along with the new philosophy of naming the client-side managing entity for an invocation service a director. Also elimitated cocktail.util.Codes since it's no longer used as a central repository for codes (instead they are in InvocationCodes and its derivatives). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@368 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// $Id: LocationCodes.java,v 1.1 2001/10/01 22:14:55 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.client;
|
||||
|
||||
import com.threerings.cocktail.cher.client.InvocationCodes;
|
||||
|
||||
/**
|
||||
* Contains codes used by the location invocation services.
|
||||
*/
|
||||
public interface LocationCodes extends InvocationCodes
|
||||
{
|
||||
/** The module name for the location services. */
|
||||
public static final String MODULE_NAME = "location";
|
||||
|
||||
/** The message identifier for a moveTo request. */
|
||||
public static final String MOVE_TO_REQUEST = "MoveTo";
|
||||
|
||||
/** The response identifier for a successful moveTo request. This is
|
||||
* mapped by the invocation services to a call to {@link
|
||||
* LocationDirector#handleMoveSucceeded}. */
|
||||
public static final String MOVE_SUCCEEDED_RESPONSE = "MoveSucceeded";
|
||||
|
||||
/** The response identifier for a failed moveTo request. This is
|
||||
* mapped by the invocation services to a call to {@link
|
||||
* LocationDirector#handleMoveFailed}. */
|
||||
public static final String MOVE_FAILED_RESPONSE = "MoveFailed";
|
||||
|
||||
/** An error code indicating that a place identified by a particular
|
||||
* place id does not exist. Usually generated by a failed moveTo
|
||||
* request. */
|
||||
public static final String NO_SUCH_PLACE = "m.no_such_place";
|
||||
|
||||
/** An error code sent when a user requests to move to a new place but
|
||||
* they are in the middle of moving somewhere already. */
|
||||
public static final String MOVE_IN_PROGRESS = "m.move_in_progress";
|
||||
|
||||
/** An error code sent when a user requests to move to a place, but
|
||||
* they are already in the requested place. */
|
||||
public static final String ALREADY_THERE = "m.already_there";
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LocationDirector.java,v 1.8 2001/08/14 06:49:28 mdb Exp $
|
||||
// $Id: LocationDirector.java,v 1.9 2001/10/01 22:14:55 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.client;
|
||||
|
||||
@@ -15,16 +15,16 @@ import com.threerings.cocktail.party.data.PlaceObject;
|
||||
import com.threerings.cocktail.party.util.PartyContext;
|
||||
|
||||
/**
|
||||
* The location manager provides a means by which entities on the client
|
||||
* The location director provides a means by which entities on the client
|
||||
* can request to move from place to place and can be notified if other
|
||||
* entities have caused the client to move to a new place. It also
|
||||
* provides a mechanism for ratifying a request to move to a new place
|
||||
* before actually issuing the request.
|
||||
*/
|
||||
public class LocationManager
|
||||
public class LocationDirector
|
||||
implements ClientObserver, Subscriber
|
||||
{
|
||||
public LocationManager (PartyContext ctx)
|
||||
public LocationDirector (PartyContext ctx)
|
||||
{
|
||||
// keep this around for later
|
||||
_ctx = ctx;
|
||||
@@ -123,7 +123,7 @@ public class LocationManager
|
||||
* This can be called by derived classes that need to coopt the moving
|
||||
* process to extend it in some way or other. In such situations, they
|
||||
* will be responsible for receiving the successful move response and
|
||||
* they should let the location manager know that the move has been
|
||||
* they should let the location director know that the move has been
|
||||
* effected.
|
||||
*
|
||||
* @param placeId the place oid of our new location.
|
||||
@@ -172,7 +172,7 @@ public class LocationManager
|
||||
|
||||
public void requestFailed (int oid, ObjectAccessException cause)
|
||||
{
|
||||
Log.warning("Location manager unable to fetch body " +
|
||||
Log.warning("Location director unable to fetch body " +
|
||||
"object; all has gone horribly wrong" +
|
||||
"[cause=" + cause + "].");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LocationService.java,v 1.1 2001/07/23 21:14:27 mdb Exp $
|
||||
// $Id: LocationService.java,v 1.2 2001/10/01 22:14:55 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.client;
|
||||
|
||||
@@ -11,25 +11,22 @@ import com.threerings.cocktail.party.Log;
|
||||
* The location services provide a mechanism by which the client can
|
||||
* request to move from place to place in the server. These services
|
||||
* should not be used directly, but instead should be accessed via the
|
||||
* location manager.
|
||||
* location director.
|
||||
*
|
||||
* @see LocationManager
|
||||
* @see LocationDirector
|
||||
*/
|
||||
public class LocationService
|
||||
public class LocationService implements LocationCodes
|
||||
{
|
||||
/** The module name for the location services. */
|
||||
public static final String MODULE = "location";
|
||||
|
||||
/**
|
||||
* Requests that that this client's body be moved to the specified
|
||||
* location.
|
||||
*/
|
||||
public static void moveTo (Client client, int placeId,
|
||||
LocationManager rsptarget)
|
||||
LocationDirector rsptarget)
|
||||
{
|
||||
InvocationManager invmgr = client.getInvocationManager();
|
||||
Object[] args = new Object[] { new Integer(placeId) };
|
||||
invmgr.invoke(MODULE, "MoveTo", args, rsptarget);
|
||||
invmgr.invoke(MODULE_NAME, MOVE_TO_REQUEST, args, rsptarget);
|
||||
Log.info("Sent moveTo request [place=" + placeId + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: OccupantManager.java,v 1.3 2001/08/21 19:37:08 mdb Exp $
|
||||
// $Id: OccupantManager.java,v 1.4 2001/10/01 22:14:55 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.client;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class OccupantManager
|
||||
public OccupantManager (PartyContext ctx)
|
||||
{
|
||||
// register ourselves as a location observer
|
||||
ctx.getLocationManager().addLocationObserver(this);
|
||||
ctx.getLocationDirector().addLocationObserver(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user