about Jpetstore ( http://www.jfox.cn/jpetstore/ http://www.ibatis.com/jpetstore/jpetstore. html) <?xml:namespace prefix = o ns = "Urn:schemas-microsoft-com:office:office"/>
Jpetstore was developed by Sun, and was completely rewritten on the basis of popular pet store procedures, the earliest pet store Network application service based on Java EE platform. The most essential difference with other Petstore is that Jpetstore uses a design similar to that of a Microsoft Web pet store, but in bones it is a completely different network service architecture that fully embodies the advantages of Java programs in Web applications, so take it for example, This paper analyzes the application of Java EE in the Web layer from the bottom implementation.
System Architecture Overview
Jpetstore a small pet store E-commerce platform for the prototype to show you a simple database connection of the Java EE Web layer application, it integrates the Web layer applications must have the necessary elements, such as: User ID certification, commodity information inquiries, commodity information list and so on. In short, Jpetstore is an example of a simple and typical e-business that integrates customer shopping, placing orders, and management.
Of course, the reality of the system is not so simple, most of the system with multiple data sources and other EIS (Enterprise Information System) connected to a more complex database system design and connection. For example, the delivery of an order may be a company, a credit card service may be another company, a shipping is a company, so the design of the data system is complex (typically this requires a dedicated DBA to design the database). However, as a spy on the window of the Java EE, understand the operation of Java EE, jpetstore enough to be competent.
Jpetstore is divided into multiple modules, and a loosely coupled design architecture is adopted to allow for information interaction between multiple data sources and EIS. Its structure is relatively simple, consisting of a total of 4 parts:
· Shopping site
· Management. Such as: Sales statistics, manual acceptance/rejection of orders
· Order Processing
Accept/Process order messages via JMS
Notify customers with Java Mail
Send an order to a vendor via JMS
and modify the appropriate information for the order database
· Suppliers
Accept orders through JMS
Dispatch the goods to the user
Provides a web-based inventory management
Maintain Inventory database
System Architecture resolution
The pet store's Web service uses a Top-down architecture, the top-level of which is the WAF (Web application Framework) that controls the jump of the application screen, resulting in a view, and then calls the business component to implement the process (the overall structure is shown in Figure 1).
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml"/>
Fig. 1 overall frame structure of Jpet Store
WAF provides the services required for many Web applications, including request filtering and distribution, generating template views, reusable taglib, and screen flow control. The application component encapsulates the processing logic, they represent business data and can perform the necessary operations on these commercial data; The entity EJB represents the entity of the commercial application, including the customer, address, account, etc. the session EJB provides some methods, such as user login, output user information, manage cart, etc. ; Other session EJBs provide some common methods, such as generating unique identifiers, and so on. The traditional JavaBean component has evolved into a value object, transferring data between EJB components and applications, successfully processing the encapsulation of each object, effectively reducing the difficulty of programming. XML document classes are used to process order information.
The WAF of this example is an effective implementation of the Java EE Blueprint Web layer specification. A common web-tier process can generally be divided into four steps (see Figure 2):
Explain a request
Perform a business logic deal
Select Next View
Generate this view
Figure 2 WAF web-layer processing
The following is an analysis of the design of each module in the pet store, the main independent modules of the pet store (shown in Figure 3):
The control module is used to distribute requests to various business processing logic, control screen jumps, process corresponding components and users
Login and Registration control module implemented and extended by WAF
Shopping Cart Module Shopping cart track user's shopping process
Login module to determine the user landing page
The message module is used to asynchronously transfer orders from the pet store to the Order Processing center
The category module provides a Category view based on user query requirements
Customer module represents customer information, such as address, credit card, contact details, etc.
Figure 3 Jpet Store module design
In Figure 3, the control module controls all the interaction information and execution information, and each user session has a shopping cart corresponding to it.
The main components of a pet store are the following parts:
EJB represents the processing of business data and business logic
The JSP page defines the framework template (template.jsp) for the entire application view, the various JSP page files composed of the templates, and various referenced graphics files
The XML file is used to define the screen, screen jump control, binding URL to an HTML Action, custom Signon, and the deployment of Java EE
The servlet filter is used to verify the user's secure login and output code.
Asynchronous message sending component transport using XML encapsulated order to order Processing center
The installer is used to generate an example database.
Jpetstore implementation of the system
As described above, the common sense of the Java Web architecture involved in Jpetstore and some information about the Jpetstore system architecture, let's take a closer look at the implementation of the Jpetstore system.
First, get to know the Jpetstore implementation code overall file framework (Figure 4):
Figure 4 Architecture and implementation of Jpetstore code
Let's take a closer look at some of the techniques that are implemented here. J