CS 340 - Software Design

Spring 2006


MP 4 - Networked Database

Due: Monday Amrch 27, 2006 at 11:59 pm

For this assignment, you will create a client/server pair of application to maintain a very simple database. The server is to maintain the database in a Java Collection Map Class. The clients will connect to the server via sockets and make requests to the server to update or retrieve data values from the data base.

To help keep unique port numbers among the members of the class while doing this assignment add 20,000 to the last 4 digits of your UIN to give the port number for you to use.

Server

The server is to be display a GUI when it is started. The server is to show the following information:
  1. The port number it is using. (And machine name or IP address?)
  2. The current values of all ten database items
  3. The number of client connections
  4. A log (text area) displaying a history of the client connections.
  5. An Exit button to shut down the server.
The server is to allow for multiple concurrent clients to access it.

The client will use the command line flag of -g to run in a GUI. Without the flag, the client is to run text based.

Client

  1. The client is to take a coomand line argument containing the machine name or IP address of the server's location.
  2. The client is to have interact with the server with two commands: Get and Put.

    The Get command will retrieve a value from the database. The client will need to send to the server the number of the position in the database of the value the server is to retrieve. It will be the server's job to validate this number. If the number is outside of the valid range of numbers for the database items, the server is to return an error code back to the client. If the number is valid, the server is to return the string value stored at that position in the database. The client is then the display the information returned by the server to the user (in some nice readable format).

    The Put command will store a value in the database. It will need to send an position in the database and the value to stored at that position. It will be the server's job to validate this number. If the number is outside of the valid range of numbers for the database items, the server is to return an error code back to the client. If the number is valid, the server is to store the string value at that position in the database ab\nd return a success message to the client. The client is then the display the information returned by the server to the user (in some nice readable format).

  3. The client is to have both a GUI and a text interface (sometimes called a CHUI, pronouned "chewy", for CHaracter User Interface). If the command line flag of -g is given, the client is to use the GUI. If the command line flag of -g is not given, the client is to use the text interface.
  4. The client user interfaces are also to have some way to quit the program. It is strongly suggested that this command send some information to the server to allow the server a "graceful" way to realize the client is stopping, so the server can shut down its end of the socket and terminate that thread.

Database

The database will store 10 string values. Each client will use the value from 0 to 9 to access the database

The database should be synchronized so that the different threads of the server will not cause a data collision.

The database is to be store in a Map type from the Java Collection Classes. You may use either the TreeMap or HashMap for this. It is assumed that the key value in the map will be an integer and the data value in the map will be a string, but that decision is left up to you, the programmer.

Network Protocol

The information sent between the server and the clients (the protocol) is left completely up to you, the programmer. However, you are to document this in your program's readme file (or some other appropriate location).

Grading of the Program

Due to the nature of network programs, you will have to demo the program to the TA for grading. We will set up a sign-up sheet to schedule these demos.

Submission of the Program

Your program is to be submitted electronically via the turnin command on the LINUX machines. The project name for this is mp4. All programs are expected to be written in good programming style.

Turnin your program electronically using the "turnin" command from your CS account as follows:

turnin -c cs340 -p mp4  [your project directory]
where the [your project directory] is the directory name under which you have all your files related to this programming problem. The turnin command will automatically compress the data under your directory, so there is no need to do the compression by yourself.

Notice you can only invoke turnin command on the Linux machines in the lab or after logging into the server machine oscar.cs.uic.edu.

If you want to verify that your project was turned in, look in the turnin directory for a file with your userid. For instance for this project, from your CS account you would type:

turnin -c cs340 -p mp4 -v

Note that you can execute turnin as many times as you would like, up until the program deadline when turnin will be disabled for this project. Each time you execute turnin for a project, you overwrite all of what you had turned in previously for that project. It does not work in an incremental way.

CS 340 - Fall 2005