2010년 8월 11일 수요일

Enabling E-Commerce for a Mail-Order Enterprise

1.5.1. Enabling E-Commerce for a Mail-Order Enterprise
CornCo Inc. runs a successful catalog-based mail-order business selling fresh flavored
popcorn. They want to expand into the exciting world of online sales. Here's how they
might do it

1. A customer visits the company's web site, http://www.cornco.com, and uses a web
browser to interact with the company's web server. This allows the customer to view
the company's products and make selections to purchase.
2. Before accessing protected or personalized sections of the web site, the customer must
log in (authenticate) to identify himself to the system. Once logged in, he is authorized
to use customer-related functions of the site and view his own data (and no one else's).
3. The web server uses a shopping cart servlet to keep track of the products the customer
has chosen to buy. The HTTP protocol is itself stateless, but servlets can persist
between client requests, so this shopping cart servlet can remember the customer's
selections even while the customer continues to browse the web site.
4. When the customer is done browsing and is ready to purchase the selected products,
the web server invokes a different checkout servlet. This servlet performs a number
of important tasks, using several Java Enterprise APIs.
5. The checkout servlet uses JDBC to retrieve the list of products to be purchased (stored
in a database by the shopping cart servlet).
6. Next, the servlet queries the customer for a shipping address, a billing address, and
other required information and then uses JDBC again to store this information in a
customer database. This database can be used, for example, by the CornCo marketing
department for direct mail purposes.
7. The servlet then sends the customer's billing address and total purchase price to the
billing server. This server is a legacy application, specific to CornCo, that has a
nonstandard interface. Fortunately, however, the billing server exports itself as a
CORBA object, so the servlet can treat the entire server as a CORBA remote object
and invoke the necessary methods on it.
8. In order to ensure the very freshest product, CornCo maintains warehouses
throughout the world. CornCo is a growing company, so the list of warehouses is
frequently updated. The checkout servlet uses JNDI to contact a directory server and
then uses the directory server to find a warehouse that is close to the customer and
has the customer's requested products in stock.
9. Having located a warehouse that can fulfill the customer's order, the checkout servlet
uses JMS to contact the company's enterprise messaging service. It uses this service
to send the customer's order to the selected warehouse in the form of a message. This
message is delivered to and queued up on the local computer at the warehouse.