The great invocation services rethink of 2002! Rearchitected the remote
method invocation services and converted everything to the new style. Could this be my biggest checkin ever? git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1642 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BodyObject.dobj,v 1.9 2002/06/20 22:37:32 mdb Exp $
|
||||
// $Id: BodyObject.dobj,v 1.10 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
@@ -18,9 +18,7 @@ public class BodyObject extends ClientObject
|
||||
*/
|
||||
public int location = -1;
|
||||
|
||||
/**
|
||||
* Returns a short string identifying this body.
|
||||
*/
|
||||
// documentation inherited
|
||||
public String who ()
|
||||
{
|
||||
return username + " (" + getOid() + ")";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BodyObject.java,v 1.3 2002/06/20 22:37:32 mdb Exp $
|
||||
// $Id: BodyObject.java,v 1.4 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
@@ -24,9 +24,7 @@ public class BodyObject extends ClientObject
|
||||
*/
|
||||
public int location = -1;
|
||||
|
||||
/**
|
||||
* Returns a short string identifying this body.
|
||||
*/
|
||||
// documentation inherited
|
||||
public String who ()
|
||||
{
|
||||
return username + " (" + getOid() + ")";
|
||||
|
||||
@@ -1,35 +1,15 @@
|
||||
//
|
||||
// $Id: LocationCodes.java,v 1.3 2002/05/26 02:24:46 mdb Exp $
|
||||
// $Id: LocationCodes.java,v 1.4 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
import com.threerings.presents.data.InvocationCodes;
|
||||
import com.threerings.crowd.client.LocationDirector;
|
||||
|
||||
/**
|
||||
* Contains codes used by the location invocation services.
|
||||
*/
|
||||
public interface LocationCodes extends InvocationCodes
|
||||
{
|
||||
/** The module name for the location services. */
|
||||
public static final String MODULE_NAME = "location";
|
||||
|
||||
/** The message identifier for a moveTo request. */
|
||||
public static final String MOVE_TO_REQUEST = "MoveTo";
|
||||
|
||||
/** The response identifier for a successful moveTo request. This is
|
||||
* mapped by the invocation services to a call to {@link
|
||||
* LocationDirector#handleMoveSucceeded}. */
|
||||
public static final String MOVE_SUCCEEDED_RESPONSE = "MoveSucceeded";
|
||||
|
||||
/** The response identifier for a failed moveTo request. This is
|
||||
* mapped by the invocation services to a call to {@link
|
||||
* LocationDirector#handleMoveFailed}. */
|
||||
public static final String MOVE_FAILED_RESPONSE = "MoveFailed";
|
||||
|
||||
/** The message identifier for a move notification. */
|
||||
public static final String MOVE_NOTIFICATION = "Move";
|
||||
|
||||
/** An error code indicating that a place identified by a particular
|
||||
* place id does not exist. Usually generated by a failed moveTo
|
||||
* request. */
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// $Id: LocationMarshaller.java,v 1.1 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
import com.threerings.crowd.client.LocationService;
|
||||
import com.threerings.crowd.client.LocationService.MoveListener;
|
||||
import com.threerings.crowd.data.PlaceConfig;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link LocationService} interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
* on the server. Also provides an implementation of the response listener
|
||||
* interfaces that marshall the response arguments and deliver them back
|
||||
* to the requesting client.
|
||||
*/
|
||||
public class LocationMarshaller extends InvocationMarshaller
|
||||
implements LocationService
|
||||
{
|
||||
// documentation inherited
|
||||
public static class MoveMarshaller extends ListenerMarshaller
|
||||
implements MoveListener
|
||||
{
|
||||
/** The method id used to dispatch {@link #moveSucceeded}
|
||||
* responses. */
|
||||
public static final int MOVE_SUCCEEDED = 0;
|
||||
|
||||
// documentation inherited from interface
|
||||
public void moveSucceeded (PlaceConfig arg1)
|
||||
{
|
||||
omgr.postEvent(new InvocationResponseEvent(
|
||||
callerOid, requestId, MOVE_SUCCEEDED,
|
||||
new Object[] { arg1 }));
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void dispatchResponse (int methodId, Object[] args)
|
||||
{
|
||||
switch (methodId) {
|
||||
case MOVE_SUCCEEDED:
|
||||
((MoveListener)listener).moveSucceeded(
|
||||
(PlaceConfig)args[0]);
|
||||
return;
|
||||
|
||||
default:
|
||||
super.dispatchResponse(methodId, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #moveTo} requests. */
|
||||
public static final int MOVE_TO = 1;
|
||||
|
||||
// documentation inherited from interface
|
||||
public void moveTo (Client arg1, int arg2, MoveListener arg3)
|
||||
{
|
||||
MoveMarshaller listener3 = new MoveMarshaller();
|
||||
listener3.listener = arg3;
|
||||
sendRequest(arg1, MOVE_TO, new Object[] {
|
||||
new Integer(arg2), listener3
|
||||
});
|
||||
}
|
||||
|
||||
// Class file generated on 00:25:59 08/11/02.
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: OccupantInfo.java,v 1.8 2002/07/23 05:54:52 mdb Exp $
|
||||
// $Id: OccupantInfo.java,v 1.9 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class OccupantInfo extends SimpleStreamableObject
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public Object getKey ()
|
||||
public Comparable getKey ()
|
||||
{
|
||||
return bodyOid;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
//
|
||||
// $Id: PlaceObject.dobj,v 1.9 2002/04/15 14:30:49 shaper Exp $
|
||||
// $Id: PlaceObject.dobj,v 1.10 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
import com.threerings.presents.dobj.*;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.dobj.OidList;
|
||||
|
||||
import com.threerings.crowd.chat.SpeakMarshaller;
|
||||
|
||||
public class PlaceObject extends DObject
|
||||
{
|
||||
@@ -19,4 +23,7 @@ public class PlaceObject extends DObject
|
||||
* to be known by everyone in the place.
|
||||
*/
|
||||
public DSet occupantInfo = new DSet();
|
||||
|
||||
/** Used to generate speak requests on this place object. */
|
||||
public SpeakMarshaller speakService;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
//
|
||||
// $Id: PlaceObject.java,v 1.6 2002/04/15 14:35:31 shaper Exp $
|
||||
// $Id: PlaceObject.java,v 1.7 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
import com.threerings.presents.dobj.*;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.dobj.OidList;
|
||||
|
||||
import com.threerings.crowd.chat.SpeakMarshaller;
|
||||
|
||||
public class PlaceObject extends DObject
|
||||
{
|
||||
@@ -13,6 +17,9 @@ public class PlaceObject extends DObject
|
||||
/** The field name of the <code>occupantInfo</code> field. */
|
||||
public static final String OCCUPANT_INFO = "occupantInfo";
|
||||
|
||||
/** The field name of the <code>speakService</code> field. */
|
||||
public static final String SPEAK_SERVICE = "speakService";
|
||||
|
||||
/**
|
||||
* Tracks the oid of the body objects of all of the occupants of this
|
||||
* place.
|
||||
@@ -26,6 +33,9 @@ public class PlaceObject extends DObject
|
||||
*/
|
||||
public DSet occupantInfo = new DSet();
|
||||
|
||||
/** Used to generate speak requests on this place object. */
|
||||
public SpeakMarshaller speakService;
|
||||
|
||||
/**
|
||||
* Requests that the specified oid be added to the
|
||||
* <code>occupants</code> oid list. The list will not change until the
|
||||
@@ -91,4 +101,18 @@ public class PlaceObject extends DObject
|
||||
this.occupantInfo = occupantInfo;
|
||||
requestAttributeChange(OCCUPANT_INFO, occupantInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>speakService</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 setSpeakService (SpeakMarshaller speakService)
|
||||
{
|
||||
this.speakService = speakService;
|
||||
requestAttributeChange(SPEAK_SERVICE, speakService);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user