d25d5e53f1
interfaces, and Marshallers for same. The remaining snag has to do with the annoyance of ActionScript not supporting inner classes, which means that ChatService.TellListener for example has to become ChatService_TellListener. The code for generating the Java marshaller knows to add an import for ChatService if some random invocation service interface happens to reference ChatService.TellListener, but now it needs to be made to know to add an import for ChatService_TellListener in ActionScript land and it has to do it in a way that doesn't fuck up the Java code generation. Whee! git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4397 542714f4-19e9-0310-aa3c-eee0fc999fb1
78 lines
2.3 KiB
Cheetah
78 lines
2.3 KiB
Cheetah
package $package;
|
|
|
|
#foreach ($import in $imports)
|
|
import $import;
|
|
#end
|
|
|
|
/**
|
|
* Provides the implementation of the {@link ${name}Service} 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 ${name}Marshaller extends InvocationMarshaller
|
|
implements ${name}Service
|
|
{
|
|
#foreach ($l in $listeners)
|
|
/**
|
|
* Marshalls results to implementations of {@link ${l.name}Listener}.
|
|
*/
|
|
public static class ${l.name}Marshaller extends ListenerMarshaller
|
|
implements ${l.name}Listener
|
|
{
|
|
#foreach ($lm in $l.methods)
|
|
/** The method id used to dispatch {@link #$lm.method.name}
|
|
* responses. */
|
|
public static final int $lm.code = $velocityCount;
|
|
|
|
// from interface ${l.name}Marshaller
|
|
public void $lm.method.name ($lm.getArgList(false))
|
|
{
|
|
_invId = null;
|
|
omgr.postEvent(new InvocationResponseEvent(
|
|
callerOid, requestId, $lm.code,
|
|
new Object[] { $lm.getWrappedArgList(false) }));
|
|
}
|
|
|
|
#end
|
|
@Override // from InvocationMarshaller
|
|
public void dispatchResponse (int methodId, Object[] args)
|
|
{
|
|
switch (methodId) {
|
|
#foreach ($lm in $l.methods)
|
|
case $lm.code:
|
|
((${l.name}Listener)listener).${lm.method.name}(
|
|
${lm.getUnwrappedArgList(true)});
|
|
return;
|
|
|
|
#end
|
|
default:
|
|
super.dispatchResponse(methodId, args);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
#end
|
|
#foreach ($m in $methods)
|
|
#if ($velocityCount > 1)
|
|
|
|
#end
|
|
/** The method id used to dispatch {@link #$m.method.name} requests. */
|
|
public static final int $m.code = $velocityCount;
|
|
|
|
// from interface ${name}Service
|
|
public void $m.method.name ($m.getArgList(false))
|
|
{
|
|
#foreach ($la in $m.listenerArgs)
|
|
$la.marshaller listener$la.index = new ${la.marshaller}();
|
|
listener${la.index}.listener = arg$la.index;
|
|
#end
|
|
sendRequest(arg1, $m.code, new Object[] {
|
|
$m.getWrappedArgList(true)
|
|
});
|
|
}
|
|
#end
|
|
}
|