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: ChatCodes.java,v 1.10 2002/07/26 20:35:01 ray Exp $
|
||||
// $Id: ChatCodes.java,v 1.11 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat;
|
||||
|
||||
@@ -10,19 +10,13 @@ import com.threerings.presents.data.InvocationCodes;
|
||||
*/
|
||||
public interface ChatCodes extends InvocationCodes
|
||||
{
|
||||
/** The module name for the chat services. */
|
||||
public static final String MODULE_NAME = "chat";
|
||||
|
||||
/** The chat localtype code for chat messages delivered on the place object
|
||||
* currently occupied by the client. This is the only type of chat
|
||||
* message that will be delivered unless the chat director is
|
||||
/** The chat localtype code for chat messages delivered on the place
|
||||
* object currently occupied by the client. This is the only type of
|
||||
* chat message that will be delivered unless the chat director is
|
||||
* explicitly provided with other chat message sources via {@link
|
||||
* ChatDirector#addAuxiliarySource}. */
|
||||
public static final String PLACE_CHAT_TYPE = "placeChat";
|
||||
|
||||
/** The message identifier for a speak request message. */
|
||||
public static final String SPEAK_REQUEST = "spkreq";
|
||||
|
||||
/** The message identifier for a speak notification message. */
|
||||
public static final String SPEAK_NOTIFICATION = "spknot";
|
||||
|
||||
@@ -32,31 +26,16 @@ public interface ChatCodes extends InvocationCodes
|
||||
/** The chat localtype for tells. */
|
||||
public static final String TELL_CHAT_TYPE = "tellChat";
|
||||
|
||||
/** The message identifier for a tell request. */
|
||||
public static final String TELL_REQUEST = "Tell";
|
||||
|
||||
/** The response identifier for a successful tell request. This is
|
||||
* mapped by the invocation services to a call to {@link
|
||||
* ChatDirector#handleTellSucceeded}. */
|
||||
public static final String TELL_SUCCEEDED_RESPONSE = "TellSucceeded";
|
||||
|
||||
/** The response identifier for a failed tell request. This is mapped
|
||||
* by the invocation services to a call to {@link
|
||||
* ChatDirector#handleTellFailed}. */
|
||||
public static final String TELL_FAILED_RESPONSE = "TellFailed";
|
||||
|
||||
/** The message identifier for a tell notification. */
|
||||
public static final String TELL_NOTIFICATION = "Tell";
|
||||
|
||||
/** The default mode used by speak requests. */
|
||||
/** The default mode used by {@link SpeakService#speak} requests. */
|
||||
public static final byte DEFAULT_MODE = 0;
|
||||
|
||||
/** The think mode to indicate that the user is thinking
|
||||
* what they're saying, or is it that they're saying what they're
|
||||
* thinking? */
|
||||
/** A {@link SpeakService#speak} mode to indicate that the user is
|
||||
* thinking what they're saying, or is it that they're saying what
|
||||
* they're thinking? */
|
||||
public static final byte THINK_MODE = 1;
|
||||
|
||||
/** The mode to indicate that a speak is actually an emote. */
|
||||
/** A {@link SpeakService#speak} mode to indicate that a speak is
|
||||
* actually an emote. */
|
||||
public static final byte EMOTE_MODE = 2;
|
||||
|
||||
/** An error code delivered when the user targeted for a tell
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// $Id: ChatMarshaller.java,v 1.1 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat;
|
||||
|
||||
import com.threerings.crowd.chat.ChatService;
|
||||
import com.threerings.crowd.chat.ChatService.TellListener;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link ChatService} 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 ChatMarshaller extends InvocationMarshaller
|
||||
implements ChatService
|
||||
{
|
||||
// documentation inherited
|
||||
public static class TellMarshaller extends ListenerMarshaller
|
||||
implements TellListener
|
||||
{
|
||||
/** The method id used to dispatch {@link #tellSucceeded}
|
||||
* responses. */
|
||||
public static final int TELL_SUCCEEDED = 0;
|
||||
|
||||
// documentation inherited from interface
|
||||
public void tellSucceeded ()
|
||||
{
|
||||
omgr.postEvent(new InvocationResponseEvent(
|
||||
callerOid, requestId, TELL_SUCCEEDED,
|
||||
new Object[] { }));
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void dispatchResponse (int methodId, Object[] args)
|
||||
{
|
||||
switch (methodId) {
|
||||
case TELL_SUCCEEDED:
|
||||
((TellListener)listener).tellSucceeded(
|
||||
);
|
||||
return;
|
||||
|
||||
default:
|
||||
super.dispatchResponse(methodId, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #tell} requests. */
|
||||
public static final int TELL = 1;
|
||||
|
||||
// documentation inherited from interface
|
||||
public void tell (Client arg1, String arg2, String arg3, TellListener arg4)
|
||||
{
|
||||
TellMarshaller listener4 = new TellMarshaller();
|
||||
listener4.listener = arg4;
|
||||
sendRequest(arg1, TELL, new Object[] {
|
||||
arg2, arg3, listener4
|
||||
});
|
||||
}
|
||||
|
||||
// Class file generated on 00:25:59 08/11/02.
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// $Id: SpeakMarshaller.java,v 1.1 2002/08/14 19:07:49 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat;
|
||||
|
||||
import com.threerings.crowd.chat.SpeakService;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link SpeakService} 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 SpeakMarshaller extends InvocationMarshaller
|
||||
implements SpeakService
|
||||
{
|
||||
/** The method id used to dispatch {@link #speak} requests. */
|
||||
public static final int SPEAK = 1;
|
||||
|
||||
// documentation inherited from interface
|
||||
public void speak (Client arg1, String arg2, byte arg3)
|
||||
{
|
||||
sendRequest(arg1, SPEAK, new Object[] {
|
||||
arg2, new Byte(arg3)
|
||||
});
|
||||
}
|
||||
|
||||
// Class file generated on 19:01:34 08/12/02.
|
||||
}
|
||||
Reference in New Issue
Block a user