Your First Cup: An Introduction to the Java EE Platform

Architecture of the Example Application

The example application consists of four main components: DukesAgeResource, a JAX-RS RESTful web service; DukesBirthdayBean, an enterprise bean; FirstcupUser, a JavaTM Persistence API entity; and firstcup, a web application created with JavaServerTM Faces Facelets technology.

Figure 3–1 Architecture of the First Cup Example Application

Architecture of First Cup example applications.

DukesAgeResource is a JAX-RS resource that calculates the age of Duke, the Java mascot. Duke was born May 23, 1995, when the first demo of Java technology was publicly released.

DukesBirthdayBean is a local, no-interface view stateless session bean that calculates the difference between the user's age and Duke's age, and stores the user-submitted data in a Java Persistence API entity.

FirstcupUser is a Java Persistence API entity that represents a particular user's birthday. It is stored in a Java DB database table, and managed by DukesBirthdayBean's business methods.

The firstcup web application is a JavaServer Faces Facelets application that accesses DukesAgeResource to display Duke's age, reads in a date provided by the user, accesses DukesBirthdayBean to calculate who is older, and then displays the difference in years between the user and Duke and the average age difference of all users.

The firstcup web application consists of the following:

Tiers in the Example Application

The example application has one web tier component (the firstcup web client), three business tier components (the DukesAgeResource web service, the FirstcupUser entity, and the DukesBirthdayBean enterprise bean), and one enterprise information system (EIS) tier (the data in the Java DB database table). The user's web browser is the client tier component, as it accesses the rest of the application through the web tier.

Java EE Technologies Used in the Example Application

The DukesAgeResource web service is a JAX-RS resource. The DukesBirthdayBean enterprise bean is a stateless session bean. The FirstcupUser entity is a Java Persistence API entity. The firstcup web client is a JavaServer Faces application that runs in the web container of the Java EE server.