Course Data project

A JISC funded project aimed at improving course-related data at Sussex University

New features of Java EE 6 used in this project (part 1)

Oct

17

The XCRI-CAP project has given us the perfect reason to implement some of the new features of Java EE 6. Glassfish application server 3 is one of the first fully compliant Java EE 6 application servers. I’d like to mention some of the features I’ve made use of.

The first is the new scheduling feature found in EJB. The XCRI-CAP file is generated every night by populating a separate DB schema that maps to the XCRI-CAP XSD. Once the schema has been populated, the system regenerates the XCRI-CAP file that is used for the feed. In the past we would have had to use a CRON job to be able to set off the process but EJB 3.1 allows the use of the Schedule annotation. The schedule annotation will turn any EJB method into a timed process in a declarative way, using theĀ  schedule annotation. Here is the method we use to set off the nightly process:


/**
* Timed process to update schema and re-populate the XCRI-CAP file
*/
@Override
@Schedule(second = "0", minute = "0", hour = "2", persistent = false)
public void populateSchema() {
String academicYear = getAcademicYear();
List progs = loadProgProposals(academicYear);
populateSchema("MAIN", progs, true, false);
}

This process runs every night at 2am. More information on scheduling in Java EE 6 can be found here:

http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html

More to come in part 2.

Leave a Reply