Handouts and Solutions for

06-18156.2 Internet Computing Workshop: Sem2


Demonstrators

Our two demonstrators are: Cong lun Yao and Hasan Qunoo. Rather than have office hours in their office, they hold them in the labs: thus both of them will be there for both 3 hour lab sessions in the MSc lab.


Tutorial And Lab Classes

Each student is likely to have timetable clashes across some of the lab hours, hence a sufficient number of lab hours have been arranged so that, in spite of timetable problems, each student can attend a number of these hours. You are strongly advised to attend as many lab hours as you can to take advantage of the demonstrator (and classmate) support available. Any exam condition lab exercises will take place in the Friday lab sessions, as will any extra tutorials provided by the demonstrators (no students have timetable clashes for the Friday session).

Day
Time
Room
Mondays
09:00-12:00
LG04
Thursdays
14:00-17:00
LG04
Fridays
15:00-17:00
LG04

Handouts

Handouts are available from the school library from the box in the shelves. The librarian always has a master copy so if they run out from the shelf box, ask the librarian to run off extra copies.

Handout 1: JDBC

This link covers use of JDBC, using transactions via JDBC, using sequence fields in PostgreSQL, and describes the "Shop" database. There are links to the files used for the exercises in the handout. You should attempt all exercises. The exercises are unassessed, but are necessary preparation for the lab test (see below).

For Postgresql, you can find the online information about the School's setup here.

Handout 2: Use Cases

Use cases are a way of recording requirements that is understandable to non-technical people and not overly formal, yet precise and specific enough to provide a basis for planning and carrying out the implementation of an application. Furthermore, they can provide the basis for a significant part of the testing of an application.

Handout 3: Hibernate

This handout introduces Hibernate, an object-relational mapping tool.

Download the following HibernateShop.jar file. If you un-jar it (use the command "jar xvf HibernateShop.jar" from a terminal window in Linux or the command prompt window in Windows). This will create a directory called "src". Inside that directory you will find the source files for a working Hibernate Shop application. Look in Main.java to see the possible command line arguments. You can run it with the argument "drop-create" (without the double quotes) to safely drop any tables and sequences created by a previous run of the program, and create them afresh..

Please try the following exercises

Handout 4: Spring

SimpleSpring: using Spring to insert logging via aspects.

shop-spr-hib.jar: the latest version of the shop application using Spring and Hibernate

Handout 5: Acegi

shop-sha.jar: The shop application using Hibernate, Spring and Acegi

Please try the following exercise

Handout 6: Wicket

SimpleWicket.jar: A simple first web application using Wicket. Note that this does not use Hibernate, Spring or Acegi: you only need the Wicket jar files, the log4j jar file, the two for slf4j (slf4j-api-1.5.0.jar and slf4j-log4j12-1.5.0.jar) and the jar file for joda time. Get this working in the lab. Make sure you can use the debugger to stop at break points in the program and inspect variables. Try adding some more web pages using the same pattern you see here.

SimpleWicket2.jar: This is an extension of SimpleWicket.jar that adds a border, a navigation bar, bookmarkable links and styling.

SimpleWicketListView.jar. This adds a ListView component and demonstrates the basic model/view/controller pattern using a simple static pseudo-database. Some exercises to try:

  1. Add an extra instance variable called "description", of type String, to the Appointment class and modify the application to support setting the description as part of creating the appointment (using a TextField component), and displaying the description everywhere the description (using a Label component) is to be displayed.
  2. Modify your solution above to use a TextArea component for input of the description and MultiLineLabel for displaying it.
  3. Add a new "postpone1Day" use case: Add an extra column to the ViewAppts table of appointments called "Postpone". When this is selected, the appointment is recheduled for the day after the one it is currently scheduled for.
  4. Add a new "reschedule" use case. Here a reschedule link on the ViewAppts table takes you to a new page that lets you choose an alternative date, using a text field with a DateChooser, to replace the date in the corresponding appointment.
  5. Refactor the application so that the list of lecturers are maintained by the AppointmentService class (although initialised to some small list of names). Ensure that these names are used when making appointments and that, if a name is removed, all appointments that refer to that lecturer are also removed. Add new pages to let you add or delete lecturers.
  6. Add a new feature that lets you choose a lecturer from the list of lecturers and then displays only the appointments of that lecturer, with appointment deletion facilities as for the ViewAppts page.

Handout 7: Hibernate + Spring + Wicket + Acegi

SimpleHibSprWicAce2.jar: An extension of our Simple Wicket application to integrate all the technologies so far.


Assessments

Assessment 1: JDBC and Transactions.

Marks: 10% of the marks for the second semester of the ISS Workshop module (i.e. 5% of the marks for the entire module).

NOTE THE TIME CHANGE
Because of timetable clashes the Friday lab session, and the assessment on Friday 18th January, has had to be moved to 15:00-17:00

This will take place on Friday 18th January 15:00 - 17:00 the usual lab (LG04) under examination conditions. You will be asked to implement a program, similar to the exercises in the JDBC handout above (it will be harder than the first exercise in the handout, but easier than the last one). You will have access to the Java APIs, the module web site and your own files. You can bring any books or notes you like. The program you write will have to be submitted electronically at the end of the assessment session. Invigilators will be present to maintain examination conditions. You must write the program on the school systems using the school's PostgreSQL database server. In order to prepare for this exam, you should study the JDBC handout and attempt all the exercises at the end of the handout before the assessment.

Assessment 2: Hibernate.

Marks: 20% of the marks for the second semester of the ISS Workshop module (i.e. 10% of the marks for the entire module).

This will take place on Friday 8th February 15:00 - 17:00 the usual lab (LG04) under examination conditions. You will be asked to implement a use case in a hibernate program. You will be given a working program based on the Shopping example (which will be available before the lab session at 9am on Monday 4th Feb.) to which you will have to add the new use case. Implementation of the new use case will require adding a new business object and corresponding hbm.xml file and you will be required to implement the use case in a style similar to that shown for the use case in the Shopping example. You will have access to the Java APIs, the module web site and your own files. You can bring any books or notes you like. The program you write will have to be submitted electronically at the end of the assessment session. Invigilators will be present to maintain examination conditions. You must write the program on the school systems using the school's PostgreSQL database server. In order to prepare for this exam, you should study the full Hibernate handout and attempt all the hibernate exercises before the assessment.

Before the assignment you need to

  1. First drop all tables and sequences from your database.
  2. Start a new project in your IDE.
  3. Download the following jar file, shop-hib-solns.jar, and unpack it to get the sources that you have to use for this exercise. These are the sources to the solutions to the exercises you have been working on this week and that were discussed in the lecture today.
  4. Copy the hibernate.properties and log4j.properties files from your previous project into the new project.
  5. Get the new project working and familiarise yourself with it.

The actual assessed exercise will be made available at 15:00 in the lab but will be in the form of an extra piece of functionality that you will have to add to this project

Assessment 3: Spring-Hibernate-Acegi.

Marks: 20% of the marks for the second semester of the ISS Workshop module (i.e. 10% of the marks for the entire module).

 

Assessment 4: Wicket

Marks: 20% of the marks for the second semester of the ISS Workshop module (i.e. 10% of the marks for the entire module).

 

Assessment 5: Integrated Hibernate, Spring, Wicket and Acegi

Marks: 30% of the marks for the second semester of the ISS Workshop module (i.e. 15% of the marks for the entire module).

 


Alan P Sexton