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
+48 -35
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,8 +210,33 @@ 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 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;
}
This InvocationProvider interface is what is implemented by a server
entity to provider an actual implementation of the services.
- From the InvocationService interface, marshaller implementations are
generated for the service interface and all listener interfaces
contained therein:
public class LocationMarshaller implements LocationService public class LocationMarshaller implements LocationService
{ {
@@ -222,43 +246,32 @@ Presents Notes -*- outline -*-
public void moveTo (int placeId, MoveListener listener) public void moveTo (int placeId, MoveListener listener)
{ {
try { // pass the request to the invocation services for dispatch
if (_provider != null) { // over the network
// 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) {
if (listener != null) {
listener.requestFailed(ie);
}
} }
} }
protected transient LocationService _provider; On the server, an InvocationProvider is registered with the invocation
} services which will return an InvocationMarshaller to be used to provide
access to those services. The InvocationMarshaller instance can then be
passed around the distributed object system as any other object. It can
be made a member of a distributed object or delivered in a distributed
object event.
An InvocationMarshaller is constructed on the server and passed at When the InvocationMarshaller is used on the client, it will marshall
construct time a InvocationService implementation that will provide the request parameters and send them over the network to the server --
the actual implementation of the service. The marshaller will then where they will be dispatched to the implementation -- any response from
register itself with the invocation services to receive an invocation which will be communicated back through InvocationListener proxies which
object id which will be used to identify that marshaller in client marshall the response and deliver it to the calling client, which then
JVMs. unpacks the response and delivers it to the original InvocationListener.
The InvocationMarshaller instance can then be passed around the Access to the services on the server would generally be accomplished by
distributed object system as any other object. If it is used on the obtaining a reference directly to the provider that implements the
server, the methods will be passed directly through to the services and calling the methods via normal means. This allows the
implementation. If it is used on the client, it will marshall the server entities to provide whichever "caller" is appropriate.
request parameters and send them over the network to the server --
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.
- 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?