![]() |
![]() |
|
02152 Concurrent Systems Fall 2008 |
Mandatory Assignment 2: ITTP Server |
Home | Plan | Material |
Amendments, clarifications and FAQ are to be found at the
Remember to check this page regularly. Major issues will be announced via CampusNet.Information about practical matters is found below.
Observe that this assigment is fairly realistic and hence requires more coding than the first assigment including "plain" coding of string recognition etc.
The assignment is intended to be solved and reported in 30-35 hours each for a group of 2-3 (well-prepared) students.
You are expected to continue the group formation from the first assignment. If you would like to form new groups, you must inform HHLin due time.
Groups of 3 students are expected to make more elaborate solutions including at least one of the two extensions marked in the problem description:
The general report requirements also apply to this assignment.
The main report text (not including appendices) is expected to be brief, about 7-10 pages. See further documentation hints below.
Each group must hand in one paper copy of the report no later than
in the mail-boxes in the West entrance of Building 322
Specific contributions by the individual group members should be stated, and the report must be signed by all participants.
Also, the program files for this assignment must be handed in electronically as well (also before the deadline). See details below.
Since (at least) the second of these questions is difficult to explain in words, you are encouraged to use suitable diagrams.
The Java API provides a number of classes which may be very useful to you in solving some of more syntactically oriented parts of this task. In addition to the java.net.Socket and java.net.ServerSocket classes referred to in [PMG] you may find it helpful to look at the descriptions of the classes:
Class | Uses |
java.security.MessageDigest | Evaluation of message digests, such as MD5. |
java.security.DigestInputStream | Automatic evaluation of digests for input streams |
java.net.URI | Parsing and separation into components of URIs. |
java.io.File | Setting and reading properties of files. |
java.text.DateFormat | Parsing and formatting of date/times. |
java.io.StreamTokenizer | Parsing of input streams into sequences of tokens. |
Observe that your server must accept all requests that follow the given
syntax, but you need not reject requests which are not syntactically
perfect. For example, you may
tolerate extra space between tokens or more general URIs.
Since the protocol syntax is quite simple, a straight-forward, but systematic,
parsing approach should suffice.
You are recommended to start with implementing a single method, e.g. GET, without consideration for header lines in order to get the basic functionality to work. Then you may add header lines, more methods, and management control.
The program will be tested with the Java SE 6 platform and you may use any class libraries within this. Other class libraries must be delivered with your solution.
Both when reading requests and when generating responses, you should be very careful about the representation you use. You will probably like to treat header lines as strings. However, body content should not be converted to/from the String type, since that involves decoding/encoding which may change the length of the body as well as being dependent on the current locale settings. Rather body content should be read and written as raw octets (bytes).
There are various ways you may do this:
As stated in the problem description, you may design the management user interface as you like. Note, however, that an elaborate user interface is not appreciated if the basic functionality is not in order. Thus, you should give priority to functionality and usefulness rather than appearance.
For testing purposes, it must be possible to pass the port number, base directory, and user credential to your program as optional parameters. The parameters must be of the form:
The default value of the server port should be 36000 and the default value of the basedir should be the user's current working directory (Java property user.dir). You may define the default values of the userid and password (for PUT) yourselves.
You may add other program options, parameters or Java properties if you like, e.g. if you are using RMI.
Since this is a larger programming project, you are recommended to organize your code using the Java package notion. The toplevel package should be named ittp and the server could occur within that as ittp.server. If you have a separate control client program it may be named ittp.control. Otherwise you may organize your classes in subpackages as you like. Remember that in Java, the package structure must be reflected by the file structure.
The presence of the PUT request raises the question whether the resources (files) should be protected against concurrent access.
For the given assignment, this issue is not central. First of all, you may assume that your server is the only OS-process accessing these files. With respect to the internal concurrency in your server, you may consider the following approaches depending on your level of ambition:
In all cases, the problem should be mentioned in the report.
For functional testing of the server, you will need a client, which can send both correct and incorrect ITTP requests to the server and collect up the responses. A starting point for such a client is given by the program TCP_Client.java. This will enable you to test out the server with several simultaneous clients, each running in a separate window, while the server management interface runs in yet another window. You may also study the program code to see how to make timeout on a connection. The client program may be modified as you like.
Initially, you are recommended to test your system with the server and all clients running on the same host, i.e. the one you are logged in on. If this works, you should also to try it out in a truly distributed system, with clients on different hosts and so on. Note that this may mean that you need to set up suitable permissions. The information on RMI in [PMG] and the page on RMI details should help you to find an appropriate setup in this respect.
If you wish, you may also include source files which you have used for testing purposes.
Both the source files and the compiled
.class files must be collected into one or more .jar files.
If your source code and class files reside in the same tree structure,
you may create a .jar file by going to the
parent directory of the ittp package and issue the command:
If properly done, it should be possible to run the server
out-of-the-jar by issuing a command like:
Optional clients may be included in the same file or given as separate
jar-files.
You are only requested to hand in the program for the server and possibly the control client, but if you wish to hand in auxiliary programs you may include these in the .jar file(s). You should then explain what their purpose is and how they are to be activated out-of-the-jar!
The subject line of the mail must be
"Man2-NN"
where NN is your two-digit
group number, e.g. Man2-62
The format of the body of the mail is free, but must comprise your student numbers and names for identification purposes.
Furthermore, the mail body should include detailed instructions for running the various server and client programs.
The mail must be sent before the deadline.
There will be assistance for the assignment in the G-databar, building 308, rooms 15+16, as indicated on the activity plan.
Hans Henrik Løvengreen, Nov 10, 2008 |