Overall structure

The project can be roughly divided into four parts:

step-web

Presentation layer

All the HTML/Javascript code is contained within the step-web project and is abstracted away and self-contained. It communicates with the server via AJAX requests (facilitated by the JQuery library). The AJAX requests follow a notation similar to the REST protocol (more on this in the section below). All requests are defined in src/main/webapp/js/ui-hooks.js

There is very little HTML markup. Most of the UI is generated via Javascript using JQuery. The HTML code is used to provide the basic structure and layout and ease development.

Functionality locations

All HTML code is defined in src/main/webapp. This directory contains the following elements:

The following files are noteworthy:

Web-tier Java layer

The step-web is built as a Front Controller pattern, where all client requests are caught by the ''FrontController''. This then dispatches requests to the relevant method in the relevant controller. The ''FrontController'' is also responsible for serialising responses. At time of writing this takes 2 forms:

FrontController

The FrontController object takes in a request URL, calls the relevant controller method and finally returns a serialised UTF-8 encoded response. The FrontController is configured by the web.xml descriptor to listen to all requests under /rest/.

For example,

http://localhost:8080/step-web/rest/timeline/getTimelineConfiguration

  1. Tomcat (or another container) passes the request to FrontController
  2. The FrontController looks at the remainder of the url /timeline/getTimelineConfiguration
  3. Identifies the controller based on the first portion: /timeline => TimelineController (simply suffixing the word Controller)
  4. Using Guice (see section on dependency injection), it retrieves the identified Controller singleton instance
  5. Reflectively calls the method called "getTimelineConfiguration" based on the next section
  6. finally if any parameters are passed in, these are passed to the method in order of appearance.

step-core

The following section outlines the key areas in this project

Data

The data is currently stored in CSV files and the ''Loader'' and ''TimelineModuleLoader'' are currently used to load into a Lucene Index. This is currently done manually through firstTime.jsp. (Modules, texts, commentaries, ...) can be found under $USER_DATA/Sword/... whereas the Lucene Indexes can be found under $USER_HOME/JSword/step. Under Windows, USER_HOME defaults to USER_HOME/AppData/Roaming. On linux, Sword and and JSword are .sword and .jsword.