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.
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.
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).
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.
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.