Design and Architecture of Duke’s Tutoring
Duke’s Tutoring is a web application that incorporates several Java EE technologies. It exposes both a main interface (for students, guardians, and tutoring center staff) and an administration interface (for staff to maintain the system). The business logic for both interfaces is provided by enterprise beans. The enterprise beans use the Java Persistence API to create and store the application’s data in the database. Figure 52-1 illustrates the architecture of the application.
The Duke’s Tutoring application is organized into two main projects, the dukes-tutoring-common library, and the dukes-tutoring-war web application. The dukes-tutoring-common library project contains the entity classes and helper classes used by the dukes-tutoring-war web application, and dukes-tutoring-common is packaged and deployed with dukes-tutoring-war. The library JAR file is useful for allowing the entity classes and helper classes to be reused by other applications, such as a JavaFX client application.
Duke’s Tutoring uses the following Java EE 6 platform features:
Java Persistence API entities
Java API for JavaBeans Validation (Bean Validation) annotations on the entities for verifying data
A custom Bean Validation annotation, @Email, for validating email addresses
Local, no-interface-view session and singleton beans
JAX-RS resources in a session bean
Java EE security constraints on the administrative interface business methods
All enterprise beans packaged within the WAR
JavaServer Faces technology, using Facelets for the web front end
A custom formatter, PhoneNumberFormatter
Security constraints on the administrative interface
AJAX-enabled Facelets components
Custom converters for the entity classes used in the user-interface components
The Duke’s Tutoring application has two main user interfaces, both packaged within a single WAR file:
The main interface, for students, guardians, and staff
The administrative interface used by the staff to manage the students and guardians, and to generate attendance reports
Apart from the main and administrative interfaces, there is a JUnit test that demonstrates how to use the embedded EJB container to test the business logic of the session beans.