Download This directory contains solution to programming problem 20-1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
This directory contains solution to programming problem 19-3.
An overview of the Java files:
Constants.java
This interface contains constants needed in the various classes, mainly return codes from the
server.
Book.java
This is a simple book class, containing isbn, author and title.
LibraryBook.java
This class is an extension of the Book class, describing a library book. The extensions are
information about copies and reservations. (Max. one person may reserve the book at a time.)
Library.java
This file contains the Library RMI-interface, which offers library services such as registering
new books, reserving, and taking out books, etc.
LibraryImpl.java
Here is the implementation of the Library interface.
LibraryServer.java
This is the server program. An instance of the LibraryImpl is created, and bound in the rmi
registry. The name of the object is ‘BookServer’.
LibraryClient1.java and LibraryClient2.java
These are the two client programs as specified in the problem description. These programs
look up the server object in the rmi registry and communicate with it. Several clients may
communicate with the same server object.
To run the system you have to create a stub class from the LibraryImpl class:
>rmic –v1.2 LibraryImpl
The rmiregistry and the server program have to be started before the clients can run:
>start rmiregistry
>start java LibraryServer
>start java LibraryClient1
>start java LibraryClient2