Updates to PRMI design to account for the need to provide a ClientObject

to the server-side implementation of an invocation service.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1592 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-07-18 20:56:44 +00:00
parent 06ab6c8b90
commit f186ef5537
+55 -42
View File
@@ -185,8 +185,7 @@ Presents Notes -*- outline -*-
* @param listener the listener that will be informed of success or * @param listener the listener that will be informed of success or
* failure. * failure.
*/ */
public void moveTo (int placeId, MoveListener listener) public void moveTo (int placeId, MoveListener listener);
throws InvocationException;
} }
Note again that remotely callable methods cannot return values. Note again that remotely callable methods cannot return values.
@@ -211,54 +210,68 @@ Presents Notes -*- outline -*-
is not recommended), the first listener in the argument list will be the is not recommended), the first listener in the argument list will be the
one to which caught exceptions are delivered. one to which caught exceptions are delivered.
- From the interface, marshaller implementations are generated for the - An InvocationProvider interface is generated from the InvocationService
service interface and all listener interfaces contained therein: interface:
public class LocationMarshaller implements LocationService public interface LocationProvider extends InvocationProvider
{ {
// ... /**
* Requests that this client's body be moved to the specified
* location.
*
* @param caller the client object of the client that invoked this
* remotely callable method.
* @param placeId the object id of the place object to which the
* body should be moved.
* @param listener the listener that will be informed of success or
* failure.
*/
public void moveTo (ClientObject caller, int placeId,
InvocationService.MoveListener listener)
throws InvocationException;
}
public int marshallerId; This InvocationProvider interface is what is implemented by a server
entity to provider an actual implementation of the services.
public void moveTo (int placeId, MoveListener listener) - From the InvocationService interface, marshaller implementations are
{ generated for the service interface and all listener interfaces
try { contained therein:
if (_provider != null) {
// this is a local request, dispatch it directly
_provider.moveTo(placeId, listener);
} else {
// pass the request to the invocation services for
// dispatch over the network
}
} catch (InvocationException ie) { public class LocationMarshaller implements LocationService
if (listener != null) { {
listener.requestFailed(ie); // ...
}
}
}
protected transient LocationService _provider; public int marshallerId;
}
An InvocationMarshaller is constructed on the server and passed at public void moveTo (int placeId, MoveListener listener)
construct time a InvocationService implementation that will provide {
the actual implementation of the service. The marshaller will then // pass the request to the invocation services for dispatch
register itself with the invocation services to receive an invocation // over the network
object id which will be used to identify that marshaller in client }
JVMs. }
The InvocationMarshaller instance can then be passed around the On the server, an InvocationProvider is registered with the invocation
distributed object system as any other object. If it is used on the services which will return an InvocationMarshaller to be used to provide
server, the methods will be passed directly through to the access to those services. The InvocationMarshaller instance can then be
implementation. If it is used on the client, it will marshall the passed around the distributed object system as any other object. It can
request parameters and send them over the network to the server -- be made a member of a distributed object or delivered in a distributed
where they will be dispatched to the implementation -- any response object event.
from which will be communicated back through InvocationListener
proxies which marshall the response and deliver it to the calling When the InvocationMarshaller is used on the client, it will marshall
client, which then unpacks the response and delivers it to the the request parameters and send them over the network to the server --
original InvocationListener. where they will be dispatched to the implementation -- any response from
which will be communicated back through InvocationListener proxies which
marshall the response and deliver it to the calling client, which then
unpacks the response and delivers it to the original InvocationListener.
Access to the services on the server would generally be accomplished by
obtaining a reference directly to the provider that implements the
services and calling the methods via normal means. This allows the
server entities to provide whichever "caller" is appropriate.
- Notification services? Client provides "marshaller" in ClientObject, - Notification services? Client provides "marshaller" in ClientObject,
server calls down to client through said marshaller object. How to server calls down to client through said marshaller object. How to
register implementations on the client end? register implementations on the client end?
- Possible to integrate useful general purpose security?