Java Programming  «Prev  Next»

Java Mapping Method Signatures - Exercise

Mapping of method signatures

Course project: Simple client

Objective:Implement calling remote methods by using the Java mapping for the IDL.

Exercise scoring

You will receive 10 points for this exercise. This exercise is auto-scored; when you have completed the exercise, click the Submit button to receive full credit.


In this exercise, you will implement calling a simple remote method for the course project. At this point, we have two server objects, whose interfaces are:

module BookShopModule {
interface BookStoreInv {
long getNumCopiesOfBook(in string title);
boolean isBookInStock(in string title);
interface Pricer {
float priceBook(in string title);

Your job here is to fill in the client application that accesses the above server objects. The two servers have been implemented for you. The servers will place references into the Naming Service upon startup. You are also given a shell of the client application, which calls the Naming Service and gets references to the two server objects you will need. All you need to do is modify one method in this client shell.

Download files

First, download the file and then unzip it into a work directory. It should create two directories: exercise1 and exercise1solutions. Edit the env.bat file to reflect your local work directory.


  1. Edit the client.Client class by completing the implementation of the printBookInfo() method.
    The server object references and the title of the book are passed in as parameters, so you do not need to do anything else to get them.
  2. Use the mapping to devise what the signatures are for the methods getNumCopiesOfBook(), isBookInStock(), and priceBook().
  3. Test to see if the book title is in stock by using the BookStoreInv server object. If it is, call the methods on BookStoreInv and Pricer to determine the number of copies and price per copy. Print these values to System.out.
  4. If the book title is not in stock, print a message saying so.
  5. Run the starup.bat script, which will start both servers and the Naming Service.
  6. Run the IDL compiler on the exer3.idl file.
  7. Compile the classes.
  8. Then run > java client.Client XML on the command line to execute the client, which will look for the book titled XML.


If you get stuck, you can run the IDL compiler on exer1.idl and look at the generated classes BookShopModule.BookStoreInv and BookShopModule.Pricer to see the method signatures for all the operations.

Completing the exercise

When you have completed the exercise, click the Submit button.