Homework 3
CS520, Fall 2010


Due: Thursday, October 21

Package all the source files of your project into a zip file using the zip Ant target you developed in Homework 1, and upload the zip file to CSNS. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.


[Reading]

[CSNS File Manager]

CSNS File Manager is a new component of CSNS which you will develop in this quarter. An online file manager allows users to store and manage their files online using a web browser. For functionality typically provided by an online file manager, you can check out some commercial offerings such as www.box.net.

[Model and Hibernate Mapping] (10pt)

Add the following property to the csns.model.User class:

Add the following property to the csns.model.File class:

Modify the Hibernate mapping files for User and File accordingly. Run the hbm2ddl Ant task to verify the mapping.

[Database Scripts] (15pt)

Modify db/csns-create.sql to reflect the changes to the data models.

Modify db/csns-test-insert.sql so that

Folder1\
Folder2\
File1
File2
File3
File4

The sizes of the four files should be 100, 200, 300, and 400 bytes, respectively.

[Data Access] (25pt)

Add the declarations of the following methods to the interface csns.model.dao.FileDao and implement them in csns.model.dao.hibernate.FileDaoImpl:

[Testing] (10pt)

Add FileTest.java to the src/csns/test/ folder. The folder does not exist so you need to create it first.

Add filetest.xml to src/ folder. You need to modify filetest.xml so the the database URL, username, and password match your setup.

Modify build.xml to create a new target called filetest. This target should run FileTest.java, and if everything works properly, you should see the following output:

Folder1
File4
Folder1
Folder2
1000

[Subversion]

Commit all the changes to your Subversion repository, and create a tag called cs520-hw3.