Generated readObject()/writeObject(), widened some things along the way.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4689 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-05-04 22:17:41 +00:00
parent ea8bf25c0a
commit a60a71552a
11 changed files with 307 additions and 66 deletions
@@ -21,8 +21,12 @@
package com.threerings.crowd.chat.data; package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
/** /**
@@ -37,8 +41,8 @@ public abstract class ChatMessage
/** The bundle to use when translating this message. */ /** The bundle to use when translating this message. */
public String bundle; public String bundle;
/** The client side 'localtype' of this chat, set to the type /** The client side 'localtype' of this chat, set to the type registered with an auxiliary
* registered with an auxiliary source in the ChatDirector. */ * source in the ChatDirector. */
public transient String localtype; public transient String localtype;
/** The client time that this message was created. */ /** The client time that this message was created. */
@@ -61,8 +65,8 @@ public abstract class ChatMessage
} }
/** /**
* Once this message reaches the client, the information contained within * Once this message reaches the client, the information contained within is changed around a
* is changed around a bit. * bit.
*/ */
public void setClientInfo (String msg, String localtype) public void setClientInfo (String msg, String localtype)
{ {
@@ -85,7 +89,24 @@ public abstract class ChatMessage
*/ */
public String toString () public String toString ()
{ {
return StringUtil.shortClassName(this) + return StringUtil.shortClassName(this) + StringUtil.fieldsToString(this);
StringUtil.fieldsToString(this);
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
message = ins.readUTF();
bundle = ins.readUTF();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeUTF(message);
out.writeUTF(bundle);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,25 +21,27 @@
package com.threerings.crowd.chat.data; package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
/** /**
* A ChatMessage that represents a message that came from the server * A ChatMessage that represents a message that came from the server and did not result from direct
* and did not result from direct user action. * user action.
*/ */
public class SystemMessage extends ChatMessage public class SystemMessage extends ChatMessage
{ {
/** Attention level constant to indicate that this message is merely /** Attention level constant to indicate that this message is merely providing the user with
* providing the user with information. */ * information. */
public static final byte INFO = 0; public static final byte INFO = 0;
/** Attention level constant to indicate that this message is the /** Attention level constant to indicate that this message is the result of a user action. */
* result of a user action. */
public static final byte FEEDBACK = 1; public static final byte FEEDBACK = 1;
/** Attention level constant to indicate that some action is required. */ /** Attention level constant to indicate that some action is required. */
public static final byte ATTENTION = 2; public static final byte ATTENTION = 2;
//----
/** The attention level of this message. */ /** The attention level of this message. */
public byte attentionLevel; public byte attentionLevel;
@@ -56,4 +58,22 @@ public class SystemMessage extends ChatMessage
super(message, bundle); super(message, bundle);
this.attentionLevel = attentionLevel; this.attentionLevel = attentionLevel;
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
attentionLevel = ins.readByte();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeByte(attentionLevel);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,6 +21,10 @@
package com.threerings.crowd.chat.data; package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name; import com.threerings.util.Name;
/** /**
@@ -52,5 +56,23 @@ public class TellFeedbackMessage extends UserMessage
return _failure ? null : "m.told_format"; return _failure ? null : "m.told_format";
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
_failure = ins.readBoolean();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeBoolean(_failure);
}
// AUTO-GENERATED: METHODS END
protected boolean _failure; protected boolean _failure;
} }
@@ -21,6 +21,10 @@
package com.threerings.crowd.chat.data; package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.ObjectInputStream;
import com.threerings.util.Name; import com.threerings.util.Name;
/** /**
@@ -52,8 +56,8 @@ public class UserMessage extends ChatMessage
} }
/** /**
* Constructs a user message for a player originated tell (which has no * Constructs a user message for a player originated tell (which has no bundle and is in the
* bundle and is in the default mode). * default mode).
*/ */
public UserMessage (Name speaker, String message) public UserMessage (Name speaker, String message)
{ {
@@ -63,9 +67,8 @@ public class UserMessage extends ChatMessage
} }
/** /**
* Returns the name to display for the speaker. Some types of messages * Returns the name to display for the speaker. Some types of messages may wish to not use the
* may wish to not use the canonical name for the speaker and should thus * canonical name for the speaker and should thus override this function.
* override this function.
*/ */
public Name getSpeakerDisplayName () public Name getSpeakerDisplayName ()
{ {
@@ -87,4 +90,24 @@ public class UserMessage extends ChatMessage
} }
return "m.speak_format"; return "m.speak_format";
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
speaker = (Name)ins.readObject();
mode = ins.readByte();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(speaker);
out.writeByte(mode);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,17 +21,19 @@
package com.threerings.crowd.chat.data; package com.threerings.crowd.chat.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name; import com.threerings.util.Name;
/** /**
* A system message triggered by the activity of another user. * A system message triggered by the activity of another user. If the user is muted we can suppress
* If the user is muted we can suppress this message, unlike a normal * this message, unlike a normal system message.
* system message.
*/ */
public class UserSystemMessage extends SystemMessage public class UserSystemMessage extends SystemMessage
{ {
/** The "speaker" of this message, the user that triggered that this /** The "speaker" of this message, the user that triggered that this message be sent to us. */
* message be sent to us. */
public Name speaker; public Name speaker;
/** Suitable for unserialization. */ /** Suitable for unserialization. */
@@ -50,10 +52,27 @@ public class UserSystemMessage extends SystemMessage
/** /**
* Construct a UserSystemMessage. * Construct a UserSystemMessage.
*/ */
public UserSystemMessage (Name sender, String message, String bundle, public UserSystemMessage (Name sender, String message, String bundle, byte attentionLevel)
byte attentionLevel)
{ {
super(message, bundle, attentionLevel); super(message, bundle, attentionLevel);
this.speaker = sender; this.speaker = sender;
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
super.readObject(ins);
speaker = (Name)ins.readObject();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
super.writeObject(out);
out.writeObject(speaker);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,6 +21,10 @@
package com.threerings.crowd.data; package com.threerings.crowd.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject; import com.threerings.io.SimpleStreamableObject;
import com.threerings.util.Name; import com.threerings.util.Name;
@@ -29,20 +33,17 @@ import com.threerings.presents.dobj.DSet;
import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.BodyObject;
/** /**
* The occupant info object contains all of the information about an * The occupant info object contains all of the information about an occupant of a place that
* occupant of a place that should be shared with other occupants of the * should be shared with other occupants of the place. These objects are stored in the place object
* place. These objects are stored in the place object itself and are * itself and are updated when bodies enter and exit a place.
* updated when bodies enter and exit a place.
* *
* <p> A system that builds upon the Crowd framework can extend this class to * <p> A system that builds upon the Crowd framework can extend this class to include extra
* include extra information about their occupants. They will need to provide a * information about their occupants. They will need to provide a derived {@link BodyObject} that
* derived {@link BodyObject} that creates and configures their occupant info * creates and configures their occupant info in {@link BodyObject#createOccupantInfo}.
* in {@link BodyObject#createOccupantInfo}.
* *
* <p> Note also that this class implements {@link Cloneable} which means * <p> Note also that this class implements {@link Cloneable} which means that if derived classes
* that if derived classes add non-primitive attributes, they are * add non-primitive attributes, they are responsible for adding the code to clone those attributes
* responsible for adding the code to clone those attributes when a clone * when a clone is requested.
* is requested.
*/ */
public class OccupantInfo extends SimpleStreamableObject public class OccupantInfo extends SimpleStreamableObject
implements DSet.Entry, Cloneable implements DSet.Entry, Cloneable
@@ -69,8 +70,7 @@ public class OccupantInfo extends SimpleStreamableObject
public byte status = ACTIVE; public byte status = ACTIVE;
/** /**
* Creates an occupant info with information from the specified occupant's * Creates an occupant info with information from the specified occupant's body object.
* body object.
*/ */
public OccupantInfo (BodyObject body) public OccupantInfo (BodyObject body)
{ {
@@ -107,4 +107,24 @@ public class OccupantInfo extends SimpleStreamableObject
throw new RuntimeException(cnse); throw new RuntimeException(cnse);
} }
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
bodyOid = ins.readInt();
username = (Name)ins.readObject();
status = ins.readByte();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeInt(bodyOid);
out.writeObject(username);
out.writeByte(status);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,16 +21,20 @@
package com.threerings.crowd.data; package com.threerings.crowd.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject; import com.threerings.io.SimpleStreamableObject;
/** /**
* Defines access control tokens that convey certain privileges to users * Defines access control tokens that convey certain privileges to users (see {@link
* (see {@link BodyObject#checkAccess}). * BodyObject#checkAccess}).
*/ */
public class TokenRing extends SimpleStreamableObject public class TokenRing extends SimpleStreamableObject
{ {
/** Indicates that this user is an administrator and can do things /** Indicates that this user is an administrator and can do things like broadcast, shutdown the
* like broadcast, shutdown the server and whatnot. */ * server and whatnot. */
public static final int ADMIN = (1 << 0); public static final int ADMIN = (1 << 0);
/** /**
@@ -49,10 +53,9 @@ public class TokenRing extends SimpleStreamableObject
} }
/** /**
* Returns true if this token ring contains the specified token or tokens, * Returns true if this token ring contains the specified token or tokens, exactly. For
* exactly. * example, if you pass in the OR of two or more tokens, then the ring must contain all of
* For example, if you pass in the OR of two or more tokens, * those tokens.
* then the ring must contain all of those tokens.
*/ */
public boolean holdsToken (int token) public boolean holdsToken (int token)
{ {
@@ -68,8 +71,7 @@ public class TokenRing extends SimpleStreamableObject
} }
/** /**
* Convenience function for checking whether this ring holds the * Convenience function for checking whether this ring holds the {@link #ADMIN} token.
* {@link #ADMIN} token.
*/ */
public boolean isAdmin () public boolean isAdmin ()
{ {
@@ -112,6 +114,22 @@ public class TokenRing extends SimpleStreamableObject
_tokens &= ~token; _tokens &= ~token;
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
_tokens = ins.readInt();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeInt(_tokens);
}
// AUTO-GENERATED: METHODS END
/** The tokens contained in this ring (composed together bitwise). */ /** The tokens contained in this ring (composed together bitwise). */
protected int _tokens; protected int _tokens;
} }
@@ -21,6 +21,10 @@
package com.threerings.crowd.peer.data; package com.threerings.crowd.peer.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name; import com.threerings.util.Name;
import com.threerings.presents.peer.data.ClientInfo; import com.threerings.presents.peer.data.ClientInfo;
@@ -42,4 +46,20 @@ public class CrowdClientInfo extends ClientInfo
// makes lookups much more efficient // makes lookups much more efficient
return visibleName; return visibleName;
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
visibleName = (Name)ins.readObject();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeObject(visibleName);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,6 +21,10 @@
package com.threerings.presents.data; package com.threerings.presents.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject; import com.threerings.io.SimpleStreamableObject;
/** /**
@@ -29,20 +33,18 @@ import com.threerings.io.SimpleStreamableObject;
public class ConMgrStats extends SimpleStreamableObject public class ConMgrStats extends SimpleStreamableObject
implements Cloneable implements Cloneable
{ {
/** The size of the queue of waiting to auth sockets. This is a snapshot at /** The size of the queue of waiting to auth sockets. This is a snapshot at the time the stats
* the time the stats are requested. */ * are requested. */
public int authQueueSize; public int authQueueSize;
/** The size of the queue of waiting to die sockets. This is a snapshot at /** The size of the queue of waiting to die sockets. This is a snapshot at the time the stats
* the time the stats are requested. */ * are requested. */
public int deathQueueSize; public int deathQueueSize;
/** The outgoing queue size. This is a snapshot at the time the stats are /** The outgoing queue size. This is a snapshot at the time the stats are requested. */
* requested. */
public int outQueueSize; public int outQueueSize;
/** The overflow queue size. This is a snapshot at the time the stats are /** The overflow queue size. This is a snapshot at the time the stats are requested. */
* requested. */
public int overQueueSize; public int overQueueSize;
/** The number of connection events since the server started up. */ /** The number of connection events since the server started up. */
@@ -72,4 +74,38 @@ public class ConMgrStats extends SimpleStreamableObject
throw new RuntimeException(cnse); throw new RuntimeException(cnse);
} }
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
authQueueSize = ins.readInt();
deathQueueSize = ins.readInt();
outQueueSize = ins.readInt();
overQueueSize = ins.readInt();
connects = ins.readInt();
disconnects = ins.readInt();
bytesIn = ins.readLong();
bytesOut = ins.readLong();
msgsIn = ins.readInt();
msgsOut = ins.readInt();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeInt(authQueueSize);
out.writeInt(deathQueueSize);
out.writeInt(outQueueSize);
out.writeInt(overQueueSize);
out.writeInt(connects);
out.writeInt(disconnects);
out.writeLong(bytesIn);
out.writeLong(bytesOut);
out.writeInt(msgsIn);
out.writeInt(msgsOut);
}
// AUTO-GENERATED: METHODS END
} }
@@ -21,8 +21,12 @@
package com.threerings.presents.data; package com.threerings.presents.data;
import java.io.IOException;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
import com.threerings.presents.Log; import com.threerings.presents.Log;
@@ -234,6 +238,32 @@ public class InvocationMarshaller
} }
} }
/**
* Generates a string representation of this instance.
*/
public String toString ()
{
return "[invOid=" + _invOid + ", code=" + _invCode + ", type=" + getClass().getName() + "]";
}
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
_invOid = ins.readInt();
_invCode = ins.readInt();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeInt(_invOid);
out.writeInt(_invCode);
}
// AUTO-GENERATED: METHODS END
/** /**
* Called by generated invocation marshaller code; packages up and sends the specified * Called by generated invocation marshaller code; packages up and sends the specified
* invocation service request. * invocation service request.
@@ -243,14 +273,6 @@ public class InvocationMarshaller
client.getInvocationDirector().sendRequest(_invOid, _invCode, methodId, args); client.getInvocationDirector().sendRequest(_invOid, _invCode, methodId, args);
} }
/**
* Generates a string representation of this instance.
*/
public String toString ()
{
return "[invOid=" + _invOid + ", code=" + _invCode + ", type=" + getClass().getName() + "]";
}
/** The oid of the invocation object, where invocation service requests are sent. */ /** The oid of the invocation object, where invocation service requests are sent. */
protected int _invOid; protected int _invOid;
@@ -21,6 +21,10 @@
package com.threerings.presents.peer.data; package com.threerings.presents.peer.data;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject; import com.threerings.io.SimpleStreamableObject;
import com.threerings.util.Name; import com.threerings.util.Name;
@@ -40,4 +44,20 @@ public class ClientInfo extends SimpleStreamableObject
{ {
return username; return username;
} }
// AUTO-GENERATED: METHODS START
// from interface Streamable
public void readObject (ObjectInputStream ins)
throws IOException, ClassNotFoundException
{
username = (Name)ins.readObject();
}
// from interface Streamable
public void writeObject (ObjectOutputStream out)
throws IOException
{
out.writeObject(username);
}
// AUTO-GENERATED: METHODS END
} }