Parameterize InvocationService on the ClientObject type expected to call the service, and generate
InvocationProviders that take that type instead of just ClientObject. Also, use the full set of import groupings no matter what. If that's the way we like it, that's the way we like it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6682 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -22,9 +22,11 @@
|
||||
package com.threerings.bureau.data {
|
||||
|
||||
import com.threerings.bureau.client.BureauService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.Integer;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the <code>BureauService</code> interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.crowd.chat.data.ChatChannel;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.client.InvocationService_InvocationListener;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
/**
|
||||
* An ActionScript version of the Java ChatService interface.
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.presents.client.InvocationService_InvocationListener;
|
||||
import com.threerings.util.Long;
|
||||
|
||||
import com.threerings.presents.client.InvocationService_InvocationListener;
|
||||
|
||||
/**
|
||||
* An ActionScript version of the Java ChatService_TellListener interface.
|
||||
*/
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
package com.threerings.crowd.chat.data {
|
||||
|
||||
import com.threerings.crowd.chat.client.ChannelSpeakService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.Byte;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the <code>ChannelSpeakService</code> interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
|
||||
@@ -23,10 +23,12 @@ package com.threerings.crowd.chat.data {
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatService;
|
||||
import com.threerings.crowd.chat.client.ChatService_TellListener;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.InvocationService_InvocationListener;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.data.InvocationMarshaller_ListenerMarshaller;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the <code>ChatService</code> interface
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
package com.threerings.crowd.chat.data {
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatService_TellListener;
|
||||
import com.threerings.presents.data.InvocationMarshaller_ListenerMarshaller;
|
||||
|
||||
import com.threerings.util.Long;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller_ListenerMarshaller;
|
||||
|
||||
/**
|
||||
* Marshalls instances of the ChatService_TellMarshaller interface.
|
||||
*/
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
package com.threerings.crowd.chat.data {
|
||||
|
||||
import com.threerings.crowd.chat.client.SpeakService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.Byte;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the <code>SpeakService</code> interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.threerings.crowd.client {
|
||||
|
||||
import com.threerings.crowd.data.PlaceConfig;
|
||||
|
||||
import com.threerings.presents.client.InvocationService_InvocationListener;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.crowd.client.BodyService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.langBoolean;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the <code>BodyService</code> interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
|
||||
@@ -23,9 +23,11 @@ package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.crowd.client.LocationService;
|
||||
import com.threerings.crowd.client.LocationService_MoveListener;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.Integer;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the <code>LocationService</code> interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.threerings.crowd.data {
|
||||
|
||||
import com.threerings.crowd.client.LocationService_MoveListener;
|
||||
|
||||
import com.threerings.presents.data.InvocationMarshaller_ListenerMarshaller;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
package com.threerings.admin.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* Defines the client side of the admin invocation services.
|
||||
*/
|
||||
public interface AdminService extends InvocationService
|
||||
public interface AdminService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Used to communicate a response to a {@link AdminService#getConfigInfo} request.
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.threerings.admin.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.admin.client.AdminService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ import com.threerings.presents.data.InvocationMarshaller;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from AdminService.java.")
|
||||
public class AdminMarshaller extends InvocationMarshaller
|
||||
public class AdminMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements AdminService
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.admin.server;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.admin.client.AdminService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
package com.threerings.bureau.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* Interface for the bureau to communicate with the server.
|
||||
*/
|
||||
public interface BureauService extends InvocationService
|
||||
public interface BureauService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Notifies the server that the bureau is up and running and ready to receive
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.threerings.bureau.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.bureau.client.BureauService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ import com.threerings.presents.data.InvocationMarshaller;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from BureauService.java.")
|
||||
public class BureauMarshaller extends InvocationMarshaller
|
||||
public class BureauMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements BureauService
|
||||
{
|
||||
/** The method id used to dispatch {@link #agentCreated} requests. */
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.bureau.server;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.bureau.client.BureauService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
package com.threerings.crowd.chat.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
import com.threerings.crowd.chat.data.ChatChannel;
|
||||
|
||||
/**
|
||||
* Provides a way for clients to speak on chat channels.
|
||||
*/
|
||||
public interface ChannelSpeakService extends InvocationService
|
||||
public interface ChannelSpeakService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Requests to speak the supplied message on the specified channel.
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.crowd.chat.client;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* The chat services provide a mechanism by which the client can broadcast chat messages to all
|
||||
@@ -31,7 +32,7 @@ import com.threerings.presents.client.InvocationService;
|
||||
* These services should not be used directly, but instead should be accessed via the
|
||||
* {@link ChatDirector}.
|
||||
*/
|
||||
public interface ChatService extends InvocationService
|
||||
public interface ChatService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Used to communicate the response to a {@link ChatService#tell} request.
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
package com.threerings.crowd.chat.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* Provides a means by which "speaking" can be allowed among subscribers
|
||||
* of a particular distributed object.
|
||||
*/
|
||||
public interface SpeakService extends InvocationService
|
||||
public interface SpeakService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Issues a request to speak "on" the distributed object via which
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.threerings.crowd.chat.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChannelSpeakService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ import com.threerings.presents.data.InvocationMarshaller;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from ChannelSpeakService.java.")
|
||||
public class ChannelSpeakMarshaller extends InvocationMarshaller
|
||||
public class ChannelSpeakMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements ChannelSpeakService
|
||||
{
|
||||
/** The method id used to dispatch {@link #speak} requests. */
|
||||
|
||||
@@ -24,10 +24,13 @@ package com.threerings.crowd.chat.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatService;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link ChatService} interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
@@ -37,7 +40,7 @@ import com.threerings.util.Name;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from ChatService.java.")
|
||||
public class ChatMarshaller extends InvocationMarshaller
|
||||
public class ChatMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements ChatService
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.threerings.crowd.chat.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.chat.client.SpeakService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ import com.threerings.presents.data.InvocationMarshaller;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from SpeakService.java.")
|
||||
public class SpeakMarshaller extends InvocationMarshaller
|
||||
public class SpeakMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements SpeakService
|
||||
{
|
||||
/** The method id used to dispatch {@link #speak} requests. */
|
||||
|
||||
@@ -25,6 +25,7 @@ import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChannelSpeakService;
|
||||
import com.threerings.crowd.chat.data.ChatChannel;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.crowd.chat.server;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.chat.client.SpeakService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
package com.threerings.crowd.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* The client side of the body-related invocation services.
|
||||
*/
|
||||
public interface BodyService extends InvocationService
|
||||
public interface BodyService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Requests to set the idle state of the client to the specified
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.threerings.crowd.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
import com.threerings.crowd.data.PlaceConfig;
|
||||
|
||||
@@ -30,7 +31,7 @@ import com.threerings.crowd.data.PlaceConfig;
|
||||
* place in the server. These services should not be used directly, but instead should be accessed
|
||||
* via the {@link LocationDirector}.
|
||||
*/
|
||||
public interface LocationService extends InvocationService
|
||||
public interface LocationService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Used to communicate responses to {@link LocationService#moveTo} requests.
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.threerings.crowd.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.client.BodyService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ import com.threerings.presents.data.InvocationMarshaller;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from BodyService.java.")
|
||||
public class BodyMarshaller extends InvocationMarshaller
|
||||
public class BodyMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements BodyService
|
||||
{
|
||||
/** The method id used to dispatch {@link #setIdle} requests. */
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.threerings.crowd.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.client.LocationService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ import com.threerings.presents.data.InvocationMarshaller;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from LocationService.java.")
|
||||
public class LocationMarshaller extends InvocationMarshaller
|
||||
public class LocationMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements LocationService
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.crowd.peer.client;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
import com.threerings.crowd.chat.client.ChatService;
|
||||
import com.threerings.crowd.chat.data.UserMessage;
|
||||
@@ -31,7 +32,7 @@ import com.threerings.crowd.chat.data.UserMessage;
|
||||
/**
|
||||
* Bridges certain Crowd services between peers in a cluster configuration.
|
||||
*/
|
||||
public interface CrowdPeerService extends InvocationService
|
||||
public interface CrowdPeerService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Used to forward a tell request to the server on which the destination user actually
|
||||
|
||||
@@ -27,9 +27,12 @@ import com.threerings.crowd.chat.client.ChatService;
|
||||
import com.threerings.crowd.chat.data.ChatMarshaller;
|
||||
import com.threerings.crowd.chat.data.UserMessage;
|
||||
import com.threerings.crowd.peer.client.CrowdPeerService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link CrowdPeerService} interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
@@ -39,7 +42,7 @@ import com.threerings.util.Name;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from CrowdPeerService.java.")
|
||||
public class CrowdPeerMarshaller extends InvocationMarshaller
|
||||
public class CrowdPeerMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements CrowdPeerService
|
||||
{
|
||||
/** The method id used to dispatch {@link #deliverBroadcast} requests. */
|
||||
|
||||
@@ -26,10 +26,12 @@ import javax.annotation.Generated;
|
||||
import com.threerings.crowd.chat.client.ChatService;
|
||||
import com.threerings.crowd.chat.data.UserMessage;
|
||||
import com.threerings.crowd.peer.client.CrowdPeerService;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
/**
|
||||
* Defines the server-side of the {@link CrowdPeerService}.
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.crowd.server;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.client.BodyService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.crowd.server;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.crowd.client.LocationService;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
|
||||
@@ -26,6 +26,8 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
import com.samskivert.util.HashIntMap;
|
||||
import com.samskivert.util.Interval;
|
||||
@@ -63,9 +65,6 @@ import com.threerings.crowd.data.PlaceConfig;
|
||||
import com.threerings.crowd.data.PlaceObject;
|
||||
import com.threerings.crowd.server.CrowdObjectAccess.PlaceAccessController;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
import static com.threerings.crowd.Log.log;
|
||||
|
||||
/**
|
||||
@@ -567,7 +566,7 @@ public class PlaceManager
|
||||
* Registers an invocation provider and notes the registration such that it will be
|
||||
* automatically cleared when this manager shuts down.
|
||||
*/
|
||||
protected <T extends InvocationMarshaller> T addProvider (
|
||||
protected <T extends InvocationMarshaller<?>> T addProvider (
|
||||
InvocationProvider prov, Class<T> mclass)
|
||||
{
|
||||
T marsh = _invmgr.registerProvider(prov, mclass);
|
||||
@@ -579,7 +578,7 @@ public class PlaceManager
|
||||
* Registers an invocation dispatcher and notes the registration such that it will be
|
||||
* automatically cleared when this manager shuts down.
|
||||
*/
|
||||
protected <T extends InvocationMarshaller> T addDispatcher (InvocationDispatcher<T> disp)
|
||||
protected <T extends InvocationMarshaller<?>> T addDispatcher (InvocationDispatcher<T> disp)
|
||||
{
|
||||
T marsh = _invmgr.registerDispatcher(disp);
|
||||
_marshallers.add(marsh);
|
||||
|
||||
@@ -21,13 +21,15 @@
|
||||
|
||||
package com.threerings.presents.client;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* Serves as the base interface for invocation services. An invocation service can be defined by
|
||||
* extending this interface and defining service methods, as well as response listeners (which must
|
||||
* extend {@link InvocationListener}). For example:
|
||||
*
|
||||
* <pre>
|
||||
* public interface LocationService extends InvocationService
|
||||
* public interface LocationService extends InvocationService<ClientObject>
|
||||
* {
|
||||
*
|
||||
* // Used to communicate responses to moveTo() requests.
|
||||
@@ -62,7 +64,7 @@ package com.threerings.presents.client;
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public interface InvocationService
|
||||
public interface InvocationService<T extends ClientObject>
|
||||
{
|
||||
/**
|
||||
* Invocation service methods that require a response should take a listener argument that can
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
|
||||
package com.threerings.presents.client;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* Provides a means by which to obtain access to a time base object which can be used to convert
|
||||
* delta times into absolute times.
|
||||
*/
|
||||
public interface TimeBaseService extends InvocationService
|
||||
public interface TimeBaseService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Used to communicated the result of a {@link TimeBaseService#getTimeOid} request.
|
||||
|
||||
@@ -40,8 +40,8 @@ import static com.threerings.presents.Log.log;
|
||||
* Provides a base from which all invocation service marshallers extend. Handles functionality
|
||||
* common to all marshallers.
|
||||
*/
|
||||
public class InvocationMarshaller
|
||||
implements Streamable, InvocationService
|
||||
public class InvocationMarshaller<T extends ClientObject>
|
||||
implements Streamable, InvocationService<T>
|
||||
{
|
||||
/**
|
||||
* Provides a base from which invocation listener marshallers extend.
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.threerings.presents.client.TimeBaseService;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from TimeBaseService.java.")
|
||||
public class TimeBaseMarshaller extends InvocationMarshaller
|
||||
public class TimeBaseMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements TimeBaseService
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
package com.threerings.presents.peer.client;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.peer.data.NodeObject.Lock;
|
||||
|
||||
/**
|
||||
* Defines requests made from one peer to another.
|
||||
*/
|
||||
public interface PeerService extends InvocationService
|
||||
public interface PeerService extends InvocationService<ClientObject>
|
||||
{
|
||||
/**
|
||||
* Informs the node that the sending peer ratifies its acquisition or release of the specified
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.threerings.presents.peer.data;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.peer.client.PeerService;
|
||||
|
||||
@@ -36,7 +37,7 @@ import com.threerings.presents.peer.client.PeerService;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from PeerService.java.")
|
||||
public class PeerMarshaller extends InvocationMarshaller
|
||||
public class PeerMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements PeerService
|
||||
{
|
||||
/** The method id used to dispatch {@link #generateReport} requests. */
|
||||
|
||||
@@ -21,18 +21,17 @@
|
||||
|
||||
package com.threerings.presents.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -249,6 +248,11 @@ public class GenServiceTask extends InvocationTask
|
||||
imports.add(InvocationMarshaller.class);
|
||||
imports.add("javax.annotation.Generated");
|
||||
|
||||
// We only add a type parameter for the caller ClientObject type if the service has one
|
||||
if (sdesc.callerTypeSpecified) {
|
||||
imports.add(sdesc.callerType);
|
||||
}
|
||||
|
||||
// import classes contained in arrays
|
||||
imports.translateClassArrays();
|
||||
|
||||
@@ -276,7 +280,9 @@ public class GenServiceTask extends InvocationTask
|
||||
ctx.put("package", mpackage);
|
||||
ctx.put("methods", sdesc.methods);
|
||||
ctx.put("listeners", sdesc.listeners);
|
||||
ctx.put("importGroups", imports.toGroups(Arrays.asList("java", "com.threerings")));
|
||||
ctx.put("typeParameters",
|
||||
sdesc.callerTypeSpecified ? "<" + sdesc.callerType.getSimpleName() + ">" : "");
|
||||
ctx.put("importGroups", imports.toGroups());
|
||||
|
||||
// determine the path to our marshaller file
|
||||
String mpath = source.getPath();
|
||||
@@ -327,7 +333,7 @@ public class GenServiceTask extends InvocationTask
|
||||
// remove imports in our own package
|
||||
imports.removeSamePackage(mpackage);
|
||||
|
||||
ctx.put("importGroups", imports.toGroups(Arrays.asList("com.threerings")));
|
||||
ctx.put("importGroups", imports.toGroups());
|
||||
|
||||
// now generate ActionScript versions of our marshaller
|
||||
|
||||
@@ -362,7 +368,7 @@ public class GenServiceTask extends InvocationTask
|
||||
// remove imports in our own package
|
||||
imports.removeSamePackage(mpackage);
|
||||
|
||||
ctx.put("importGroups", imports.toGroups(Arrays.asList("com.threerings")));
|
||||
ctx.put("importGroups", imports.toGroups());
|
||||
ctx.put("listener", listener);
|
||||
String aslpath = _asroot + File.separator + mppath +
|
||||
File.separator + mname + "_" + listener.getListenerName() + "Marshaller.as";
|
||||
@@ -397,7 +403,7 @@ public class GenServiceTask extends InvocationTask
|
||||
// remove imports in our own package
|
||||
imports.removeSamePackage(sdesc.spackage);
|
||||
|
||||
ctx.put("importGroups", imports.toGroups(Arrays.asList("com.threerings")));
|
||||
ctx.put("importGroups", imports.toGroups());
|
||||
ctx.put("package", sdesc.spackage);
|
||||
|
||||
// make sure our service directory exists
|
||||
@@ -429,7 +435,7 @@ public class GenServiceTask extends InvocationTask
|
||||
// remove imports in our own package
|
||||
imports.removeSamePackage(sdesc.spackage);
|
||||
|
||||
ctx.put("importGroups", imports.toGroups(Arrays.asList("com.threerings")));
|
||||
ctx.put("importGroups", imports.toGroups());
|
||||
ctx.put("listener", listener);
|
||||
|
||||
String aslpath = _asroot + File.separator + sppath + File.separator +
|
||||
@@ -463,7 +469,7 @@ public class GenServiceTask extends InvocationTask
|
||||
}
|
||||
|
||||
// swap Client for ClientObject
|
||||
imports.add(ClientObject.class);
|
||||
imports.add(sdesc.callerType);
|
||||
|
||||
// add some classes required for all dispatchers
|
||||
imports.add(InvocationDispatcher.class);
|
||||
@@ -514,8 +520,9 @@ public class GenServiceTask extends InvocationTask
|
||||
// start with imports required by service methods
|
||||
ImportSet imports = sdesc.imports.clone();
|
||||
|
||||
// swap Client for ClientObject
|
||||
imports.add(ClientObject.class);
|
||||
if (!sdesc.methods.isEmpty()) {
|
||||
imports.add(sdesc.callerType);
|
||||
}
|
||||
|
||||
// import superclass and service
|
||||
imports.add(InvocationProvider.class);
|
||||
@@ -552,7 +559,8 @@ public class GenServiceTask extends InvocationTask
|
||||
"package", mpackage,
|
||||
"methods", sdesc.methods,
|
||||
"listeners", sdesc.listeners,
|
||||
"importGroups", imports.toGroups(Arrays.asList("java", "com.threerings")));
|
||||
"callerType", sdesc.callerType.getSimpleName(),
|
||||
"importGroups", imports.toGroups());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -567,6 +575,8 @@ public class GenServiceTask extends InvocationTask
|
||||
/** Rolls up everything needed for the generate* methods. */
|
||||
protected class ServiceDescription
|
||||
{
|
||||
public Class<?> callerType = ClientObject.class;
|
||||
public boolean callerTypeSpecified;// True if callerType came from a type parameter
|
||||
public Class<?> service;
|
||||
public String sname;
|
||||
public String spackage;
|
||||
@@ -578,6 +588,11 @@ public class GenServiceTask extends InvocationTask
|
||||
public ServiceDescription (Class<?> serviceClass)
|
||||
{
|
||||
service = serviceClass;
|
||||
Type[] genint = service.getGenericInterfaces();
|
||||
if (genint.length > 0 && genint[0] instanceof ParameterizedType) {
|
||||
callerType = (Class<?>)((ParameterizedType)genint[0]).getActualTypeArguments()[0];
|
||||
callerTypeSpecified = true;
|
||||
}
|
||||
sname = service.getSimpleName();
|
||||
spackage = service.getPackage().getName();
|
||||
ActionScript asa = service.getAnnotation(ActionScript.class);
|
||||
|
||||
@@ -332,21 +332,12 @@ public class ImportSet
|
||||
* ordering and spacing. Within each group, sorting is alphabetical.
|
||||
*/
|
||||
public List<List<String>> toGroups ()
|
||||
{
|
||||
return toGroups(IMPORT_GROUPS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the set of imports to groups of class names, according to the provided groups.
|
||||
* Within each group, sorting is alphabetical.
|
||||
*/
|
||||
public List<List<String>> toGroups (final List<String> groups)
|
||||
{
|
||||
List<String> list = Lists.newArrayList(_imports);
|
||||
Collections.sort(list, new Comparator<String>() {
|
||||
public int compare (String class1, String class2) {
|
||||
return ComparisonChain.start()
|
||||
.compare(findImportGroup(class1, groups), findImportGroup(class2, groups))
|
||||
.compare(findImportGroup(class1), findImportGroup(class2))
|
||||
.compare(class1, class2)
|
||||
.result();
|
||||
}
|
||||
@@ -355,7 +346,7 @@ public class ImportSet
|
||||
List<String> current = null;
|
||||
int lastGroup = -2;
|
||||
for (String imp : list) {
|
||||
int group = findImportGroup(imp, groups);
|
||||
int group = findImportGroup(imp);
|
||||
if (group != lastGroup) {
|
||||
if (current == null || !current.isEmpty()) {
|
||||
result.add(current = Lists.<String>newArrayList());
|
||||
@@ -415,10 +406,10 @@ public class ImportSet
|
||||
return Pattern.compile(pattern.toString());
|
||||
}
|
||||
|
||||
protected static int findImportGroup (String imp, List<String> groups)
|
||||
protected static int findImportGroup (String imp)
|
||||
{
|
||||
String longest = null;
|
||||
for (String prefix : groups) {
|
||||
for (String prefix : IMPORT_GROUPS) {
|
||||
if (!imp.startsWith(prefix)) {
|
||||
continue;
|
||||
}
|
||||
@@ -426,7 +417,7 @@ public class ImportSet
|
||||
longest = prefix;
|
||||
}
|
||||
}
|
||||
return groups.indexOf(longest);
|
||||
return IMPORT_GROUPS.indexOf(longest);
|
||||
}
|
||||
|
||||
protected HashSet<String> _imports = Sets.newHashSet();
|
||||
@@ -438,17 +429,24 @@ public class ImportSet
|
||||
protected static List<String> IMPORT_GROUPS = Lists.newArrayList(
|
||||
"flash.",
|
||||
"fl.",
|
||||
"java",
|
||||
"",
|
||||
OOO,
|
||||
OOO + "io.",
|
||||
OOO + "util.",
|
||||
OOO + "presents.",
|
||||
OOO + "tudey.",
|
||||
OOO + "orth.",
|
||||
OOO + "riposte.",
|
||||
OOO + "riposte.",
|
||||
OOO + "samsara.",
|
||||
OOO + "flashbang.",
|
||||
OOO + "downtown.",
|
||||
OOO + "biteme.",
|
||||
OOO + "who.",
|
||||
OOO + "blueharvest.");
|
||||
OOO + "blueharvest.",
|
||||
OOO + "piracy.",
|
||||
OOO + "ppa.",
|
||||
OOO + "yohoho.",
|
||||
OOO + "projectx.");
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import {{this}};
|
||||
* to the requesting client.
|
||||
*/
|
||||
{{generated}}
|
||||
public class {{name}}Marshaller extends InvocationMarshaller
|
||||
public class {{name}}Marshaller extends InvocationMarshaller{{typeParameters}}
|
||||
implements {{name}}Service
|
||||
{
|
||||
{{#listeners}}
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface {{name}}Provider extends InvocationProvider
|
||||
/**
|
||||
* Handles a {@link {{name}}Service#{{method.name}}} request.
|
||||
*/
|
||||
{{typeParams}}void {{method.name}} (ClientObject caller{{#hasArgs}}, {{/hasArgs}}{{getArgList}}){{^listenerArgs.isEmpty}}
|
||||
{{typeParams}}void {{method.name}} ({{callerType}} caller{{#hasArgs}}, {{/hasArgs}}{{getArgList}}){{^listenerArgs.isEmpty}}
|
||||
|
||||
throws InvocationException{{/listenerArgs.isEmpty}};
|
||||
{{/methods}}
|
||||
|
||||
@@ -23,10 +23,12 @@ package com.threerings.presents.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* A test of the invocation services.
|
||||
*/
|
||||
public interface TestService extends InvocationService
|
||||
public interface TestService extends InvocationService<ClientObject>
|
||||
{
|
||||
/** Used to dispatch responses to {@link TestService#test} requests. */
|
||||
public static interface TestFuncListener extends InvocationListener
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.threerings.presents.client.TestService;
|
||||
*/
|
||||
@Generated(value={"com.threerings.presents.tools.GenServiceTask"},
|
||||
comments="Derived from TestService.java.")
|
||||
public class TestMarshaller extends InvocationMarshaller
|
||||
public class TestMarshaller extends InvocationMarshaller<ClientObject>
|
||||
implements TestService
|
||||
{
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user