Global Positioning System Reference
In-Depth Information
The real-object application is running on one JVM, while the real-object
clients communicate with the remote-object application. Vice versa, the
application communicates with remote-object clients. From a programming
perspective, the client-server architecture is blurred and is basically given
as an n : 1 relationship for the RO:ROApp pair.
10.2.2 RO Client Design
The RO is wrapped in a client program responsible for RMI networking:
RealObjectClient extends RealObject
The client is started on a separate JVM with its main method doing the
handshake with the server step by step.
The server reference can be looked up and cast to the remote-server
interface: 1
RemoteServer roaServer =
(RemoteServer) Naming.lookup("//my-PC:1098/ROA");
Since the interface is part of the client and server software, it can be used
to store common SERVERNAME and PORTNUMBER . Once the client has connected
to the server, it can retrieve the server's GPSinfo() implementation.
Retrieving space and time from the server is a unidirectional request
initiated by anonymous clients. The server can only use the return values
to respond. As the vision requires the RO to report its position at any point
in time (page 18), the server is also required to get a remote reference (a
stub) to the client:
interface RemoteObjectClient extends Remote
This interface defines the RealObjectClient as a RealObject implementa-
tion. Instead of extending the UnicastRemoteObject to export the entire
client, a private, inner class RemoteClient is used to satisfy the defined
methods.
This way the developer can \run" a RO on a local machine and explicitly
create and export the RemoteObject (if and) as needed. Sometimes inner
classes are referred to as windows to their outer classes. The RemoteClient
propagates the outer classes' qualities and can be transferred to the server.
With the remote-servers method,
boolean identify( RemoteObject client ) throws RemoteException;
the client introduces itself to the server. Now, the server can use the client's
remote methods and decide to authorize it (return true ) to participate in
a scenario by logging in:
1 "my-PC" should be replaced with the server's name or with "localhost" , if client
and server run on the same machine.
 
Search WWH ::




Custom Search