Files
narya/lib/marshaller.tmpl
T
Michael Bayne f84e832581 Can't have $Id$ in the template because it will be replaced when the
generated file is checked into CVS by the Id info for the generated file,
thus thwarting our efforts to track which version of the template from
which the generated file was generated.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1665 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-09-06 01:18:25 +00:00

76 lines
2.2 KiB
Cheetah

//
// [% idstr %]
package [% package %];
[% FOREACH import = 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 = listeners -%]
// documentation inherited
public static class [% l.name %]Marshaller extends ListenerMarshaller
implements [% l.name %]Listener
{
[% FOREACH lm = l.methods -%]
/** The method id used to dispatch {@link #[% lm.mname %]}
* responses. */
public static final int [% lm.mcode %] = [% lm.mcodeval %];
// documentation inherited from interface
public void [% lm.mname %] ([% lm.arglist %])
{
omgr.postEvent(new InvocationResponseEvent(
callerOid, requestId, [% lm.mcode %],
new Object[] { [% lm.wrapped_args %] }));
}
[% END -%]
// documentation inherited
public void dispatchResponse (int methodId, Object[] args)
{
switch (methodId) {
[% FOREACH lm = l.methods -%]
case [% lm.mcode %]:
(([% l.name %]Listener)listener).[% lm.mname %](
[% lm.unwrapped_args %]);
return;
[% END -%]
default:
super.dispatchResponse(methodId, args);
}
}
}
[% END -%]
[% FOREACH m = methods -%]
/** The method id used to dispatch {@link #[% m.mname %]} requests. */
public static final int [% m.mcode %] = [% m.mcodeval %];
// documentation inherited from interface
public void [% m.mname %] ([% m.arglist %])
{
[% FOREACH la = m.listener_args -%]
[% la.mtype %] [% la.aname %] = new [% la.mtype %]();
[% la.aname %].listener = [% la.oaname %];
[% END -%]
sendRequest(arg1, [% m.mcode %], new Object[] {
[% m.wrapped_args %]
});
}
[% END -%]
// Generated on [% genstamp %].
}