Add RegistrationService to allow cpp clients to register receivers even though they're not using DObject
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6268 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -245,6 +245,7 @@
|
|||||||
<!-- generate services with an actionscript counterpart-->
|
<!-- generate services with an actionscript counterpart-->
|
||||||
<genservice header="lib/SOURCE_HEADER" asroot="src/as" classpathref="built.classpath">
|
<genservice header="lib/SOURCE_HEADER" asroot="src/as" classpathref="built.classpath">
|
||||||
<fileset dir="${src.dir}" includes="**/*Service.java">
|
<fileset dir="${src.dir}" includes="**/*Service.java">
|
||||||
|
<exclude name="**/RegistrationService.java"/>
|
||||||
<exclude name="**/InvocationService.java"/>
|
<exclude name="**/InvocationService.java"/>
|
||||||
<exclude name="**/peer/**"/>
|
<exclude name="**/peer/**"/>
|
||||||
<exclude name="**/admin/**"/>
|
<exclude name="**/admin/**"/>
|
||||||
@@ -255,9 +256,14 @@
|
|||||||
</genservice>
|
</genservice>
|
||||||
<!-- generate java-only services -->
|
<!-- generate java-only services -->
|
||||||
<genservice header="lib/SOURCE_HEADER" classpathref="built.classpath">
|
<genservice header="lib/SOURCE_HEADER" classpathref="built.classpath">
|
||||||
|
<fileset dir="${src.dir}" includes="**/RegistrationService.java"/>
|
||||||
<fileset dir="${src.dir}" includes="**/peer/**/*Service.java"/>
|
<fileset dir="${src.dir}" includes="**/peer/**/*Service.java"/>
|
||||||
<fileset dir="${src.dir}" includes="**/admin/**/*Service.java"/>
|
<fileset dir="${src.dir}" includes="**/admin/**/*Service.java"
|
||||||
|
excludes="**/gwt/ConfigService.java"/>
|
||||||
</genservice>
|
</genservice>
|
||||||
|
<gencppservice classpathref="built.classpath" cpproot="src/cpp">
|
||||||
|
<fileset dir="${src.dir}" includes="**/RegistrationService.java"/>
|
||||||
|
</gencppservice>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="genreceiver" depends="-preptools"
|
<target name="genreceiver" depends="-preptools"
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.threerings.presents.client;
|
||||||
|
|
||||||
|
import com.threerings.presents.client.Client;
|
||||||
|
import com.threerings.presents.client.InvocationReceiver.Registration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a receiver registration for a client that doesn't use DObject and thereby can't
|
||||||
|
* use the registration set on ClientObject.
|
||||||
|
*/
|
||||||
|
public interface RegistrationService
|
||||||
|
{
|
||||||
|
void registerReceiver(Client client, Registration registration);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.threerings.presents.data;
|
||||||
|
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
import com.threerings.presents.client.Client;
|
||||||
|
import com.threerings.presents.client.InvocationReceiver;
|
||||||
|
import com.threerings.presents.client.RegistrationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the implementation of the {@link RegistrationService} 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.
|
||||||
|
*/
|
||||||
|
@Generated(value={"com.threerings.presents.tools.cpp.GenCPPServiceTask"},
|
||||||
|
comments="Derived from RegistrationService.java.")
|
||||||
|
public class RegistrationMarshaller extends InvocationMarshaller
|
||||||
|
implements RegistrationService
|
||||||
|
{
|
||||||
|
/** The method id used to dispatch {@link #registerReceiver} requests. */
|
||||||
|
public static final int REGISTER_RECEIVER = 1;
|
||||||
|
|
||||||
|
// from interface RegistrationService
|
||||||
|
public void registerReceiver (Client arg1, InvocationReceiver.Registration arg2)
|
||||||
|
{
|
||||||
|
sendRequest(arg1, REGISTER_RECEIVER, new Object[] {
|
||||||
|
arg2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
import com.threerings.presents.client.InvocationReceiver;
|
||||||
|
import com.threerings.presents.data.ClientObject;
|
||||||
|
import com.threerings.presents.data.RegistrationMarshaller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatches requests to the {@link RegistrationProvider}.
|
||||||
|
*/
|
||||||
|
@Generated(value={"com.threerings.presents.tools.cpp.GenCPPServiceTask"},
|
||||||
|
comments="Derived from RegistrationService.java.")
|
||||||
|
public class RegistrationDispatcher extends InvocationDispatcher<RegistrationMarshaller>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates a dispatcher that may be registered to dispatch invocation
|
||||||
|
* service requests for the specified provider.
|
||||||
|
*/
|
||||||
|
public RegistrationDispatcher (RegistrationProvider provider)
|
||||||
|
{
|
||||||
|
this.provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RegistrationMarshaller createMarshaller ()
|
||||||
|
{
|
||||||
|
return new RegistrationMarshaller();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispatchRequest (
|
||||||
|
ClientObject source, int methodId, Object[] args)
|
||||||
|
throws InvocationException
|
||||||
|
{
|
||||||
|
switch (methodId) {
|
||||||
|
case RegistrationMarshaller.REGISTER_RECEIVER:
|
||||||
|
((RegistrationProvider)provider).registerReceiver(
|
||||||
|
source, (InvocationReceiver.Registration)args[0]
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
super.dispatchRequest(source, methodId, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.threerings.presents.server;
|
||||||
|
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
import com.threerings.presents.client.InvocationReceiver;
|
||||||
|
import com.threerings.presents.client.RegistrationService;
|
||||||
|
import com.threerings.presents.data.ClientObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the server-side of the {@link RegistrationService}.
|
||||||
|
*/
|
||||||
|
@Generated(value={"com.threerings.presents.tools.cpp.GenCPPServiceTask"},
|
||||||
|
comments="Derived from RegistrationService.java.")
|
||||||
|
public interface RegistrationProvider extends InvocationProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handles a {@link RegistrationService#registerReceiver} request.
|
||||||
|
*/
|
||||||
|
void registerReceiver (ClientObject caller, InvocationReceiver.Registration arg1);
|
||||||
|
}
|
||||||
@@ -76,7 +76,7 @@ public class GenCPPReceiverTask extends GenReceiverTask
|
|||||||
protected static final String RECEIVER_HEADER_TMPL =
|
protected static final String RECEIVER_HEADER_TMPL =
|
||||||
"com/threerings/presents/tools/cpp/receiver_h.mustache";
|
"com/threerings/presents/tools/cpp/receiver_h.mustache";
|
||||||
protected static final String DECODER_HEADER_TMPL =
|
protected static final String DECODER_HEADER_TMPL =
|
||||||
"com/threerings/corpse/tools/decoder_h.mustache";
|
"com/threerings/presents/tools/cpp/decoder_h.mustache";
|
||||||
protected static final String DECODER_CPP_TMPL =
|
protected static final String DECODER_CPP_TMPL =
|
||||||
"com/threerings/presents/tools/cpp/decoder_cpp.mustache";
|
"com/threerings/presents/tools/cpp/decoder_cpp.mustache";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user