The goal of this assignment is to deepen your understanding of basic RMI mechanisms through the design and implementation of a general RMI framework for Java implemented on top of TCP.
Your RMI framework must include the standard RMI modules, i.e., communication module, proxy, skeleton, dispatcher, and remote reference module as discussed in the class and described in Chapters 4 & 5 of the book Distributed Systems: Concepts & Design by Coulouris et al (henceforth referred to as CDK3). However, you do not need to implement an IDL compiler – you have to write the proxy and skeleton classes needed for the client and server programs that will use your RMI mechanism. Your implementation does not change the Java VM: everything is implemented using Java libraries.
The functionality of the various modules is discussed below. Additional specifications and suggestions can be found here.
The communication module implements the Request-Reply protocol that is at the heart of any RPC/RMI mechanism. You have to implement a class whose methods are invoked by the proxy (on the client side) and the skeleton (on the server side). A potential API for the communication module is described in Figure 4.12 of CDK3.
You do not have to adhere to this API, but it should be helpful to you in your design.
Your RMI implementation should provide at most once semantics. Since your CM uses TCP as the transport protocol, this should be relatively straightforward.
The proxy and skeleton are responsible for marshalling and unmarshalling the parameters and results for a remote method invocation. You can use Java serialization for marshalling the arguments and results. However, note that if a parameter or result being marshaled corresponds to a remote object, you have to replace the (local) object with its remote reference. Correspondingly, if a parameter or result being unmarshalled is a remote object reference, you have to create a local proxy for the remote object.
You have to implement a generic dispatcher that receives the request message from the communication module on the server side. The dispatcher is responsible for invoking the appropriate method of the skeleton, passing on the request. In your implementation, the dispatcher can be integrated into the communication module on the server side.
The remote reference module is responsible for translating between remote and local object references and for creating remote object references and translating between local and remote object references. Partial code for two classes RemoteObjectRef and RORtbl that implement the remote reference module is provided to you. Your job is to complete the implementation. (You are free to change the code for these classes).
An outline of the code for a generic server (yourRMI.java) is provided to you. The server should create an instance of the servant (the class implementing the remote interface) and associate the servant with a remote reference. The remote reference should be registered with the RMI registry.
In RMI, a “servant” class refers to a class that implements a remote interface. In Java RMI, remote interfaces extend the java.rmi.Remote class. Your remote interfaces should extend a class (say MyRemote) that specifies no public methods or data members. Some example servant implementations are provided to you.
Some example clients are provided to you. The only difference from a Java RMI client is the use of the RemoteObjRef.localize method for creating a proxy for a remote object reference.
RMIRegistry
The code for a simple registry is provided to you. The Registry implementation assumes that remote object references adhere to the RemoteObjRef class. If you change that class, you will need to change the registry.
You should submit
1. A short document (5 – 10 pages) consisting of the following:
a. A very short introduction outlining the content of your report.
b. A description of the general architecture, with an illustration of how its components interact with each other to realize RMI.
c. Key design decisions, including the fundamental data structures such as remote object tables, and the marshalling/unmarshalling mechanisms.
d. Basic classes and their non-private methods, together with brief descriptions of them (important ones would be given longer descriptions, while trivial ones very short descriptions).
e. Observations on your design, including a comparison with other possible designs.
The document as a whole should make it
clear how an invocation of the form
x=r.method(v,...);
can be compiled and can act as a RMI, where r
is a your remote object residing in a different VM.
2. A hardcopy of your code for this assignment.
3. Any output that you have generated while testing your program that illustrates the correct functioning of your program. Note adding additional debug statements in your code may be useful for this purpose. But do not get carried away; we are not interested in examining a trace of your programs since we will be testing them ourselves as discussed below.
4. Send a softcopy of your code with instructions on how to compile and run it in an email to setia at cs.gmu.edu. We will be testing the functionality of your RMI software using the test programs listed below.
You should test your RMI software with the following programs:
· ZipCodeServer.java the interface for the server of zip codes (post codes).
· ZipCodeServerImpl.java the implementation of the interface of the zip code server.
· ZipCodeList.java A class used by ZipCodeServer
· ZipCodeClient.java a client program for testing your program.
· Example data for the zip code client.
· ZipCodeRList.java the interface for the server
· ZipCodeRListImpl.java the implementation of the interface of the server
· ZipCodeRListClient.java a client program for ZipCodeRList for testing your program.
How your client and server can be tested is described in this document
1. Please read Chapter 4 and 5 of CDK3 (especially sections 4.3, 4.4, 5.2 and 5.5) before starting this assignment.
2. Please also look at the class slides on the project.
3. Further Technical Specifications are provided in this document.
4. Hints are available in case you are really stuck
.