From 2b094c6511a890fa7bd2d067dc32d85f0960961d Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 4 Mar 2003 01:35:33 +0000 Subject: [PATCH] Added InvocationMarshaller implementations for our prefab InvocationListener extensions. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2297 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/data/InvocationMarshaller.java | 67 ++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/presents/data/InvocationMarshaller.java b/src/java/com/threerings/presents/data/InvocationMarshaller.java index 07b4a4825..8fdbfea62 100644 --- a/src/java/com/threerings/presents/data/InvocationMarshaller.java +++ b/src/java/com/threerings/presents/data/InvocationMarshaller.java @@ -1,5 +1,5 @@ // -// $Id: InvocationMarshaller.java,v 1.4 2002/12/20 23:41:26 mdb Exp $ +// $Id: InvocationMarshaller.java,v 1.5 2003/03/04 01:35:33 mdb Exp $ package com.threerings.presents.data; @@ -85,6 +85,71 @@ public class InvocationMarshaller } } + /** + * Defines a marshaller for the standard {@link ConfirmListener}. + */ + public static class ConfirmMarshaller extends ListenerMarshaller + implements ConfirmListener + { + /** The method id used to dispatch {@link #requestProcessed} + * responses. */ + public static final int REQUEST_PROCESSED = 1; + + // documentation inherited from interface + public void requestProcessed () + { + omgr.postEvent(new InvocationResponseEvent( + callerOid, requestId, REQUEST_PROCESSED, + null)); + } + + // documentation inherited + public void dispatchResponse (int methodId, Object[] args) + { + switch (methodId) { + case REQUEST_PROCESSED: + ((ConfirmListener)listener).requestProcessed(); + return; + + default: + super.dispatchResponse(methodId, args); + } + } + } + + /** + * Defines a marshaller for the standard {@link ResultListener}. + */ + public static class ResultMarshaller extends ListenerMarshaller + implements ResultListener + { + /** The method id used to dispatch {@link #requestProcessed} + * responses. */ + public static final int REQUEST_PROCESSED = 1; + + // documentation inherited from interface + public void requestProcessed (Object result) + { + omgr.postEvent(new InvocationResponseEvent( + callerOid, requestId, REQUEST_PROCESSED, + new Object[] { result })); + } + + // documentation inherited + public void dispatchResponse (int methodId, Object[] args) + { + switch (methodId) { + case REQUEST_PROCESSED: + ((ResultListener)listener).requestProcessed( + args[0]); + return; + + default: + super.dispatchResponse(methodId, args); + } + } + } + /** * Initializes this invocation marshaller instance with the requisite * information to allow it to operate in the wide world. This is