From 027bb29769fbb71c90f23e9f4a623b0df5d92049 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 1 Oct 2001 22:14:55 +0000 Subject: [PATCH] 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 --- .../crowd/chat/client/ChatDirector.java | 21 +++++----- .../crowd/chat/client/ChatDisplay.java | 13 +++--- .../crowd/chat/client/ChatService.java | 29 ++++--------- .../threerings/crowd/chat/data/ChatCodes.java | 41 +++++++++++++++++++ .../crowd/chat/server/ChatProvider.java | 17 +++++--- .../crowd/client/LocationCodes.java | 41 +++++++++++++++++++ .../crowd/client/LocationDirector.java | 12 +++--- .../crowd/client/LocationService.java | 15 +++---- .../crowd/client/OccupantManager.java | 4 +- .../crowd/server/LocationProvider.java | 25 +++++------ .../threerings/crowd/util/CrowdContext.java | 8 ++-- .../presents/client/Communicator.java | 5 +-- .../presents/client/InvocationCodes.java | 20 +++++++++ .../presents/net/AuthResponseData.java | 14 ++++--- .../presents/server/DummyAuthenticator.java | 5 +-- .../threerings/presents/util/CherCodes.java | 17 -------- .../threerings/crowd/client/TestClient.java | 12 +++--- 17 files changed, 186 insertions(+), 113 deletions(-) create mode 100644 src/java/com/threerings/crowd/chat/data/ChatCodes.java create mode 100644 src/java/com/threerings/crowd/client/LocationCodes.java create mode 100644 src/java/com/threerings/presents/client/InvocationCodes.java delete mode 100644 src/java/com/threerings/presents/util/CherCodes.java diff --git a/src/java/com/threerings/crowd/chat/client/ChatDirector.java b/src/java/com/threerings/crowd/chat/client/ChatDirector.java index 574e7ab87..f4e041d55 100644 --- a/src/java/com/threerings/crowd/chat/client/ChatDirector.java +++ b/src/java/com/threerings/crowd/chat/client/ChatDirector.java @@ -1,5 +1,5 @@ // -// $Id: ChatDirector.java,v 1.6 2001/08/22 00:08:39 mdb Exp $ +// $Id: ChatDirector.java,v 1.7 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.chat; @@ -7,7 +7,6 @@ import java.util.ArrayList; import com.threerings.cocktail.cher.client.*; import com.threerings.cocktail.cher.dobj.*; -import com.threerings.cocktail.cher.util.Codes; import com.threerings.cocktail.party.Log; import com.threerings.cocktail.party.client.LocationObserver; @@ -15,20 +14,20 @@ import com.threerings.cocktail.party.data.PlaceObject; import com.threerings.cocktail.party.util.PartyContext; /** - * The chat manager is the client side coordinator of all chat related + * The chat director is the client side coordinator of all chat related * services. It handles both place constrainted chat as well as direct * messaging. */ -public class ChatManager - implements LocationObserver, Subscriber, InvocationReceiver +public class ChatDirector + implements LocationObserver, Subscriber, InvocationReceiver, ChatCodes { /** - * Creates a chat manager and initializes it with the supplied - * context. The chat manager will register itself as a location + * Creates a chat director and initializes it with the supplied + * context. The chat director will register itself as a location * observer so that it can automatically process place constrained * chat. */ - public ChatManager (PartyContext ctx) + public ChatDirector (PartyContext ctx) { // keep the context around _ctx = ctx; @@ -39,12 +38,12 @@ public class ChatManager public void clientDidLogon (Client client) { client.getInvocationManager().registerReceiver( - ChatService.MODULE, ChatManager.this); + MODULE_NAME, ChatDirector.this); } }); // register ourselves as a location observer - _ctx.getLocationManager().addLocationObserver(this); + _ctx.getLocationDirector().addLocationObserver(this); } /** @@ -183,7 +182,7 @@ public class ChatManager // pass this on to our chat displays for (int i = 0; i < _displays.size(); i++) { ChatDisplay display = (ChatDisplay)_displays.get(i); - display.handleResponse(invid, Codes.SUCCESS); + display.handleResponse(invid, SUCCESS); } } diff --git a/src/java/com/threerings/crowd/chat/client/ChatDisplay.java b/src/java/com/threerings/crowd/chat/client/ChatDisplay.java index 284d19365..eb50e95ad 100644 --- a/src/java/com/threerings/crowd/chat/client/ChatDisplay.java +++ b/src/java/com/threerings/crowd/chat/client/ChatDisplay.java @@ -1,5 +1,5 @@ // -// $Id: ChatDisplay.java,v 1.1 2001/08/02 23:46:47 mdb Exp $ +// $Id: ChatDisplay.java,v 1.2 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.chat; @@ -36,10 +36,9 @@ public interface ChatDisplay * Called in response to a chat request (either speak or tell) that * originated on this client. The request id supplied will match the * one returned when the request was generated and the status will - * either indicate success (by being equal to - * Codes.SUCCESS) or failure (in which case it will - * contain a message failure code which can be converted into a - * displayable string). + * either indicate success (by being equal to SUCCESS) or + * failure (in which case it will contain a message failure code which + * can be converted into a displayable string). * *

