Due - Wednesday, October 21, 2009
The goal of this project is to build a
SugarSync
-style
file management system that allows a user to remotely access files
stored on any personal computer via a web-based interface. You will
build this project in stages. For part 1, you will implement a web
service that allows a user to login, view a list of local files, view
files stored in a Google Documents account, open local files, and
upload local files to a Google Documents account. For part 2, you will
add the ability to view files stored on remote computers, backup local
files to remote computers, and restore deleted files from the backups
created. For part 3, you will propose and implement an extension of
your choice.
This document describes the requirements of Part 1
of your project. This portion will be built in smaller blocks,
submitted as labs the first few weeks of class.
The functional requirements of Part 1 of the project are as follows:
-
Login
- The user will visit a main login page and your web service will use one of the
Google Account Authentication API
methods to log in.
-
Settings
- Once logged in, the user may visit a settings page that will allow
him/her to set and/or change the root directory that will be exposed by
the application. In other words, if the web service receives a request
to list all of a user's files, it will provide a listing of all files
and directories found under the root directory.
-
File View
- The main interface of your service will be a file view that lists all
files available in the root directory, and all of the files available
in the user's Google Documents account. For each file, the interface
will list (at minimum) the name of the file, the size of the file, and
the last time the file was modified. You will also provide the user
with an option to open a file and an option to upload a local file to
the user's Google Documents account.
-
Search
- You will
also provide the user with an option to search for files meeting
certain criteria. The user may search by file name (contains or
matches) or by modified date. Your service will provide the file view
listing only files matching the given criteria.
Your web
service will provide two ways to access each of the functions described
above: an XML-based interface and an HTML-based interface.
XML Interface
You must support GET requests for the following URLS:
|
URL
|
Response Format
|
Action
|
|
/login
|
Allows user to authenticate using Google username and password.
|
|
|
/settings
|
200 OK
<Settings>
<Root directory="/path/to/directory"/>
</Settings>
|
|
|
/settings?rootdir={directory}
|
200 OK
|
Sets root directory to directory given.
|
|
{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.
|
|
{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.
|
|
{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.
|
|
{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.
|
|
gdocs/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 in the current user's Google Documents account.
|
|
xml/gdocsupload/path/to/file/and/filename.ext
|
200 OK
|
Upload the file specified to the current user's Google Documents account.
|
|
{device_name}/xml/file/{path/to/file/and/filename.ext}
|
200 OK
File Contents
|
Return contents of specified file.
|
HTML Interface
For
each /xml URL above, you will also support html/{URL} where html takes
the place of xml. The content returned in response to the HTML request
will be the XML content transformed into the appropriate HTML format
for viewing in a browser.
Implementation Requirements and Hints
-
Data
will be stored in an in-memory XML document. You will have a thread
that periodically traverses the root directory and updates the
document,
in a thread-safe
manner. An example document follows:
-
<Database>
<User name="username" local_rootdir="rootdir">
<Devices>
<Device>
<Name>computer name</Name>
<OnlineStatus>online</OnlineStatus>
<FileList>
<File>
<Path>/path/to/file</Path>
<Name>filename.ext</Name>
<Deleted>yes/no</Deleted>
<Size>file size</Size>
<Backup> <Location>location1</Location>
</Backup>
<LastModified>last mod date</LastModified>
</File>
</FileList>
</Device>
</Devices>
</User>
</Database>
-
Your service will be implemented using the RESTlet framework.
-
Your
service will use XSLT to transform the XML retrieved from the database
into the HTML returned in response to requests for HTML content.
Note:
Late project will only be considered in the case of a medical or other
emergency verified by a doctor's note or the dean's office.
Due 3:30PM - Wednesday, October 21, 2009
Refer to the
Submission Instructions
. In addition, make sure you
do not hardcode
any parameters that will change when running your program in a different environment. For example, you
should not
hard code "C:\\bob's computer\my directory" as your root directory, as
I will not be running your program on "bob's computer". You may use a
configuration file if you feel it is appropriate, and provide
sufficient README instructions for changing necessary parameters.