Assignment 3
Deadline: 19.03.10, 23:59
Make sure to read the rules & guidelines on the Assignments page!
Description
In this assignment you will develop a shared whiteboard application through the use of DHTML, Ajax and Java Servlets. The whiteboard should allow users to share a whiteboard with text boxes.
Recall the blue boxes example from the week 8 tutorials. In this example a blue box appeared after a left-click by the user. It was also possible to drag the box in the browser window to any other location.
In the shared whiteboard application you develop, users should be able to perform a wide range of operations, namely create boxes, modify the text within the boxes, move the boxes, and finally, delete the boxes.
- You will need DHTML to control the behavior of the whiteboard for each user.
- The actions of one user (creation of a box, text edit, etc.) should be made visible to other users by using Ajax.
- The whiteboard data needs to be stored on the server side and handled through the Java Servlets mechanism.
The detailed required behavior is outlined below.
Required behavior
Users control the whiteboard through various actions. Your application must support the following actions:
- New box creation - when a user left-clicks an area in the browser window, a new box needs to be created.
- Box deletion - when an existing box is left-clicked the user should be prompted with an option to delete it.
- Text edit - when an existing box is left-clicked the user should be prompted with an option to enter/modify text (the text is limited to 140 characters).
- Moving a box - when a user left-clicks and drags an existing box (without releasing the mouse), the box should follow the mouse and move to its new position in the window.
All the users must always have a synchronized view of the whiteboard. This means that the server should always have the most up-to-date view of the whiteboard and the users must carry out periodic updates.
Note that users might arrive at different times. Therefore, new users should receive the current state of the whiteboard.
Race conditions
Note that there might be a virtual race condition, that is two users trying to perform an action on the same box simultaneously.
You need to handle the race conditions and MUST NOT allow two users to perform an action on the same box simultaneously. A user which fails to acquire a box to perform an action must be notified (in some way) of the failure.
Important! Beware of thread-safety issues on the server side. Recall that a servlet is a singleton object which is called by multiple threads (thread per user). You will need to access and manipulate shared objects (e.g. the whiteboard data structure) in a thread-safe fashion.
Design freedom
You have full freedom in boxes design (color, size) and the appearance of different menus that you find necessary. There are two limitations however:
- The text is limited to 140 characters.
- The text lines in each box cannot be longer than 30 characters.
You also control the way a user is notified of the failure to perform an action on a box.
Whatever you decide, your application should be easy and convenient to use.
Grading
This assignment is 15 points of the final grade.
Your work will be evaluated based on:
- Complying with the functionality requirements
- Correct use of Ajax, DHTML and Java Servlets mechanisms
- Clarity and ease of interaction