CS 5523 Operating Systems
Laboratory 2 - Spring 2003
Implementation a Remote Repository
using CORBA

Objectives:

Overview:

In this laboratory you will write and test a shared file repository based on CORBA. The project is divided on three parts:

Note: Prior to starting this laboratory you should be sure that you have successfully run the HelloWorld client and server from the Java tutorial.

You probably also want to look at the following:

Requirements:

Part I: The nonremote implementation

As part of this assignment, you will need to implement two interfaces: the Directory and the FileObject (e.g., DirectoryImpl and FileObjectImpl). In Parts II and III, the Directory and FileObject interfaces will become CORBA IDL modules.

Part II: Remote version with no synchronization

In Part II you will convert the Directory interface and the DirectoryImpl class to support remote invocation via CORBA. Your server will act as the repository and allow remote invocation of the methods in the Directory interface. Implement the FileObject as a CORBA interface. Thus, the getFile method of the Directory interface will return a remote object reference to the FileObject.

Part III: Synchronization for multiple clients

If more than one client accesses your remote objects, you must provide synchronization. Each java object has its own monitor. When you declare a method to be synchronized, the code within the method is executed mutually exclusively with the other synchronized methods in the object. The simplest way to handle synchronization, is to declare each method to be synchronized. This approach can be very inefficient. To receive full credit, you must implement a readers-writer type synchronization for your DirectoryImpl. You must also include in your writeup a discussion of your approach.

Test your synchronization by creating multiple simultaneous clients that access the repository.

Part IV: Object Serialization

This part of the assignment explores object serialization. Provide a second implementation of the FileObject interface that stores the actual data of the object in a file. The write method first creates a new local file to hold the data before removing the old one.

Your implementation should include a finalize method that removes the local data file associated with the FileObject. The finalize method will be called when the object is garbage collected.

Because you will be passing FileObject as a remote reference, you will not need the serialization. However, you still need to implement and test the serialization. The added complication in this problem is that the default technique for serialization will probably not work, because data from the object is kept on disk and local files only have meaning in a local environment. You will need to define your own methods with the following signature:

   private void readObject (ObjectInputStream in) throws
                     IOException, ClassNotFoundException;
 
   private void writeObject (ObjectOutputStream out)
                     throws IOException;
You can call:
    in.defaultReadObject( );
in the readObject to read in the default serialization first.

You can call:

    out.defaultWriteObject( );
in the writeObject method to write the default serialization before writing the special information.

Note: You must test the serialization separately before using this class in your remote programs.


Last Revision: March 15, 2003 at 1:35 pm by Kay A. Robbins. This material may be used for educational purposes provided that the source is credited.