Starting to wire up client/server dobj stuff.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@22 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AuthRequest.java,v 1.4 2001/05/30 23:58:31 mdb Exp $
|
||||
// $Id: AuthRequest.java,v 1.5 2001/06/02 01:30:37 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.net;
|
||||
|
||||
@@ -35,6 +35,11 @@ public class AuthRequest extends UpstreamMessage
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public Credentials getCredentials ()
|
||||
{
|
||||
return _creds;
|
||||
}
|
||||
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Credentials.java,v 1.4 2001/05/30 23:58:31 mdb Exp $
|
||||
// $Id: Credentials.java,v 1.5 2001/06/02 01:30:37 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.net;
|
||||
|
||||
@@ -14,8 +14,11 @@ import com.threerings.cocktail.cher.io.TypedObjectFactory;
|
||||
* Credentials are supplied by the client implementation and sent along to
|
||||
* the server during the authentication process. To provide support for a
|
||||
* variety of authentication methods, the credentials class is meant to be
|
||||
* subclassed for the particular method (ie. username + password) in use
|
||||
* in a given system.
|
||||
* subclassed for the particular method (ie. password, auth digest, etc.)
|
||||
* in use in a given system.
|
||||
*
|
||||
* <p> All credentials must provide a username as the username is used to
|
||||
* associate network connections with sessions.
|
||||
*
|
||||
* <p> All derived classes should provide a no argument constructor so
|
||||
* that they can be instantiated prior to reconstruction from a data input
|
||||
@@ -29,6 +32,27 @@ public abstract class Credentials implements TypedObject
|
||||
*/
|
||||
public static final short TYPE_BASE = 300;
|
||||
|
||||
/**
|
||||
* Constructs a credentials instance with the specified username.
|
||||
*/
|
||||
public Credentials (String username)
|
||||
{
|
||||
_username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a blank credentials instance in preparation for
|
||||
* unserializing from the network.
|
||||
*/
|
||||
public Credentials ()
|
||||
{
|
||||
}
|
||||
|
||||
public String getUsername ()
|
||||
{
|
||||
return _username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Derived classes should override this function to write their fields
|
||||
* out to the supplied data output stream. They <em>must</em> be sure
|
||||
@@ -37,7 +61,7 @@ public abstract class Credentials implements TypedObject
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
out.writeUTF(_username);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,6 +72,8 @@ public abstract class Credentials implements TypedObject
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
_username = in.readUTF();
|
||||
}
|
||||
|
||||
protected String _username;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: EventNotification.java,v 1.4 2001/05/30 23:59:16 mdb Exp $
|
||||
// $Id: EventNotification.java,v 1.5 2001/06/02 01:30:37 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.net;
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import com.threerings.cocktail.cher.dobj.Event;
|
||||
import com.threerings.cocktail.cher.dobj.DEvent;
|
||||
|
||||
public class EventNotification extends DownstreamMessage
|
||||
{
|
||||
@@ -25,7 +25,7 @@ public class EventNotification extends DownstreamMessage
|
||||
/**
|
||||
* Constructs an event notification for the supplied event.
|
||||
*/
|
||||
public EventNotification (Event event)
|
||||
public EventNotification (DEvent event)
|
||||
{
|
||||
_event = event;
|
||||
}
|
||||
@@ -50,5 +50,5 @@ public class EventNotification extends DownstreamMessage
|
||||
}
|
||||
|
||||
/** The event which we are forwarding. */
|
||||
protected Event _event;
|
||||
protected DEvent _event;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FailureResponse.java,v 1.2 2001/05/30 23:58:31 mdb Exp $
|
||||
// $Id: FailureResponse.java,v 1.3 2001/06/02 01:30:37 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.net;
|
||||
|
||||
@@ -21,12 +21,12 @@ public class FailureResponse extends DownstreamMessage
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a failure response that is associated with the specified
|
||||
* upstream message id.
|
||||
* Constructs a failure response in response to a request for the
|
||||
* specified oid.
|
||||
*/
|
||||
public FailureResponse (short messageId)
|
||||
public FailureResponse (int oid)
|
||||
{
|
||||
this.messageId = messageId;
|
||||
_oid = oid;
|
||||
}
|
||||
|
||||
public short getType ()
|
||||
@@ -34,17 +34,24 @@ public class FailureResponse extends DownstreamMessage
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public int getOid ()
|
||||
{
|
||||
return _oid;
|
||||
}
|
||||
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeShort(messageId);
|
||||
out.writeInt(_oid);
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
messageId = in.readShort();
|
||||
_oid = in.readInt();
|
||||
}
|
||||
|
||||
protected int _oid;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ObjectResponse.java,v 1.5 2001/05/30 23:58:31 mdb Exp $
|
||||
// $Id: ObjectResponse.java,v 1.6 2001/06/02 01:30:37 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.net;
|
||||
|
||||
@@ -24,12 +24,10 @@ public class ObjectResponse extends DownstreamMessage
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an object response with supplied distributed object that
|
||||
* is associated with the specified upstream message id.
|
||||
* Constructs an object response with supplied distributed object.
|
||||
*/
|
||||
public ObjectResponse (short messageId, DObject dobj)
|
||||
public ObjectResponse (DObject dobj)
|
||||
{
|
||||
this.messageId = messageId;
|
||||
_dobj = dobj;
|
||||
}
|
||||
|
||||
@@ -42,7 +40,6 @@ public class ObjectResponse extends DownstreamMessage
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeShort(messageId);
|
||||
DObjectFactory.writeTo(out, _dobj);
|
||||
}
|
||||
|
||||
@@ -50,7 +47,6 @@ public class ObjectResponse extends DownstreamMessage
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
messageId = in.readShort();
|
||||
_dobj = (DObject)DObjectFactory.readFrom(in);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: UsernamePasswordCreds.java,v 1.4 2001/05/30 23:58:31 mdb Exp $
|
||||
// $Id: UsernamePasswordCreds.java,v 1.5 2001/06/02 01:30:37 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.net;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class UsernamePasswordCreds extends Credentials
|
||||
*/
|
||||
public UsernamePasswordCreds (String username, String password)
|
||||
{
|
||||
_username = username;
|
||||
super(username);
|
||||
_password = password;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,15 @@ public class UsernamePasswordCreds extends Credentials
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public String getPassword ()
|
||||
{
|
||||
return _password;
|
||||
}
|
||||
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeUTF(_username);
|
||||
out.writeUTF(_password);
|
||||
}
|
||||
|
||||
@@ -45,10 +49,13 @@ public class UsernamePasswordCreds extends Credentials
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
_username = in.readUTF();
|
||||
_password = in.readUTF();
|
||||
}
|
||||
|
||||
protected String _username;
|
||||
public String toString ()
|
||||
{
|
||||
return "[username=" + _username + ", password=" + _password + "]";
|
||||
}
|
||||
|
||||
protected String _password;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user