Monday, October 29, 2007

Week 9 : 10/23/07 - 10/29/07( Implementation of check.properties generation)

This week was focussed on generating a check.properties file, if it is has not been included in the problem.

The solution was to develop a wizard like interface and ask the user a set of questions. Each page thereafter is driven by the answers to the current set of questions or prompts. The set of questions that will be asked are the following:

1. Page 1 ( Start page )

Question 1. Does this assignment needs to include a main class to be submitted by the student ?

2. Page 2

Prompt 1. Select the java class that will be marked as the main class.(The selection will be a set of radio button and the labels will be derived from the *.java classes that is present in the */student/ directory of the assigment that was uploaded.)

Prompt 2. Enter comma-separated list of required classes that a student must submit.
Prompt 3. Enter comma-separated list of required files that a student must submit.

Question 1. Is this assignment a GUI application ?
Question 2. Should the assignment's main class be run and its output captured and compared with an instructure supplied output file ?

Question 3. Should the assignment's main class be run with external inputs like *test*.in and the corresponding outputs of the program compared with instructor supplied output file like *test*.out ?

3. Page 3 ( If the submitted assignment is a GUI application )

Prompt 1: Enter the command line arguments to pass to the application when taking a snapshot.

Prompt 2: Enter the key strokes to execute before taking the snapshot of the application

Prompt 2: Enter the name of the program to run when taking a snapshot(Default is mainclass)

4. Page 4 ( if property test.run is true)

Prompt 1: Enter the command-line arguments to pass to the application when running it and capturing its output.

Prompt 2: Please specify the input to the application.

Prompt 3: Select the name of the file containing the expected output file ( The file names will be displayed will be ones which has extension *.expected and is present in the */student/ directory of the uploaded assignment )

5. Page 5 ( if property test.test-inputs is true )

Prompt 1 : Enter the command line arguments to pass to the application when testing inputs.

Prompt 2 : Please specify the classpath.

6. Page 6 ( if one of the properties test.run or test.test-inputs is true)

Prompt 1: Select the type of output comparision to use ( Available options are line,number,word)

Prompt 2: Please enter the tolerance factor.


After Page 6, the check.properties will be generated and written to the */student/ dirctory of the uploaded assignment.

If multiple assignments are loaded, then the process of generating check.properties will be done for each assignment.

Design
------


1. The ExerciseMB.java will keep track of the directory structure and the name of the files that were uploaded for an assignment. Each uploaded assignment will encapsulated in a class Exercise. The structure of the class is given below

Exercise
String name ( name of the exercise)
Directory for student
Directory for solution
Directory for grader
Directory for description


Each Directory object will have the set of file names that is part of the assignment

Directory
String name ( name of the directory)
String[] dirPath ( path of the directory from the root)
String rootPrefix ( root of the directory which will be repositorypath)
List of *.java files
List of *.html files
List of *.in and *.out files
List of *.expected files

Properties properties( check.properties values)

boolean hasProperties( boolean to indicate whether a check.properties is present in the Directory


2. When the assignment upload is complete, it will check if the assignment has a check.properties file by introspecting the */student/ directory. If no check.properties has been found, the the property

currentExercise
of ExerciseMB will be set to the name of the exercise and then the wizard will process will kick in for generating the check.properties for the */student/ directory of the uploaded assignment.

3. The various properties of the check.properties will be filled in by accessing the member Properties object of the Directory whose name is "student". For example to the set the property that an assignment has a main class, the jsf code is as follows:


<html:selectBooleanCheckbox value="#{exerciseUpload.currentExercise.studentDir.mainClassRequired}" /> <html:outputText value="Does this assignment have a main class to be submitted by student?" />




The property "currentExercise" will always point to the uploaded assignment which doesn;'t have a check.properties defined.

4. Each Exercise is associated with a wizard interface. The wizard has the information about its set of pages and it forwards to the relevant pages by introspecting the current page and the set of properties that has been enabled in the Properties object of Directory "student" as a result of questions/prompts from previous pages.

5. At the end of the wizard phase, a check.properties will be generated and written to the */student/ directory of the assignment.



Issues
---------

1. I am using tiles to define templates for a page. Unfortunately I cannot forward to a tile name. I have to create another .jspx page and then insert the tile definition in that page.

2. Initially I thought that extra path info can be passed to an assignment url. For example

http://localhost:8080/labrat-web/exercise_submit_files.faces/fjfjfjf9riwiwiw*&gdh2535/course name/exercise name

This looks more elegant than passing parameters in the URL. A tiles controller can be developed to parse this URL and then pass it as request parameters for downstream handling of the particular exercise. (This will be used as submit urls by the students)

It doesn't seem to work with jsf servlet mapping.
The error, predictably, is resource not found.

3. How do I encode a JSF view with parameters ? For example If I need to forward to a view

"some_view" with certain set of request parameters, how do I do it ?

No comments: