| CONTENTS | PREV | NEXT | INDEX | J2EE BluePrints |
This chapter illustrates the J2EE programming model in the context of an in-depth description of a multitier Web application: the pet store e-commerce application.
The functionality of the sample application was determined using a scenario-driven approach. Walks through scenarios illustrated the requirements for the user interaction as well as the interactions that happen within the system. Analysis of the sample application identified three very different kinds of interactions: a shopping interface that allows shoppers to buy items online, an administration interface for carrying out store administration activities, and a business-to-business interface through which the store can interact with suppliers. The discussions in this chapter focused mainly on the shopping interactions.
The architecture of the sample application partitions its functionality into modules, assigns functionality to tiers, and decomposes the modules into specific objects to represent the behavior and data of the application. The principles guiding the architecture include reuse of software designs and code, separation of stable from volatile code, object decomposition along skill lines, and ease of migration from a Web-centric to EJB-centric model.
The sample application adapts the Model-View-Controller architecture to the domain of enterprise applications. The model represents the application data and the business rules that govern access and modification of this data. The view renders the contents of a model. It accesses data from the model and specifies how that data should be presented. The controller defines application behavior; it interprets user gestures and maps them into actions to be performed by the model. In a stand-alone GUI client, these user gestures could be button clicks or menu selections. In a Web application, they appear as GET and POST HTTP requests to the Web tier. Based on the user gesture and the outcome of the model commands, the controller selects a view to be rendered as part of the response to this user request.
The J2EE platform provides system services that simplify the work that application objects need to perform. The sample application uses the Java 2 SDK, Enterprise Edition support for distributed transactions across multiple JDBC databases. In addition, it uses deployment and security capabilities of the J2EE platform to support customers with different profiles.