95-702 Organizational Communication and Distributed Object Technologies Homework Due: Tuesday, November 13, 2007 Lab Topics: Java RMI and Web Services Using Axis2 ======== ======================== Part I. Java RMI ================ (1) Chapter 5 of the Coulouris text contains a Java RMI case study. The code implements a distributed white board. Modify the code so that it acts as a distributed chat server. Rather than moving graphical objects about we would like to move simple text. The execution of one client program follows: C:>java MyChatClient client>Hello There Hello There This is cool Hello There This is cool I'm talking to myself Hello There This is cool I'm talking to myself ! C:> The explanation mark means quit. In this example, there were no other clients running. Your solution will allow for more than one client. Please place all of your classes in one directory so that you will not have to work with the Security Manager. See the course slides for help with working with rmic. Two or more users must be able to use the system to converse. Place all of your source code in a directory called javarmi. Post a zip file to Blackboard containing this code. Also, post to Blackboard a few console screen shots showing two or more clients talking. So that the registry has access to necessary files, be sure to start your rmiregistry from within your server directory. (2) The problem with the solution to question 1 is that the client must wait until the user enters a line of text before contacting the server. It would be far better to allow the server to make calls on the clients whenever any user enters a line of text. This is the popular publish subscribe design pattern. This is also called the observer pattern. Write one client program called ReaderClient.java and another called WriterClient.java. WriterClient.java will read from the console (one line at a time) and send each comment to the server. It writes to the server. Unlike the previous exercise, WriterClient will not read from the server at all. That is, unlike the solution to question 1, it will not bother to read comments posted by others from the server and write them to the console. It simply reads from the user and writes to the server. ReaderClient.java will run in a separate console window and wait for calls from the server. It reads from the server. These calls from the server will pass to the reader recent comments that have been entered. This client will call the rmi registry to get a remote reference to the CommentList. This client will then need to call a registration method on the server. The registration method will be passed a remote reference to an object that lives on the client and whose class extends UnicastRemoteObject. A working solution will have at least six open console sceens. One will be for the rmiregistry. The second will be for the CommentListServer. The third and fourth will be for user input (two executions of WriterClient.java) from two users. The fifth and sixth will be two separate executions of ReaderClient. Each showing the content of the comment list. We will not use a security manager so feel free to copy the server side stubs to the client and the client stub to the server. Nor will we concern ourselves with concurrency issues. So that the registry has access to necessary files, be sure to start your rmiregistry from within your server directory. The client stub will be generated from running rmic on the ReaderClient.class file. The command is "rmic -v1.2 ReaderClient" without the ".class". Place all of your source code in a directory called javarmiasynch. Post a zip file to Blackboard containing this code. Also, post to Blackboard a few DOS screen shots showing two or more clients talking.