Keep track of the client object id in the agent object (this will allow WhirledGameManager.validateUser to check out a dispatch from a bureau client)

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5152 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-06-05 00:16:46 +00:00
parent 63d228ee4c
commit 443ad8e139
3 changed files with 109 additions and 61 deletions
@@ -38,6 +38,9 @@ public class AgentObject extends DObject
/** The field name of the <code>className</code> field. */
public static const CLASS_NAME :String = "className";
/** The field name of the <code>clientOid</code> field. */
public static const CLIENT_OID :String = "clientOid";
// AUTO-GENERATED: FIELDS END
/** The id of the bureau the agent is running in. This is normally a unique id corresponding
@@ -57,71 +60,91 @@ public class AgentObject extends DObject
* used depends on the type of bureau and will be resolve in the bureau client. */
public var className :String;
/** The id of the client running this agent (only set after the agent is assigned to a
* bureau and is running). */
public var clientOid :int;
// AUTO-GENERATED: METHODS START
/**
* Requests that the <code>bureauId</code> field be set to the
* specified value. The local value will be updated immediately and an
* event will be propagated through the system to notify all listeners
* that the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the
* attribute changed notification.
*/
public function setBureauId (value :String) :void
{
var ovalue :String = this.bureauId;
requestAttributeChange(
BUREAU_ID, value, ovalue);
this.bureauId = value;
}
// /**
// * Requests that the <code>bureauId</code> field be set to the
// * specified value. The local value will be updated immediately and an
// * event will be propagated through the system to notify all listeners
// * that the attribute did change. Proxied copies of this object (on
// * clients) will apply the value change when they received the
// * attribute changed notification.
// */
// public function setBureauId (value :String) :void
// {
// var ovalue :String = this.bureauId;
// requestAttributeChange(
// BUREAU_ID, value, ovalue);
// this.bureauId = value;
// }
/**
* Requests that the <code>bureauType</code> field be set to the
* specified value. The local value will be updated immediately and an
* event will be propagated through the system to notify all listeners
* that the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the
* attribute changed notification.
*/
public function setBureauType (value :String) :void
{
var ovalue :String = this.bureauType;
requestAttributeChange(
BUREAU_TYPE, value, ovalue);
this.bureauType = value;
}
// /**
// * Requests that the <code>bureauType</code> field be set to the
// * specified value. The local value will be updated immediately and an
// * event will be propagated through the system to notify all listeners
// * that the attribute did change. Proxied copies of this object (on
// * clients) will apply the value change when they received the
// * attribute changed notification.
// */
// public function setBureauType (value :String) :void
// {
// var ovalue :String = this.bureauType;
// requestAttributeChange(
// BUREAU_TYPE, value, ovalue);
// this.bureauType = value;
// }
/**
* Requests that the <code>code</code> field be set to the
* specified value. The local value will be updated immediately and an
* event will be propagated through the system to notify all listeners
* that the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the
* attribute changed notification.
*/
public function setCode (value :String) :void
{
var ovalue :String = this.code;
requestAttributeChange(
CODE, value, ovalue);
this.code = value;
}
// /**
// * Requests that the <code>code</code> field be set to the
// * specified value. The local value will be updated immediately and an
// * event will be propagated through the system to notify all listeners
// * that the attribute did change. Proxied copies of this object (on
// * clients) will apply the value change when they received the
// * attribute changed notification.
// */
// public function setCode (value :String) :void
// {
// var ovalue :String = this.code;
// requestAttributeChange(
// CODE, value, ovalue);
// this.code = value;
// }
/**
* Requests that the <code>className</code> field be set to the
* specified value. The local value will be updated immediately and an
* event will be propagated through the system to notify all listeners
* that the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the
* attribute changed notification.
*/
public function setClassName (value :String) :void
{
var ovalue :String = this.className;
requestAttributeChange(
CLASS_NAME, value, ovalue);
this.className = value;
}
// AUTO-GENERATED: METHODS END
// /**
// * Requests that the <code>className</code> field be set to the
// * specified value. The local value will be updated immediately and an
// * event will be propagated through the system to notify all listeners
// * that the attribute did change. Proxied copies of this object (on
// * clients) will apply the value change when they received the
// * attribute changed notification.
// */
// public function setClassName (value :String) :void
// {
// var ovalue :String = this.className;
// requestAttributeChange(
// CLASS_NAME, value, ovalue);
// this.className = value;
// }
// /**
// * Requests that the <code>clientOid</code> field be set to the
// * specified value. The local value will be updated immediately and an
// * event will be propagated through the system to notify all listeners
// * that the attribute did change. Proxied copies of this object (on
// * clients) will apply the value change when they received the
// * attribute changed notification.
// */
// public function setClientOid (value :int) :void
// {
// var ovalue :int = this.clientOid;
// requestAttributeChange(
// CLIENT_OID, Integer.valueOf(value), Integer.valueOf(ovalue));
// this.clientOid = value;
// }
// // AUTO-GENERATED: METHODS END
// from interface Streamable
override public function readObject (ins :ObjectInputStream) :void
@@ -131,6 +154,7 @@ public class AgentObject extends DObject
bureauType = ins.readField(String) as String;
code = ins.readField(String) as String;
className = ins.readField(String) as String;
clientOid = ins.readInt();
}
}
}
@@ -37,6 +37,9 @@ public class AgentObject extends DObject
/** The field name of the <code>className</code> field. */
public static final String CLASS_NAME = "className";
/** The field name of the <code>clientOid</code> field. */
public static final String CLIENT_OID = "clientOid";
// AUTO-GENERATED: FIELDS END
/** The id of the bureau the agent is running in. This is normally a unique id corresponding
@@ -56,6 +59,10 @@ public class AgentObject extends DObject
* used depends on the type of bureau and will be resolve in the bureau client. */
public String className;
/** The id of the client running this agent (only set after the agent is assigned to a
* bureau and run). */
public int clientOid;
// AUTO-GENERATED: METHODS START
/**
* Requests that the <code>bureauId</code> field be set to the
@@ -120,5 +127,21 @@ public class AgentObject extends DObject
CLASS_NAME, value, ovalue);
this.className = value;
}
/**
* Requests that the <code>clientOid</code> field be set to the
* specified value. The local value will be updated immediately and an
* event will be propagated through the system to notify all listeners
* that the attribute did change. Proxied copies of this object (on
* clients) will apply the value change when they received the
* attribute changed notification.
*/
public void setClientOid (int value)
{
int ovalue = this.clientOid;
requestAttributeChange(
CLIENT_OID, Integer.valueOf(value), Integer.valueOf(ovalue));
this.clientOid = value;
}
// AUTO-GENERATED: METHODS END
}
@@ -320,6 +320,7 @@ public class BureauRegistry
switch (found.state) {
case Bureau.STARTED:
found.bureau.agentStates.put(found.agent, Bureau.RUNNING);
found.agent.setClientOid(client.getOid());
break;
case Bureau.STILL_BORN: