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;
import java.io.IOException;
import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
/**
@@ -37,8 +41,8 @@ public abstract class ChatMessage
/** The bundle to use when translating this message. */
public String bundle;
/** The client side 'localtype' of this chat, set to the type
* registered with an auxiliary source in the ChatDirector. */
/** The client side 'localtype' of this chat, set to the type registered with an auxiliary
* source in the ChatDirector. */
public transient String localtype;
/** 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
* is changed around a bit.
* Once this message reaches the client, the information contained within is changed around a
* bit.
*/
public void setClientInfo (String msg, String localtype)
{
@@ -85,7 +89,24 @@ public abstract class ChatMessage
*/
public String toString ()
{
return StringUtil.shortClassName(this) +
StringUtil.fieldsToString(this);
return StringUtil.shortClassName(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;
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
* and did not result from direct user action.
* A ChatMessage that represents a message that came from the server and did not result from direct
* user action.
*/
public class SystemMessage extends ChatMessage
{
/** Attention level constant to indicate that this message is merely
* providing the user with information. */
/** Attention level constant to indicate that this message is merely providing the user with
* information. */
public static final byte INFO = 0;
/** Attention level constant to indicate that this message is the
* result of a user action. */
/** Attention level constant to indicate that this message is the result of a user action. */
public static final byte FEEDBACK = 1;
/** Attention level constant to indicate that some action is required. */
public static final byte ATTENTION = 2;
//----
/** The attention level of this message. */
public byte attentionLevel;
@@ -56,4 +58,22 @@ public class SystemMessage extends ChatMessage
super(message, bundle);
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;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name;
/**
@@ -52,5 +56,23 @@ public class TellFeedbackMessage extends UserMessage
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;
}
@@ -21,6 +21,10 @@
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;
/**
@@ -52,8 +56,8 @@ public class UserMessage extends ChatMessage
}
/**
* Constructs a user message for a player originated tell (which has no
* bundle and is in the default mode).
* Constructs a user message for a player originated tell (which has no bundle and is in the
* default mode).
*/
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
* may wish to not use the canonical name for the speaker and should thus
* override this function.
* Returns the name to display for the speaker. Some types of messages may wish to not use the
* canonical name for the speaker and should thus override this function.
*/
public Name getSpeakerDisplayName ()
{
@@ -87,4 +90,24 @@ public class UserMessage extends ChatMessage
}
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;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.Name;
/**
* A system message triggered by the activity of another user.
* If the user is muted we can suppress this message, unlike a normal
* system message.
* A system message triggered by the activity of another user. If the user is muted we can suppress
* this message, unlike a normal system message.
*/
public class UserSystemMessage extends SystemMessage
{
/** The "speaker" of this message, the user that triggered that this
* message be sent to us. */
/** The "speaker" of this message, the user that triggered that this message be sent to us. */
public Name speaker;
/** Suitable for unserialization. */
@@ -50,10 +52,27 @@ public class UserSystemMessage extends SystemMessage
/**
* Construct a UserSystemMessage.
*/
public UserSystemMessage (Name sender, String message, String bundle,
byte attentionLevel)
public UserSystemMessage (Name sender, String message, String bundle, byte attentionLevel)
{
super(message, bundle, attentionLevel);
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;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject;
import com.threerings.util.Name;
@@ -29,20 +33,17 @@ import com.threerings.presents.dobj.DSet;
import com.threerings.crowd.data.BodyObject;
/**
* The occupant info object contains all of the information about an
* occupant of a place that should be shared with other occupants of the
* place. These objects are stored in the place object itself and are
* updated when bodies enter and exit a place.
* The occupant info object contains all of the information about an occupant of a place that
* should be shared with other occupants of the place. These objects are stored in the place object
* itself and are updated when bodies enter and exit a place.
*
* <p> A system that builds upon the Crowd framework can extend this class to
* include extra information about their occupants. They will need to provide a
* derived {@link BodyObject} that creates and configures their occupant info
* in {@link BodyObject#createOccupantInfo}.
* <p> A system that builds upon the Crowd framework can extend this class to include extra
* information about their occupants. They will need to provide a derived {@link BodyObject} that
* creates and configures their occupant info in {@link BodyObject#createOccupantInfo}.
*
* <p> Note also that this class implements {@link Cloneable} which means
* that if derived classes add non-primitive attributes, they are
* responsible for adding the code to clone those attributes when a clone
* is requested.
* <p> Note also that this class implements {@link Cloneable} which means that if derived classes
* add non-primitive attributes, they are responsible for adding the code to clone those attributes
* when a clone is requested.
*/
public class OccupantInfo extends SimpleStreamableObject
implements DSet.Entry, Cloneable
@@ -69,8 +70,7 @@ public class OccupantInfo extends SimpleStreamableObject
public byte status = ACTIVE;
/**
* Creates an occupant info with information from the specified occupant's
* body object.
* Creates an occupant info with information from the specified occupant's body object.
*/
public OccupantInfo (BodyObject body)
{
@@ -107,4 +107,24 @@ public class OccupantInfo extends SimpleStreamableObject
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;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject;
/**
* Defines access control tokens that convey certain privileges to users
* (see {@link BodyObject#checkAccess}).
* Defines access control tokens that convey certain privileges to users (see {@link
* BodyObject#checkAccess}).
*/
public class TokenRing extends SimpleStreamableObject
{
/** Indicates that this user is an administrator and can do things
* like broadcast, shutdown the server and whatnot. */
/** Indicates that this user is an administrator and can do things like broadcast, shutdown the
* server and whatnot. */
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,
* exactly.
* For example, if you pass in the OR of two or more tokens,
* then the ring must contain all of those tokens.
* Returns true if this token ring contains the specified token or tokens, exactly. For
* example, if you pass in the OR of two or more tokens, then the ring must contain all of
* those tokens.
*/
public boolean holdsToken (int token)
{
@@ -68,8 +71,7 @@ public class TokenRing extends SimpleStreamableObject
}
/**
* Convenience function for checking whether this ring holds the
* {@link #ADMIN} token.
* Convenience function for checking whether this ring holds the {@link #ADMIN} token.
*/
public boolean isAdmin ()
{
@@ -112,6 +114,22 @@ public class TokenRing extends SimpleStreamableObject
_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). */
protected int _tokens;
}
@@ -21,6 +21,10 @@
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.presents.peer.data.ClientInfo;
@@ -42,4 +46,20 @@ public class CrowdClientInfo extends ClientInfo
// makes lookups much more efficient
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;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.SimpleStreamableObject;
/**
@@ -29,20 +33,18 @@ import com.threerings.io.SimpleStreamableObject;
public class ConMgrStats extends SimpleStreamableObject
implements Cloneable
{
/** The size of the queue of waiting to auth sockets. This is a snapshot at
* the time the stats are requested. */
/** The size of the queue of waiting to auth sockets. This is a snapshot at the time the stats
* are requested. */
public int authQueueSize;
/** The size of the queue of waiting to die sockets. This is a snapshot at
* the time the stats are requested. */
/** The size of the queue of waiting to die sockets. This is a snapshot at the time the stats
* are requested. */
public int deathQueueSize;
/** The outgoing queue size. This is a snapshot at the time the stats are
* requested. */
/** The outgoing queue size. This is a snapshot at the time the stats are requested. */
public int outQueueSize;
/** The overflow queue size. This is a snapshot at the time the stats are
* requested. */
/** The overflow queue size. This is a snapshot at the time the stats are requested. */
public int overQueueSize;
/** The number of connection events since the server started up. */
@@ -72,4 +74,38 @@ public class ConMgrStats extends SimpleStreamableObject
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;
import java.io.IOException;
import com.samskivert.util.StringUtil;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
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
* invocation service request.
@@ -243,14 +273,6 @@ public class InvocationMarshaller
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. */
protected int _invOid;
@@ -21,6 +21,10 @@
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.util.Name;
@@ -40,4 +44,20 @@ public class ClientInfo extends SimpleStreamableObject
{
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
}