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:
Michael Bayne
2001-10-01 22:14:55 +00:00
parent 543f977475
commit 027bb29769
17 changed files with 186 additions and 113 deletions
@@ -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);
}
@@ -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";
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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 <code>Codes</code> 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";
}