Due - Monday, September 28, 2009 - 3:30PM
|
| URL |
Response Format
|
Action |
| {device_name}/xml/filelist |
200 OK
<FileList> <File> <Path>/path/to/file</Path> <Name>filename.ext</Name> <Size>file size</Size> <LastModified>last mod date</LastModified> </File> </FileList> |
List all files on the computer identified by device_name. For device name
all
, return a list of all files on all of the user's computers.
|
| {device_name}/xml/filelist?contains={query} |
200 OK
<FileList> <File> <Path>/path/to/file</Path> <Name>filename.ext</Name> <Size>file size</Size> <LastModified>last mod date</LastModified> </File> </FileList> |
List all files on the computer identified by device_name that have a file name that contains the query term. For device name all , return a list of all files on all of the user's computers that meet the query criteria. |
| {device_name}/xml/filelist?matches={query} |
200 OK
<FileList> <File> <Path>/path/to/file</Path> <Name>filename.ext</Name> <Size>file size</Size> <LastModified>last mod date</LastModified> </File> </FileList> |
List all files on the computer identified by device_name that have a file name that match the query term exactly. For device name all , return a list of all files on all of the user's computers that meet the query criteria. |
| {device_name}/xml/filelist?modifiedsince={date} |
200 OK
<FileList> <File> <Path>/path/to/file</Path> <Name>filename.ext</Name> <Size>file size</Size> <LastModified>last mod date</LastModified> </File> </FileList> |
List all files on the computer identified by device_name that have been modified since the date provided. For device name all , return a list of all files on all of the user's computers that meet the query criteria. |
| {device_name}/xml/file/{path/to/file/and/filename.ext} |
200 OK
File Contents |
Return contents of specified file.
|
Implementation Requirements and Hints
- At startup, your server will initialize your XML database. Between runs, you may save your database to a file and read it in at startup. You will also start the update thread you implemented for Lab 2.
- Your server will listen on port 3000. You may use a final variable to specify this value, or make it configurable.
- You may assume there is only one user at this point.
-
You
may assume that you only return locally stored information. In other
words, run the query over the data in the XML document in memory; do
not worry about proactively querying any other devices.
- Following is the testing procedure I will use to test your program:
-
Configure server to read a local directory.
- Start server using java -cp {classpath you provide} FileSyncApplication
- Using an HTTP client (e.g., a browser), issue GET requests for each of the URLs above. I will issue requests using valid information and invalid information. You should correctly respond to requests for data that does not exist as well as correctly respond to invalid requests.
Grading
- 15 points each for correct responses to each type of query (total 75 points)
-
25 points design and documentation