A chat display should track outstanding chat requests so that * it can properly handle the response when it arrives. @@ -49,8 +48,8 @@ public interface ChatDisplay * @param status the message code indicating whether the chat request * was successful or not. * - * @see ChatManager#requestSpeak - * @see ChatManager#requestTell + * @see ChatDirector#requestSpeak + * @see ChatDirector#requestTell */ public void handleResponse (int reqid, String status); } diff --git a/src/java/com/threerings/crowd/chat/client/ChatService.java b/src/java/com/threerings/crowd/chat/client/ChatService.java index c35220418..d28d51a5b 100644 --- a/src/java/com/threerings/crowd/chat/client/ChatService.java +++ b/src/java/com/threerings/crowd/chat/client/ChatService.java @@ -1,5 +1,5 @@ // -// $Id: ChatService.java,v 1.3 2001/08/04 02:54:28 mdb Exp $ +// $Id: ChatService.java,v 1.4 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.chat; @@ -11,27 +11,12 @@ import com.threerings.cocktail.party.Log; * The chat services provide a mechanism by which the client can broadcast * chat messages to all clients that are subscribed to a particular place * object or directly to a particular client. These services should not be - * used directly, but instead should be accessed via the chat manager. + * used directly, but instead should be accessed via the chat director. * - * @see ChatManager + * @see ChatDirector */ -public class ChatService +public class ChatService implements ChatCodes { - /** The module name for the chat services. */ - public static final String MODULE = "chat"; - - /** The message identifier for a speak request message. */ - public static final String SPEAK_REQUEST = "spkreq"; - - /** The message identifier for a speak notification message. */ - public static final String SPEAK_NOTIFICATION = "spknot"; - - /** The message identifier for a tell request. */ - public static final String TELL_REQUEST = "Tell"; - - /** The message identifier for a tell notification. */ - public static final String TELL_NOTIFICATION = "Tell"; - /** * Requests that a tell message be delivered to the user with username * equal to target. @@ -40,18 +25,18 @@ public class ChatService * @param target the username of the user to which the tell message * should be delivered. * @param message the contents of the message. - * @param rsptarget the chat manager reference that will receive the + * @param rsptarget the chat director reference that will receive the * tell response. * * @return the invocation request id of the generated tell request. */ public static int tell (Client client, String target, String message, - ChatManager rsptarget) + ChatDirector rsptarget) { InvocationManager invmgr = client.getInvocationManager(); Object[] args = new Object[] { target, message }; Log.info("Sending tell request [tgt=" + target + ", msg=" + message + "]."); - return invmgr.invoke(MODULE, TELL_REQUEST, args, rsptarget); + return invmgr.invoke(MODULE_NAME, TELL_REQUEST, args, rsptarget); } } diff --git a/src/java/com/threerings/crowd/chat/data/ChatCodes.java b/src/java/com/threerings/crowd/chat/data/ChatCodes.java new file mode 100644 index 000000000..efcaad93b --- /dev/null +++ b/src/java/com/threerings/crowd/chat/data/ChatCodes.java @@ -0,0 +1,41 @@ +// +// $Id: ChatCodes.java,v 1.1 2001/10/01 22:14:55 mdb Exp $ + +package com.threerings.cocktail.party.chat; + +import com.threerings.cocktail.cher.client.InvocationCodes; + +/** + * Contains codes used by the chat invocation services. + */ +public interface ChatCodes extends InvocationCodes +{ + /** The module name for the chat services. */ + public static final String MODULE_NAME = "chat"; + + /** The message identifier for a speak request message. */ + public static final String SPEAK_REQUEST = "spkreq"; + + /** The message identifier for a speak notification message. */ + public static final String SPEAK_NOTIFICATION = "spknot"; + + /** The message identifier for a tell request. */ + public static final String TELL_REQUEST = "Tell"; + + /** The response identifier for a successful tell request. This is + * mapped by the invocation services to a call to {@link + * ChatDirector#handleTellSucceded}. */ + public static final String TELL_SUCCEEDED_RESPONSE = "TellSucceeded"; + + /** The response identifier for a failed tell request. This is mapped + * by the invocation services to a call to {@link + * ChatDirector#handleTellFailed}. */ + public static final String TELL_FAILED_RESPONSE = "TellFailed"; + + /** The message identifier for a tell notification. */ + public static final String TELL_NOTIFICATION = "Tell"; + + /** An error code delivered when the user targeted for a tell + * notification is not online. */ + public static final String USER_NOT_ONLINE = "m.user_not_online"; +} diff --git a/src/java/com/threerings/crowd/chat/server/ChatProvider.java b/src/java/com/threerings/crowd/chat/server/ChatProvider.java index 6284cffa6..dd8c1c4c2 100644 --- a/src/java/com/threerings/crowd/chat/server/ChatProvider.java +++ b/src/java/com/threerings/crowd/chat/server/ChatProvider.java @@ -1,5 +1,5 @@ // -// $Id: ChatProvider.java,v 1.3 2001/08/11 00:05:58 mdb Exp $ +// $Id: ChatProvider.java,v 1.4 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.chat; @@ -7,7 +7,12 @@ import com.threerings.cocktail.cher.server.InvocationProvider; import com.threerings.cocktail.party.data.BodyObject; import com.threerings.cocktail.party.server.PartyServer; -public class ChatProvider extends InvocationProvider +/** + * The chat provider handles the server side of the chat-related + * invocation services. + */ +public class ChatProvider + extends InvocationProvider implements ChatCodes { /** * Processes a request from a client to deliver a tell message to @@ -19,15 +24,15 @@ public class ChatProvider extends InvocationProvider // look up the target body object BodyObject tobj = PartyServer.lookupBody(target); if (tobj == null) { - sendResponse(source, invid, "TellFailed", "m.player_not_online"); + sendResponse(source, invid, TELL_FAILED_RESPONSE, + USER_NOT_ONLINE); } // deliver a tell notification to the target player Object[] args = new Object[] { source.username, message }; PartyServer.invmgr.sendNotification( - tobj.getOid(), ChatService.MODULE, ChatService.TELL_NOTIFICATION, - args); + tobj.getOid(), MODULE_NAME, TELL_NOTIFICATION, args); - sendResponse(source, invid, "TellSucceeded"); + sendResponse(source, invid, TELL_SUCCEEDED_RESPONSE); } } diff --git a/src/java/com/threerings/crowd/client/LocationCodes.java b/src/java/com/threerings/crowd/client/LocationCodes.java new file mode 100644 index 000000000..d9bf2b1d2 --- /dev/null +++ b/src/java/com/threerings/crowd/client/LocationCodes.java @@ -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"; +} diff --git a/src/java/com/threerings/crowd/client/LocationDirector.java b/src/java/com/threerings/crowd/client/LocationDirector.java index 2dc15eebc..9e8669b20 100644 --- a/src/java/com/threerings/crowd/client/LocationDirector.java +++ b/src/java/com/threerings/crowd/client/LocationDirector.java @@ -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 + "]."); } diff --git a/src/java/com/threerings/crowd/client/LocationService.java b/src/java/com/threerings/crowd/client/LocationService.java index 8c1a4a061..298e42a95 100644 --- a/src/java/com/threerings/crowd/client/LocationService.java +++ b/src/java/com/threerings/crowd/client/LocationService.java @@ -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 + "]."); } } diff --git a/src/java/com/threerings/crowd/client/OccupantManager.java b/src/java/com/threerings/crowd/client/OccupantManager.java index c2d10cff5..a261bda04 100644 --- a/src/java/com/threerings/crowd/client/OccupantManager.java +++ b/src/java/com/threerings/crowd/client/OccupantManager.java @@ -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); } /** diff --git a/src/java/com/threerings/crowd/server/LocationProvider.java b/src/java/com/threerings/crowd/server/LocationProvider.java index 0e9d461d4..54749b6ff 100644 --- a/src/java/com/threerings/crowd/server/LocationProvider.java +++ b/src/java/com/threerings/crowd/server/LocationProvider.java @@ -1,20 +1,21 @@ // -// $Id: LocationProvider.java,v 1.7 2001/08/20 20:54:57 mdb Exp $ +// $Id: LocationProvider.java,v 1.8 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.server; import com.threerings.cocktail.cher.dobj.DObject; import com.threerings.cocktail.cher.server.InvocationProvider; -import com.threerings.cocktail.cher.util.Codes; import com.threerings.cocktail.party.Log; +import com.threerings.cocktail.party.client.LocationCodes; import com.threerings.cocktail.party.data.*; import com.threerings.cocktail.party.server.PartyServer; /** * This class provides the server end of the location services. */ -public class LocationProvider extends InvocationProvider +public class LocationProvider + extends InvocationProvider implements LocationCodes { /** * Processes a request from a client to move to a new place. @@ -26,10 +27,10 @@ public class LocationProvider extends InvocationProvider String rcode = moveTo(source, placeId); // send the response - if (rcode.equals(Codes.SUCCESS)) { - sendResponse(source, invid, "MoveSucceeded"); + if (rcode.equals(SUCCESS)) { + sendResponse(source, invid, MOVE_SUCCEEDED_RESPONSE); } else { - sendResponse(source, invid, "MoveFailed", rcode); + sendResponse(source, invid, MOVE_FAILED_RESPONSE, rcode); } } @@ -37,8 +38,8 @@ public class LocationProvider extends InvocationProvider * Moves the specified body from whatever location they currently * occupy to the location identified by the supplied place id. * - * @return the string Codes.SUCCESS if the move was - * successful or a reason code for failure if not. + * @return the string SUCCESS if the move was successful + * or a reason code for failure if not. */ public static String moveTo (BodyObject source, int placeId) { @@ -49,7 +50,7 @@ public class LocationProvider extends InvocationProvider if (pmgr == null) { Log.info("Requested to move to non-existent place " + "[source=" + source + ", place=" + placeId + "]."); - return "m.no_such_place"; + return NO_SUCH_PLACE; } // acquire a lock on the body object to ensure that rapid fire @@ -57,13 +58,13 @@ public class LocationProvider extends InvocationProvider if (!source.acquireLock("moveToLock")) { // if we're still locked, a previous moveTo request hasn't // been fully processed - return "m.move_in_progress"; + return MOVE_IN_PROGRESS; } // make sure they're not already in the location they're asking to // move to if (source.location == placeId) { - return "m.already_there"; + return ALREADY_THERE; } // find out if they were previously in some other location @@ -111,6 +112,6 @@ public class LocationProvider extends InvocationProvider // once all these events are processed source.releaseLock("moveToLock"); - return Codes.SUCCESS; + return SUCCESS; } } diff --git a/src/java/com/threerings/crowd/util/CrowdContext.java b/src/java/com/threerings/crowd/util/CrowdContext.java index 06c2cc027..6c8a73d30 100644 --- a/src/java/com/threerings/crowd/util/CrowdContext.java +++ b/src/java/com/threerings/crowd/util/CrowdContext.java @@ -1,10 +1,10 @@ // -// $Id: CrowdContext.java,v 1.3 2001/08/20 21:45:37 mdb Exp $ +// $Id: CrowdContext.java,v 1.4 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.util; import com.threerings.cocktail.cher.util.CherContext; -import com.threerings.cocktail.party.client.LocationManager; +import com.threerings.cocktail.party.client.LocationDirector; import com.threerings.cocktail.party.client.OccupantManager; /** @@ -14,9 +14,9 @@ import com.threerings.cocktail.party.client.OccupantManager; public interface PartyContext extends CherContext { /** - * Returns a reference to the location manager. + * Returns a reference to the location director. */ - public LocationManager getLocationManager (); + public LocationDirector getLocationDirector (); /** * Returns a reference to the occupant manager. diff --git a/src/java/com/threerings/presents/client/Communicator.java b/src/java/com/threerings/presents/client/Communicator.java index 867bf43bc..a5445f1be 100644 --- a/src/java/com/threerings/presents/client/Communicator.java +++ b/src/java/com/threerings/presents/client/Communicator.java @@ -1,5 +1,5 @@ // -// $Id: Communicator.java,v 1.13 2001/08/07 20:38:58 mdb Exp $ +// $Id: Communicator.java,v 1.14 2001/10/01 22:14:54 mdb Exp $ package com.threerings.cocktail.cher.client; @@ -15,7 +15,6 @@ import com.threerings.cocktail.cher.dobj.DObjectManager; import com.threerings.cocktail.cher.io.*; import com.threerings.cocktail.cher.io.ObjectStreamException; import com.threerings.cocktail.cher.net.*; -import com.threerings.cocktail.cher.util.Codes; /** * The client performs all network I/O on separate threads (one for @@ -340,7 +339,7 @@ public class Communicator // if the auth request failed, we want to let the communicator // know by throwing a logon exception - if (!data.code.equals(Codes.SUCCESS)) { + if (!data.code.equals(AuthResponseData.SUCCESS)) { throw new LogonException(data.code); } diff --git a/src/java/com/threerings/presents/client/InvocationCodes.java b/src/java/com/threerings/presents/client/InvocationCodes.java new file mode 100644 index 000000000..9f5318944 --- /dev/null +++ b/src/java/com/threerings/presents/client/InvocationCodes.java @@ -0,0 +1,20 @@ +// +// $Id: InvocationCodes.java,v 1.1 2001/10/01 22:14:54 mdb Exp $ + +package com.threerings.cocktail.cher.client; + +/** + * The invocation codes interface provides codes that are commonly used by + * invocation service implementations. It is implemented as an interface + * so that were an invocation service to desire to build on two or more + * other services, it can provide a codes interface that inherits from all + * of the services that it extends. + */ +public interface InvocationCodes +{ + /** + * Generally used in responses that can either have the value success, + * or a string code explaining the reason for failure. + */ + public static final String SUCCESS = "success"; +} diff --git a/src/java/com/threerings/presents/net/AuthResponseData.java b/src/java/com/threerings/presents/net/AuthResponseData.java index 97e6384c8..9f8a98ef1 100644 --- a/src/java/com/threerings/presents/net/AuthResponseData.java +++ b/src/java/com/threerings/presents/net/AuthResponseData.java @@ -1,5 +1,5 @@ // -// $Id: AuthResponseData.java,v 1.6 2001/07/19 07:09:16 mdb Exp $ +// $Id: AuthResponseData.java,v 1.7 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.cher.net; @@ -13,14 +13,18 @@ import com.threerings.cocktail.cher.dobj.DObject; */ public class AuthResponseData extends DObject { + /** The constant used to indicate a successful authentication. */ + public static final String SUCCESS = "success"; + /** - * Either the string "success" or a reason code for why authentication - * failed. + * Either the {@link #SUCCESS} constant or a reason code indicating + * why the authentication failed. */ public String code; - public String toString () + // documentation inherited + protected void toString (StringBuffer buf) { - return "[code=" + code + "]"; + buf.append(", code=").append(code); } } diff --git a/src/java/com/threerings/presents/server/DummyAuthenticator.java b/src/java/com/threerings/presents/server/DummyAuthenticator.java index ffab05bc3..3b9a9ac31 100644 --- a/src/java/com/threerings/presents/server/DummyAuthenticator.java +++ b/src/java/com/threerings/presents/server/DummyAuthenticator.java @@ -1,12 +1,11 @@ // -// $Id: DummyAuthenticator.java,v 1.2 2001/05/30 23:58:31 mdb Exp $ +// $Id: DummyAuthenticator.java,v 1.3 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.cher.server; import com.threerings.cocktail.cher.Log; import com.threerings.cocktail.cher.net.*; import com.threerings.cocktail.cher.server.net.Authenticator; -import com.threerings.cocktail.cher.util.Codes; public class DummyAuthenticator implements Authenticator { @@ -17,7 +16,7 @@ public class DummyAuthenticator implements Authenticator { Log.info("Accepting request: " + req); AuthResponseData rdata = new AuthResponseData(); - rdata.code = Codes.SUCCESS; + rdata.code = AuthResponseData.SUCCESS; return new AuthResponse(rdata); } } diff --git a/src/java/com/threerings/presents/util/CherCodes.java b/src/java/com/threerings/presents/util/CherCodes.java deleted file mode 100644 index a4f98e608..000000000 --- a/src/java/com/threerings/presents/util/CherCodes.java +++ /dev/null @@ -1,17 +0,0 @@ -// -// $Id: CherCodes.java,v 1.2 2001/05/30 23:58:31 mdb Exp $ - -package com.threerings.cocktail.cher.util; - -/** - * The Codes class serves as a repository for miscellaneous - * string and integer constants used by componenets of the Cher system. - */ -public class Codes -{ - /** - * Generally used in responses that can either have the value success, - * or a string code explaining the reason for failure. - */ - public static final String SUCCESS = "success"; -} diff --git a/tests/src/java/com/threerings/crowd/client/TestClient.java b/tests/src/java/com/threerings/crowd/client/TestClient.java index 333168b53..2560bc7f2 100644 --- a/tests/src/java/com/threerings/crowd/client/TestClient.java +++ b/tests/src/java/com/threerings/crowd/client/TestClient.java @@ -1,5 +1,5 @@ // -// $Id: TestClient.java,v 1.3 2001/08/20 22:10:49 mdb Exp $ +// $Id: TestClient.java,v 1.4 2001/10/01 22:14:55 mdb Exp $ package com.threerings.cocktail.party.client.test; @@ -25,7 +25,7 @@ public class TestClient // create the handles on our various services _config = new Config(); _client = new Client(creds, this); - _locmgr = new LocationManager(_ctx); + _locdir = new LocationDirector(_ctx); _occmgr = new OccupantManager(_ctx); // we want to know about logon/logoff @@ -58,7 +58,7 @@ public class TestClient Log.info("Client did logon [client=" + client + "]."); // request to move to a place - _ctx.getLocationManager().moveTo(15); + _ctx.getLocationDirector().moveTo(15); } public void clientFailedToLogon (Client client, Exception cause) @@ -112,9 +112,9 @@ public class TestClient return _client.getDObjectManager(); } - public LocationManager getLocationManager () + public LocationDirector getLocationDirector () { - return _locmgr; + return _locdir; } public OccupantManager getOccupantManager () @@ -125,7 +125,7 @@ public class TestClient protected Config _config; protected Client _client; - protected LocationManager _locmgr; + protected LocationDirector _locdir; protected OccupantManager _occmgr; protected PartyContext _ctx;