|
1. Overview
CourseWork is a Java Servlet Web Application which provides course
management services, including a coursehomepage, syllabus, announcements,
schedule, on-line course materials, assignments, discussion boards,
and a gradebook. This document describes the basic system architecture
of the current implementation of CourseWork at Stanford University.
The
CourseWork application is comprised of two tiers:
1)
A servlet-based Web Application running under Apache Tomcat.
2) An Oracle 9i database.
Java
Servlet Engine:
We
are utilizing Apache Tomcat 4.1.24 as our Java Servlet engine. CourseWork 3.0 and 3.1
has been tested using Java 1.4.1
SQL
Database Component:
The
database component of CourseWork was designed to run as a single
user schema inside an Oracle 9i instance. We are currently using
Oracle 9i
We
are using the JDBC drivers which come with Oracle 9i. We have
used both the Thin driver and the OCI-8 driver. These drivers are
contained in the file classes12.zip which comes with Oracle 9i.
We repackaged these as a JAR file to include inside the /lib directory
of our web app, though that is not absolutely necessary if you want
to manually adjust your CLASSPATH to include the zip file.
2.
SQL Database
Coursework
is supported by a single SQL database schema. The schema can be
divided into a "Core" set of tables used by the entire
CourseWork application, and individual sets of tables used by each
tool.
Links to Database
schemas can be found at: http://www.stanford.edu/group/coursework/docsTech/
3.
Web Application
The CourseWork
web application is distributable as a single WAR (web application
archive) file. We build the WAR file using the Apache Ant tool.
The web application is comprised of a set of servlets, supporting
Java packages, a library of JAR files, configuration files, static
HTML files, and a set of templates which control the user interface
for the application. These templates are used in conjunction with
a templating engine called "Dynamic Templating Language",
or DTL, that was developed here at Stanford University by Highwire
Press. DTL will be discussed in more detail later in this document.
The CourseWork
developer directory has the following structure:
/conf - configuration
files for developer webapp
/devprodconf - conf files for the prod webapp on your dev server
/preprodconf - conf files for the preprod server
/prodconf - conf files for the production server(s)
/etc - web.xml file
/dtl - dtl templates
/lib - 3rd party JAR files
/src - CourseWork Java code
/web - static HTML files
build.xml - Ant build specifications
build - Ant build file
4.
Java Code
The CourseWork
Java code includes servlets and supporting Java packages.
A. Servlets
Several
servlets control core functionality of CourseWork - creating and
editing courses, site-level user administration, etc. These servlets
include:
- AdminCourse.java
- AdminSite.java
- AdminSitePerson.java
- AdminTools.java
- Bookmarker.java
- CopyCourse.java
- SessionTrack.java
- DTL.java
- MyCourses.java
- MyProfile.java
- Login.java
- Logout.java
The remainder
of the servlets are Tool servlets. Each tool typically has two servlets
- the student view, <tool>.java,
and the Admin View, Admin<tool>.java.
For example, the Announcements tool is composed of Announcements.java
and AdminAnnouncements.java.
B. Core Packages
The supporting Java packages are all under edu.stanford.coursework.*
There are two "core" packages which support core functionality
throughout the CourseWork system: edu.stanford.coursework.core and
edu.stanford.coursework.common. "Core" contains the four
main objects for CourseWork - Nexus, Person, Tool, and Content.
The Nexus object represents a course, a section of a course, or
a department. The Person object represents a user of CourseWork.
The Tool object represents a tool in the CourseWork system (as represented
by a button in the NavBar). Finally, the Content object represents
a single piece of content (either an uploaded file or a URL) used
in CourseWork. Person, Tool, and Content objects can all be associated
with one or more Nexus objects (except Content objects where the
relationship is always to a single Nexus).
Most objects
in CourseWork, including these core objects, have three associated
java classes - the object, a controller, and an SQL file. The object
contains constructor methods, get and set methods for each field,
and a "toDTLObject" method which creates a DTL object
from the object. The Controller class contains static methods to
get, create, save, remove objects from the database, as well as
other methods to manipulate objects. The SQL class contains static
string fields for each of the SQL query statements used in preparedStatements
to execute database transactions. For example, the Person object
model is comprised of "Person.java", "PersonController.java"
and "PersonSQL.java".
The edu.stanford.coursework.common
package contains
other objects used throughout the CourseWork system besides the
four core objects. These include an abstract "BaseServlet"
class, a SessionController to read and modify a user's HttpSession,
and the NavTrail object used to construct the "bread-crumb"
trail at the top of each CourseWork page.
C. Tool Packages
Each tool also
has an associated package:
- edu.stanford.coursework.coursehome
- edu.stanford.coursework.announcements
- edu.stanford.coursework.syllabus
- edu.stanford.coursework.schedule
- edu.stanford.coursework.coursematerials
- edu.stanford.coursework.assignments
- edu.stanford.coursework.discussion
- edu.stanford.coursework.grades
- edu.stanford.coursework.signup
To create a
new tool for CourseWork would require the introduction of a new
package for the tool as well as the student and admin view servlets.
The object model
used in the current CourseWork tool follows very closely the object
model for the core objects, eg, Announcement.java, AnnouncementController.java,
AnnouncementSQL.java.
5.
Dynamic Templating Language (DTL)
CourseWork
utilizes a Java-based system called Dynamic Templating Language,
or DTL, to render all HTML output. DTL was developed at Stanford's
Highwire Press (www.highwire.org) and is included as part of the
open source distribution of CourseWork as a JAR file (lib/dtl.jar).
DTL allows the CourseWork code to create DTLObjects from regular
Java objects and pass these to a DTL template, where tags within
the template get replaced by the DTLObject variable definitions
to create HTML output. DTL is extremely fast and efficient and contains
rich functionality for doing variable replacements.
EXAMPLE:
[[VARDEF $COLOR]]#CCCCCC[[/VARDEF]]
This font color is <FONT COLOR=[[$COLOR]]>grey</FONT>.
Or in Java Code:
DTLObject mainDTL = new DTLObject();
mainDTL.put(COLOR, #CCCCCC);
For
more instructions for how to use DTL, the following are available:
|