More code, more code, more kibbles and code.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AuthRequest.java,v 1.2 2001/05/22 21:51:29 mdb Exp $
|
||||
// $Id: AuthRequest.java,v 1.3 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AuthRequest extends UpstreamMessage
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
_creds.writeTo(out);
|
||||
TypedObjectFactory.writeTo(out, _creds);
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AuthResponse.java,v 1.1 2001/05/22 21:51:29 mdb Exp $
|
||||
// $Id: AuthResponse.java,v 1.2 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import com.samskivert.cocktail.cher.dobj.DObject;
|
||||
import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
|
||||
/**
|
||||
@@ -22,12 +21,6 @@ public class AuthResponse extends DownstreamMessage
|
||||
/** The code for an auth response. */
|
||||
public static final short TYPE = TYPE_BASE + 0;
|
||||
|
||||
/** The response code key in the data object. */
|
||||
public static final String CODE = "code";
|
||||
|
||||
/** The failure reason key in the data object. */
|
||||
public static final String REASON = "reason";
|
||||
|
||||
/**
|
||||
* Zero argument constructor used when unserializing an instance.
|
||||
*/
|
||||
@@ -39,12 +32,12 @@ public class AuthResponse extends DownstreamMessage
|
||||
/**
|
||||
* Constructs a auth response with the supplied credentials.
|
||||
*/
|
||||
public AuthResponse (DObject data)
|
||||
public AuthResponse (AuthResponseData data)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public DObject getData ()
|
||||
public AuthResponseData getData ()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
@@ -58,15 +51,15 @@ public class AuthResponse extends DownstreamMessage
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
_data.writeTo(out);
|
||||
TypedObjectFactory.writeTo(out, _data);
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
_data = (DObject)TypedObjectFactory.readFrom(in);
|
||||
_data = (AuthResponseData)TypedObjectFactory.readFrom(in);
|
||||
}
|
||||
|
||||
protected DObject _data;
|
||||
protected AuthResponseData _data;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// $Id: AuthResponseData.java,v 1.1 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
import com.samskivert.cocktail.cher.dobj.DObject;
|
||||
|
||||
/**
|
||||
* An <code>AuthResponseData</code> object is communicated back to the
|
||||
* client along with an authentication response. It contains an indicator
|
||||
* of authentication success or failure along with bootstrap information
|
||||
* for the client.
|
||||
*/
|
||||
public class AuthResponseData extends DObject
|
||||
{
|
||||
/**
|
||||
* Either the string "success" or a reason code for why authentication
|
||||
* failed.
|
||||
*/
|
||||
public String code;
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
//
|
||||
// $Id: Credentials.java,v 1.1 2001/05/22 06:07:59 mdb Exp $
|
||||
// $Id: Credentials.java,v 1.2 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import com.samskivert.cocktail.cher.io.TypedObject;
|
||||
import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
|
||||
@@ -17,7 +21,7 @@ import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
* that they can be instantiated prior to reconstruction from a data input
|
||||
* stream.
|
||||
*/
|
||||
public abstract class Credentials extends TypedObject
|
||||
public abstract class Credentials implements TypedObject
|
||||
{
|
||||
/**
|
||||
* All credential derived classes should base their typed object code
|
||||
@@ -25,6 +29,28 @@ public abstract class Credentials extends TypedObject
|
||||
*/
|
||||
public static final short TYPE_BASE = 300;
|
||||
|
||||
/**
|
||||
* Derived classes should override this function to write their fields
|
||||
* out to the supplied data output stream. They <em>must</em> be sure
|
||||
* to first call <code>super.writeTo()</code>.
|
||||
*/
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
}
|
||||
|
||||
/**
|
||||
* Derived classes should override this function to read their fields
|
||||
* from the supplied data input stream. They <em>must</em> be sure to
|
||||
* first call <code>super.readFrom()</code>.
|
||||
*/
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
}
|
||||
|
||||
// register our credential classes
|
||||
static {
|
||||
TypedObjectFactory.registerClass(UsernamePasswordCreds.TYPE,
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
//
|
||||
// $Id: DownstreamMessage.java,v 1.2 2001/05/22 21:51:29 mdb Exp $
|
||||
// $Id: DownstreamMessage.java,v 1.3 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import com.samskivert.cocktail.cher.io.TypedObject;
|
||||
import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
|
||||
@@ -12,7 +16,7 @@ import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
* client. Downstream messages include object subscription, event
|
||||
* forwarding and session management.
|
||||
*/
|
||||
public abstract class DownstreamMessage extends TypedObject
|
||||
public abstract class DownstreamMessage implements TypedObject
|
||||
{
|
||||
/**
|
||||
* All downstream message derived classes should base their typed
|
||||
@@ -41,6 +45,28 @@ public abstract class DownstreamMessage extends TypedObject
|
||||
// nothing to do...
|
||||
}
|
||||
|
||||
/**
|
||||
* Derived classes should override this function to write their fields
|
||||
* out to the supplied data output stream. They <em>must</em> be sure
|
||||
* to first call <code>super.writeTo()</code>.
|
||||
*/
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
}
|
||||
|
||||
/**
|
||||
* Derived classes should override this function to read their fields
|
||||
* from the supplied data input stream. They <em>must</em> be sure to
|
||||
* first call <code>super.readFrom()</code>.
|
||||
*/
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
}
|
||||
|
||||
// register our downstream message classes
|
||||
static {
|
||||
TypedObjectFactory.registerClass(AuthResponse.TYPE,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ObjectResponse.java,v 1.1 2001/05/22 21:51:29 mdb Exp $
|
||||
// $Id: ObjectResponse.java,v 1.2 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ObjectResponse extends DownstreamMessage
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeShort(messageId);
|
||||
_dobj.writeTo(out);
|
||||
TypedObjectFactory.writeTo(out, _dobj);
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: UpstreamMessage.java,v 1.2 2001/05/22 21:51:29 mdb Exp $
|
||||
// $Id: UpstreamMessage.java,v 1.3 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
* Upstream messages include object subscription, event forwarding and
|
||||
* session management.
|
||||
*/
|
||||
public abstract class UpstreamMessage extends TypedObject
|
||||
public abstract class UpstreamMessage implements TypedObject
|
||||
{
|
||||
/**
|
||||
* All upstream message derived classes should base their typed object
|
||||
@@ -53,7 +53,6 @@ public abstract class UpstreamMessage extends TypedObject
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeShort(messageId);
|
||||
}
|
||||
|
||||
@@ -65,7 +64,6 @@ public abstract class UpstreamMessage extends TypedObject
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
messageId = in.readShort();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: UsernamePasswordCreds.java,v 1.2 2001/05/22 21:51:29 mdb Exp $
|
||||
// $Id: UsernamePasswordCreds.java,v 1.3 2001/05/23 04:03:40 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -36,6 +36,7 @@ public class UsernamePasswordCreds extends Credentials
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeUTF(_username);
|
||||
out.writeUTF(_password);
|
||||
}
|
||||
@@ -43,6 +44,7 @@ public class UsernamePasswordCreds extends Credentials
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
_username = in.readUTF();
|
||||
_password = in.readUTF();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user