Add this line to your shell startup scripts:
source /course/cs161/startups/cs161student
Make sure ~/.jython contains:
python.console=org.python.util.ReadlineConsole python.console.readlinelib=GnuReadline python.cachedir=/home/$USER/jpackages
Your fourth programming task is to extend you IMAP client to allow better for complex configuration and scripting by adding an embedded language: jython
Your goal in this assignment is to develop a client that will be useful when you develop and test your (future) IMAP server. As such, your focus should be on flexibility, rather than performance. However, since one use of your client will be to simulate high loads, performance does matter, and you will, once again, use an event-based architecture to support large numbers of concurrent connections. To do so in Java, just like the last assignment, you'll use the non-blocking sockets (SocketChannel) from Java's NIO package and an event loop implented over these sockets (by a Selector). Here's the link to NIO Basics.
Your client will run commands from a file, as in Assignment 1, with a couple changes. First, you will support many new commands (see below). Second, you will support some level of concurrency even when issuing commands to a single server.
Your client must accept, as its sole argument, the name of a file to be executed as jython code. When run without an argument, your program should start an interactive interpreter.
Starting code for this assignment is at /pro/web/web/courses/cs161/lang/.
We do not expect your client to produce output that conforms exactly to a super specific format, but your client should produce human-readable, structured, parsed responses for all commands you issue to the server, and every response the server produces. If the server doesn't respond, you should notify the user that something is wrong, and what you think the problem is.
For your scripts, performance.py should at least produce a table stating your measurements. Your table should show how response times are distributed as the number of clients (robots) using a single server grows. You should also either produce it in a format that is immediately scriptable by gnuplot/xgraph/jgraph, or should include a short script to graph your output. Graphs should be labeled properly. You are free to produce more meaningful statistics and measurements, and we will reward you for your extra effort, but make sure the TAs can easily read them.
For conformance.py, you should print out every criteria you have tested against and its result.
For example you might have:
conformance: ... <COPY command>[sequence set syntax] {Fail: Bad response} Request "A003 COPY 2:4 MEETING" produced Response "A003 OK COPY completed" Problem Not all messages copied. 3:4 not copied. <COPY command>[nonexistant copy] {Fail: Timeout} ...
Remember, document all your design decisions in your README. It would help both yourself and the TAs while grading your assignment.
You may use the same IMAP servers as in previous assignments. Don't hammer them! Just show a performance trend, not the limits of their ability.
You should also read RFC 2683 which contains advice for IMAP developers (clients and servers). It will help you write a better client, but more importantly, it will give you ideas for variant behavior that your client can provide in order to test your server.
To submit your code, run the following script:
/course/cs161/bin/cs161_handin lang [dirname]
where [dirname] is the location of your code (defaults to the current directory).
Please contact the TAs if you have problems submitting. For your own sanity, don't leave your submission until the minute before the deadline.
Your code will be graded on the following factors (and their weights).
Documentation and code legibility: | 20% |
Functionality (non-blocking, error reporting, etc): | 50% |
Robustness (malicious input, many connections, etc): | 30% |