
Assignment 5Implementation of a Distributed C2-style Chat SystemDue Friday, June 7, at the beginning of discussion. If you cannot attend discussion, then make arrangements with Joe to drop off your assignment with one of them before discussion. This assignment contributes 16% toward your final course grade.SummaryKeeping with the chat system theme of the assignments in this course, in this assignment you will implement a working, distributed chat system using an architecture framework that supports the C2 style. Most of the effort will be focused on building a generic client/server C2-style connector based on the Java RMI middleware. Chat System DescriptionThis will be a far simpler chat system than has been used in previous assignment. It includes only three components: one chat room and two clients. The clients may appear at any time, but the chat room is a constant 'server' component. There is no notion of registration, any chat client can send a message as soon as it connects, which will be broadcast to all connected chat clients. More information about the architecture of the chat system is available in the special topic: assignment 5 slides available on the readings page. The system is also subject to any other constraints communicated to you by email from the TA or instructors. MaterialsYou will build your C2-style chat system using the c2.fw framework. A special build of this framework has been created for this class that contains all necessary base classes, interfaces, etc. This is the same framework you used for Assignment 4. You can download this version of the framework here: Download ICS 123 c2.fw framework After downloading the ICS 123 c2.fw framework, you should unzip the ZIP file. Javadoc documentation for the framework is found in the doc/ directory. Source for the framework is in the src/ directory (although you should not modify the source to accomplish this assignment). In the lib/ directory, you will find a file called ics123.jar. This is the JAR file that contains the framework. Add this JAR file to your Java CLASSPATH. If you are unsure of how to add a file to your CLASSPATH, read the instructions here (scroll down to the section entitled "of CLASSPATHs". Note that setting up your CLASSPATH for ArchStudio 3 is basically the same as setting it up for this assignment, you just add the JAR file to the classpath. This assignment's files, however, will work in JDK1.3, whereas ArchStudio 3 requires JDK 1.4. Your work will be evaluated using JDK1.3. NOTE: c2.fw requires JDK1.3 to run and will not run in JDK1.2.x or earlier. Additionally, to help you along, we have created complete implementations of all the components, an in-process Bootstrapper so you can experiment with a single-process version of the system, and two additional bootstrappers: ServerBootstrap and ClientBootstrap, to properly configure and instantiate the client and server parts of the architecture. We have also provided skeleton server and client connector classes. As such, your job will be to simply implement the internal workings of the server and client connector classes. You must use, at minimum, the classes provided to you for the application to work, but you are free to create more classes as the need arises (and it will). You should not, however, create new components or connectors, or otherwise change the architecture. Adding classes to the existing connector implementation classes is not considered an architectural change. The skeleton code for the application is all in the Java package "chatsys". The skeleton code for the RMI-based connectors is in the Java package "chatsys.rmi". All your classes should go in the "chatsys.rmi" package as well. You can download the code package here: Download ICS 123 RMI Code Package When you unzip the code skeletons, you will find a directory tree similar to this: <directory
you unzipped in> |
+--rmi |
You will be writing the connector internals for the RMIServerConnector and the RMIClientConnector, as well as any necessary auxillary classes. To run the in-process (non-distributed) version of the chat system, we have included a class called chatsys.Bootstrap. Running this class with a command-line such as: java chatsys.Bootstrap (with the CLASSPATH appropriately set up) will instantiate and link up all the components and connectors and start them. The system will work, but will not be distributed. Before running the distributed version, you should start the RMI registry. It is recommended that you do this assignment on a machine where you are the sole user (i.e. not a shared UNIX machine) as there is one RMI registry per machine, and users working on the same machine can conflict with each other. To start the RMI registry on Windows, open up a new command prompt and run: rmiregistry IMPORTANT: When you run rmiregistry, make sure that the parent directory of chatsys/, (that is, the directory labeled as <directory you unzipped in> above) is explicitly on the CLASSPATH, or else you will most likely get ClassNotFoundErrors. To start the RMI registry on UNIX, you can background it at a terminal window with: rmiregistry & To start the server process: java chatsys.ServerBootstrap To start the client process: java chatsys.ClientBootstrap [clientName] [serverName] The server has no UI, so it will just sit there running. The client has a UI, but the default implementations of the RMI connector will not exchange messages, so nothing very interesting will happen until you code up the connector. ApproachYou may use any Java development environment that you like to develop these component internals. You may NOT add new components or connectors to the system, or otherwise change the architectural configuration. You may add additional classes that are part of individual components (i.e. graphical widgets) or message classes, as necessary. The course staff will tell you more about creating message classes in discussion section. All implementations must adhere to the C2 style. Even though it is sometimes possible to violate C2 style rules (i.e. passing references or passing pointers) using the c2.fw framework, this is prohibited in this assignment. More instructions on how to write the connectors will be provided by the course staff in discussion section. DeliverablesYou will turn in a report containing
You will also, by the deadline, email the TA the following two binaries:
java -jar server.jar java -jar client.jar obiwan Star_Wars_Server java -jar client.jar anakin Star_Wars_Server He will then test to make sure that the chat system works appropriately. You may assume that the TA also has the ics123.jar file on his CLASSPATH and the rmiregistry running. In evaluating your work, 25% of the credit will be earned for quality of design, 25% for source code organization and documentation, and 50% for correct operation of the program. If the TA is unable to run your program, you will get a zero on that portion of the assignment. As always, work on this assignment completely by yourself. Please contact us with any questions you have about the assignment. |
Copyright (C)2002 The Regents of the University of California.
All Rights Reserved Worldwide.
Department of
Information and Computer Science, University
of California, Irvine.