Har! More progress mateys.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AuthResponse.java,v 1.2 2001/05/23 04:03:40 mdb Exp $
|
||||
// $Id: AuthResponse.java,v 1.3 2001/05/29 03:27:59 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
import com.samskivert.cocktail.cher.dobj.DObjectFactory;
|
||||
|
||||
/**
|
||||
* The auth response communicates authentication success or failure as
|
||||
@@ -51,14 +51,14 @@ public class AuthResponse extends DownstreamMessage
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
TypedObjectFactory.writeTo(out, _data);
|
||||
DObjectFactory.writeTo(out, _data);
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
_data = (AuthResponseData)TypedObjectFactory.readFrom(in);
|
||||
_data = (AuthResponseData)DObjectFactory.readFrom(in);
|
||||
}
|
||||
|
||||
protected AuthResponseData _data;
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
//
|
||||
// $Id: AuthResponseData.java,v 1.1 2001/05/23 04:03:40 mdb Exp $
|
||||
// $Id: AuthResponseData.java,v 1.2 2001/05/29 03:27:59 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.dobj.DObject;
|
||||
|
||||
/**
|
||||
@@ -18,4 +22,18 @@ public class AuthResponseData extends DObject
|
||||
* failed.
|
||||
*/
|
||||
public String code;
|
||||
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeUTF(code);
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
code = in.readUTF();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Credentials.java,v 1.2 2001/05/23 04:03:40 mdb Exp $
|
||||
// $Id: Credentials.java,v 1.3 2001/05/29 03:27:59 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -50,10 +50,4 @@ public abstract class Credentials implements TypedObject
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
}
|
||||
|
||||
// register our credential classes
|
||||
static {
|
||||
TypedObjectFactory.registerClass(UsernamePasswordCreds.TYPE,
|
||||
UsernamePasswordCreds.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DownstreamMessage.java,v 1.3 2001/05/23 04:03:40 mdb Exp $
|
||||
// $Id: DownstreamMessage.java,v 1.4 2001/05/29 03:27:59 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -66,18 +66,4 @@ public abstract class DownstreamMessage implements TypedObject
|
||||
{
|
||||
// we don't do anything here, but we may want to some day
|
||||
}
|
||||
|
||||
// register our downstream message classes
|
||||
static {
|
||||
TypedObjectFactory.registerClass(AuthResponse.TYPE,
|
||||
AuthResponse.class);
|
||||
TypedObjectFactory.registerClass(EventNotification.TYPE,
|
||||
EventNotification.class);
|
||||
TypedObjectFactory.registerClass(ObjectResponse.TYPE,
|
||||
ObjectResponse.class);
|
||||
TypedObjectFactory.registerClass(FailureResponse.TYPE,
|
||||
FailureResponse.class);
|
||||
TypedObjectFactory.registerClass(PongNotification.TYPE,
|
||||
PongNotification.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// $Id: Registry.java,v 1.1 2001/05/29 03:27:59 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
import com.samskivert.cocktail.cher.dobj.DObject;
|
||||
import com.samskivert.cocktail.cher.io.TypedObject;
|
||||
import com.samskivert.cocktail.cher.io.TypedObjectFactory;
|
||||
|
||||
/**
|
||||
* The registry provides a single place where all typed objects that are
|
||||
* exchanged between the client and the server can be registered with the
|
||||
* typed object factory.
|
||||
*/
|
||||
public class Registry
|
||||
{
|
||||
/**
|
||||
* Must be called once by the client and the server to ensure that all
|
||||
* typed objects are registered with the typed object system.
|
||||
*/
|
||||
public static void registerTypedObjects ()
|
||||
{
|
||||
// register our upstream message classes
|
||||
TypedObjectFactory.registerClass(AuthRequest.TYPE,
|
||||
AuthRequest.class);
|
||||
TypedObjectFactory.registerClass(SubscribeRequest.TYPE,
|
||||
SubscribeRequest.class);
|
||||
TypedObjectFactory.registerClass(FetchRequest.TYPE,
|
||||
FetchRequest.class);
|
||||
TypedObjectFactory.registerClass(UnsubscribeNotification.TYPE,
|
||||
UnsubscribeNotification.class);
|
||||
TypedObjectFactory.registerClass(ForwardEventNotification.TYPE,
|
||||
ForwardEventNotification.class);
|
||||
TypedObjectFactory.registerClass(PingNotification.TYPE,
|
||||
PingNotification.class);
|
||||
TypedObjectFactory.registerClass(LogoffNotification.TYPE,
|
||||
LogoffNotification.class);
|
||||
|
||||
// register our downstream message classes
|
||||
TypedObjectFactory.registerClass(AuthResponse.TYPE,
|
||||
AuthResponse.class);
|
||||
TypedObjectFactory.registerClass(EventNotification.TYPE,
|
||||
EventNotification.class);
|
||||
TypedObjectFactory.registerClass(ObjectResponse.TYPE,
|
||||
ObjectResponse.class);
|
||||
TypedObjectFactory.registerClass(FailureResponse.TYPE,
|
||||
FailureResponse.class);
|
||||
TypedObjectFactory.registerClass(PongNotification.TYPE,
|
||||
PongNotification.class);
|
||||
|
||||
// register our credential classes
|
||||
TypedObjectFactory.registerClass(UsernamePasswordCreds.TYPE,
|
||||
UsernamePasswordCreds.class);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: UpstreamMessage.java,v 1.3 2001/05/23 04:03:40 mdb Exp $
|
||||
// $Id: UpstreamMessage.java,v 1.4 2001/05/29 03:27:59 mdb Exp $
|
||||
|
||||
package com.samskivert.cocktail.cher.net;
|
||||
|
||||
@@ -82,22 +82,4 @@ public abstract class UpstreamMessage implements TypedObject
|
||||
* the client as new messages are generated.
|
||||
*/
|
||||
protected static short _nextMessageId;
|
||||
|
||||
// register our upstream message classes
|
||||
static {
|
||||
TypedObjectFactory.registerClass(AuthRequest.TYPE,
|
||||
AuthRequest.class);
|
||||
TypedObjectFactory.registerClass(SubscribeRequest.TYPE,
|
||||
SubscribeRequest.class);
|
||||
TypedObjectFactory.registerClass(FetchRequest.TYPE,
|
||||
FetchRequest.class);
|
||||
TypedObjectFactory.registerClass(UnsubscribeNotification.TYPE,
|
||||
UnsubscribeNotification.class);
|
||||
TypedObjectFactory.registerClass(ForwardEventNotification.TYPE,
|
||||
ForwardEventNotification.class);
|
||||
TypedObjectFactory.registerClass(PingNotification.TYPE,
|
||||
PingNotification.class);
|
||||
TypedObjectFactory.registerClass(LogoffNotification.TYPE,
|
||||
LogoffNotification.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user