Some stuff.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3865 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -50,9 +50,16 @@ Notes
|
||||
what happens if it proceeds to define a class like
|
||||
com.threerings.presents.client.Client?
|
||||
|
||||
- constructors do not defaultly call super()- be sure to do it explicitely.
|
||||
- <strike>constructors do not defaultly call super()- be sure to do it explicitely.
|
||||
Maybe we should get in the habit of doing it in Java for consistency and
|
||||
explicitness.
|
||||
explicitness.</strike>
|
||||
CORRECTION: super() is called implicitely, just as in Java.
|
||||
|
||||
- It's annoying how there can be only one constructor: if you have classA
|
||||
that has a 1-arg constructor and it is extended by classB, then the implicit
|
||||
super() is inserted, but this results in runtime error because the classA
|
||||
constructor is not being passed an arg. You'd think this would be caught
|
||||
at compile time...
|
||||
|
||||
- I'm a little shaky still about how I'm going to handle arrays. In
|
||||
ActionScript all arrays (except ByteArray) are the same type: Array.
|
||||
|
||||
@@ -223,38 +223,36 @@ public class ClientDObjectMgr
|
||||
// if this is a compound event, we need to process its contained
|
||||
// events in order
|
||||
if (event is CompoundEvent) {
|
||||
IList events = ((CompoundEvent)event).getEvents();
|
||||
int ecount = events.size();
|
||||
for (int i = 0; i < ecount; i++) {
|
||||
dispatchEvent((DEvent)events.get(i));
|
||||
var events :IList = event.getEvents();
|
||||
var ecount :int = events.length;
|
||||
for (var ii :int = 0; ii < ecount; ii++) {
|
||||
dispatchEvent(events.getItemAt(ii));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
System.err.println("dispatching: " + event);
|
||||
|
||||
// look up the object on which we're dispatching this event
|
||||
int toid = event.getTargetOid();
|
||||
DObject target = (DObject)_ocache.get(toid);
|
||||
var toid :int = event.getTargetOid();
|
||||
var target :DObject = _ocache[toid];
|
||||
if (target == null) {
|
||||
if (!_dead.containsKey(toid)) {
|
||||
Log.warning("Unable to dispatch event on non-proxied " +
|
||||
"object [event=" + event + "].");
|
||||
if (_dead[toid] === undefined) {
|
||||
trace("Unable to dispatch event on non-proxied " +
|
||||
"object [event=" + event + "].");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// apply the event to the object
|
||||
boolean notify = event.applyToObject(target);
|
||||
var notify :Boolean = event.applyToObject(target);
|
||||
|
||||
// if this is an object destroyed event, we need to remove the
|
||||
// object from our object table
|
||||
if (event instanceof ObjectDestroyedEvent) {
|
||||
if (event is ObjectDestroyedEvent) {
|
||||
// Log.info("Pitching destroyed object " +
|
||||
// "[oid=" + toid + ", class=" +
|
||||
// StringUtil.shortClassName(target) + "].");
|
||||
_ocache.remove(toid);
|
||||
_ocache[toid] = undefined;
|
||||
}
|
||||
|
||||
// have the object pass this event on to its listeners
|
||||
@@ -262,10 +260,10 @@ public class ClientDObjectMgr
|
||||
target.notifyListeners(event);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failure processing event [event=" + event +
|
||||
", target=" + target + "].");
|
||||
Log.logStackTrace(e);
|
||||
} catch (e :Exception) {
|
||||
trace("Failure processing event [event=" + event +
|
||||
", target=" + target + "].");
|
||||
//Log.logStackTrace(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,24 +271,26 @@ public class ClientDObjectMgr
|
||||
* Registers this object in our proxy cache and notifies the
|
||||
* subscribers that were waiting for subscription to this object.
|
||||
*/
|
||||
protected void registerObjectAndNotify (DObject obj)
|
||||
protected function registerObjectAndNotify (obj :DObject) :void
|
||||
{
|
||||
// let the object know that we'll be managing it
|
||||
obj.setManager(this);
|
||||
|
||||
var oid :int = obj.getOid();
|
||||
// stick the object into the proxy object table
|
||||
_ocache.put(obj.getOid(), obj);
|
||||
_ocache[oid] = obj;
|
||||
|
||||
// let the penders know that the object is available
|
||||
PendingRequest req = (PendingRequest)_penders.remove(obj.getOid());
|
||||
var req :PendingRequest = _penders[oid];
|
||||
_penders[oid] = undefined;
|
||||
if (req == null) {
|
||||
Log.warning("Got object, but no one cares?! " +
|
||||
"[oid=" + obj.getOid() + ", obj=" + obj + "].");
|
||||
trace("Got object, but no one cares?! " +
|
||||
"[oid=" + oid + ", obj=" + obj + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < req.targets.size(); i++) {
|
||||
Subscriber target = (Subscriber)req.targets.get(i);
|
||||
for (var ii :int = 0; ii < req.targets.length; ii++) {
|
||||
var target :Subscriber = req.targets[ii];
|
||||
// add them as a subscriber
|
||||
obj.addSubscriber(target);
|
||||
// and let them know that the object is in
|
||||
@@ -302,18 +302,19 @@ public class ClientDObjectMgr
|
||||
* Notifies the subscribers that had requested this object (for
|
||||
* subscription) that it is not available.
|
||||
*/
|
||||
protected void notifyFailure (int oid)
|
||||
protected function notifyFailure (oid :int) :void
|
||||
{
|
||||
// let the penders know that the object is not available
|
||||
PendingRequest req = (PendingRequest)_penders.remove(oid);
|
||||
var req :PendingRequest = _penders[oid];
|
||||
_penders[oid] = undefined;
|
||||
if (req == null) {
|
||||
Log.warning("Failed to get object, but no one cares?! " +
|
||||
trace("Failed to get object, but no one cares?! " +
|
||||
"[oid=" + oid + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < req.targets.size(); i++) {
|
||||
Subscriber target = (Subscriber)req.targets.get(i);
|
||||
for (var ii :int = 0; ii < req.targets.length; ii++) {
|
||||
var target :Subscriber = req.targets[ii];
|
||||
// and let them know that the object is in
|
||||
target.requestFailed(oid, null);
|
||||
}
|
||||
@@ -323,17 +324,15 @@ public class ClientDObjectMgr
|
||||
* This is guaranteed to be invoked via the invoker and can safely do
|
||||
* main thread type things like call back to the subscriber.
|
||||
*/
|
||||
protected void doSubscribe (int oid, Subscriber target)
|
||||
protected function doSubscribe (oid :int, target :Subscriber) :void
|
||||
{
|
||||
// Log.info("doSubscribe: " + oid + ": " + target);
|
||||
|
||||
// first see if we've already got the object in our table
|
||||
DObject obj = (DObject)_ocache.get(oid);
|
||||
var obj :DObject = _ocache[oid];
|
||||
if (obj != null) {
|
||||
// clear the object out of the flush table if it's in there
|
||||
if (_flushes.remove(oid) != null) {
|
||||
// Log.info("Resurrected " + oid + ".");
|
||||
}
|
||||
_flushes[oid] = undefined;
|
||||
// add the subscriber and call them back straight away
|
||||
obj.addSubscriber(target);
|
||||
target.objectAvailable(obj);
|
||||
@@ -341,7 +340,7 @@ public class ClientDObjectMgr
|
||||
}
|
||||
|
||||
// see if we've already got an outstanding request for this object
|
||||
PendingRequest req = (PendingRequest)_penders.get(oid);
|
||||
var req :PendingRequest = _penders[oid];
|
||||
if (req != null) {
|
||||
// add this subscriber to the list of subscribers to be
|
||||
// notified when the request is satisfied
|
||||
@@ -363,14 +362,14 @@ public class ClientDObjectMgr
|
||||
* This is guaranteed to be invoked via the invoker and can safely do
|
||||
* main thread type things like call back to the subscriber.
|
||||
*/
|
||||
protected void doUnsubscribe (int oid, Subscriber target)
|
||||
protected function doUnsubscribe (oid :int, target :Subscriber) :void
|
||||
{
|
||||
DObject dobj = (DObject)_ocache.get(oid);
|
||||
var dobj :DObject = _ocache[oid];
|
||||
if (dobj != null) {
|
||||
dobj.removeSubscriber(target);
|
||||
|
||||
} else {
|
||||
Log.info("Requested to remove subscriber from " +
|
||||
trace("Requested to remove subscriber from " +
|
||||
"non-proxied object [oid=" + oid +
|
||||
", sub=" + target + "].");
|
||||
}
|
||||
@@ -380,14 +379,14 @@ public class ClientDObjectMgr
|
||||
* Flushes a distributed object subscription, issuing an unsubscribe
|
||||
* request to the server.
|
||||
*/
|
||||
protected void flushObject (DObject obj)
|
||||
protected function flushObject (obj :DObject) :void
|
||||
{
|
||||
// move this object into the dead pool so that we don't claim to
|
||||
// have it around anymore; once our unsubscribe message is
|
||||
// processed, it'll be 86ed
|
||||
int ooid = obj.getOid();
|
||||
_ocache.remove(ooid);
|
||||
_dead.put(ooid, obj);
|
||||
var ooid :int = obj.getOid();
|
||||
_ocache[ooid] = undefined;
|
||||
_dead[ooid] = obj;
|
||||
|
||||
// ship off an unsubscribe message to the server; we'll remove the
|
||||
// object from our table when we get the unsub ack
|
||||
@@ -398,16 +397,14 @@ public class ClientDObjectMgr
|
||||
* Called periodically to flush any objects that have been lingering
|
||||
* due to a previously enacted flush delay.
|
||||
*/
|
||||
protected void flushObjects ()
|
||||
protected function flushObjects () :void
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
for (Iterator iter = _flushes.keySet().iterator(); iter.hasNext(); ) {
|
||||
int oid = ((Integer)iter.next()).intValue();
|
||||
FlushRecord rec = (FlushRecord)_flushes.get(oid);
|
||||
var now :Number = new Date().getTime();
|
||||
for (var oid :int in _flushes) {
|
||||
var rec :FlushRecord = _flushes[oid];
|
||||
if (rec.expire <= now) {
|
||||
iter.remove();
|
||||
_flushes[oid] = undefined;
|
||||
flushObject(rec.object);
|
||||
// Log.info("Flushed object " + oid + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -475,7 +472,7 @@ protected class PendingRequest
|
||||
public var oid :int;
|
||||
public var targets :Array = new Array();
|
||||
|
||||
public PendingRequest (oid :int)
|
||||
public function PendingRequest (oid :int)
|
||||
{
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// $Id: EventNotification.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
|
||||
import com.threerings.presents.dobj.DEvent;
|
||||
|
||||
public class EventNotification extends DownstreamMessage
|
||||
{
|
||||
public function getEvent () :DEvent
|
||||
{
|
||||
return _event;
|
||||
}
|
||||
|
||||
public override function toString () :String
|
||||
{
|
||||
return "[type=EVT, evt=" + _event + "]";
|
||||
}
|
||||
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_event = ins.readObject();
|
||||
}
|
||||
|
||||
/** The event which we are forwarding. */
|
||||
protected var _event :DEvent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// $Id: FailureResponse.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
|
||||
public class FailureResponse extends DownstreamMessage
|
||||
{
|
||||
public function getOid () :int
|
||||
{
|
||||
return _oid;
|
||||
}
|
||||
|
||||
public function toString () :String
|
||||
{
|
||||
return "[type=FAIL, msgid=" + messageId + ", oid=" + _oid + "]";
|
||||
}
|
||||
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_oid = ins.readInt();
|
||||
}
|
||||
|
||||
protected int _oid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// $Id: LogoffRequest.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
public class LogoffRequest extends UpstreamMessage
|
||||
{
|
||||
public function toString () :String
|
||||
{
|
||||
return "[type=LOGOFF, msgid=" + messageId + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// $Id: ObjectResponse.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
|
||||
public class ObjectResponse extends DownstreamMessage
|
||||
{
|
||||
public function getObject () :DObject
|
||||
{
|
||||
return _dobj;
|
||||
}
|
||||
|
||||
public function toString () :String
|
||||
{
|
||||
return "[type=ORSP, msgid=" + messageId + ", obj=" + _dobj + "]";
|
||||
}
|
||||
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_dobj = ins.readObject();
|
||||
}
|
||||
|
||||
/** The object which is associated with this response. */
|
||||
protected var _dobj :DObject;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// $Id: SubscribeRequest.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
public class SubscribeRequest extends UpstreamMessage
|
||||
{
|
||||
/**
|
||||
* Constructs a subscribe request for the distributed object with the
|
||||
* specified object id.
|
||||
*/
|
||||
public function SubscribeRequest (oid :int)
|
||||
{
|
||||
_oid = oid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the oid of the object to which we desire subscription.
|
||||
*/
|
||||
public function getOid () :int
|
||||
{
|
||||
return _oid;
|
||||
}
|
||||
|
||||
public override function toString () :String
|
||||
{
|
||||
return "[type=SUB, msgid=" + messageId + ", oid=" + _oid + "]";
|
||||
}
|
||||
|
||||
public override function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeInt(_oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* The object id of the distributed object to which we are
|
||||
* subscribing.
|
||||
*/
|
||||
protected var _oid :int;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// $Id: UnsubscribeRequest.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
public class UnsubscribeRequest extends UpstreamMessage
|
||||
{
|
||||
/**
|
||||
* Constructs a unsubscribe request for the distributed object
|
||||
* with the specified object id.
|
||||
*/
|
||||
public function UnsubscribeRequest (oid :int)
|
||||
{
|
||||
_oid = oid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the oid of the object from which we are unsubscribing.
|
||||
*/
|
||||
public function getOid () :int
|
||||
{
|
||||
return _oid;
|
||||
}
|
||||
|
||||
public function toString () :String
|
||||
{
|
||||
return "[type=UNSUB, msgid=" + messageId + ", oid=" + _oid + "]";
|
||||
}
|
||||
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeInt(_oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* The object id of the distributed object from which we are
|
||||
* unsubscribing.
|
||||
*/
|
||||
protected var _oid :int;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// $Id: UnsubscribeResponse.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
|
||||
/**
|
||||
* Used to communicate to the client that we received their unsubscribe
|
||||
* request and that it is now OK to remove an object mapping from their
|
||||
* local object table.
|
||||
*/
|
||||
public class UnsubscribeResponse extends DownstreamMessage
|
||||
{
|
||||
public function getOid () :int
|
||||
{
|
||||
return _oid;
|
||||
}
|
||||
|
||||
public function toString () :String
|
||||
{
|
||||
return "[type=UNACK, msgid=" + messageId + ", oid=" + _oid + "]";
|
||||
}
|
||||
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_oid = ins.readInt();
|
||||
}
|
||||
|
||||
protected var _oid :int;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
public class UpstreamMessage
|
||||
implements Streamable
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// $Id: UsernamePasswordCreds.java 3099 2004-08-27 02:21:06Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.net {
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerrings.io.ObjectInputStream;
|
||||
import com.threerrings.io.ObjectOutputStream;
|
||||
|
||||
public class UsernamePasswordCreds extends Credentials
|
||||
{
|
||||
/**
|
||||
* Construct credentials with the supplied username and password.
|
||||
*/
|
||||
public function UsernamePasswordCreds (username :Name, password :String)
|
||||
{
|
||||
super(username);
|
||||
_password = password;
|
||||
}
|
||||
|
||||
public function getPassword () :String
|
||||
{
|
||||
return _password;
|
||||
}
|
||||
|
||||
public override function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeField(_password);
|
||||
}
|
||||
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_password = ins.readField(String);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected override function toString (buf :StringBuilder)
|
||||
{
|
||||
super.toString(buf);
|
||||
buf.append(", password=", _password);
|
||||
}
|
||||
|
||||
protected var _password :String;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user