|
Guidelines, Patterns, and code for end-to-end Java applications.Java Pet Store Demo 1.3.1 > Configuring the Demo Configuring the DemoThe Java Pet Store Demo allows various behaviors to be configured. This section describes the following customizations:
Setting Up E-mail Notification by Editing the Deployment Descriptors Adding a New Localization Configuring the Database Setting Up E-mail Notifications Using the J2EE SDK Deployment ToolYou can configure the Java Pet Store Demo to send customers e-mail notifications regarding the status of their orders. By default, these notifications are disabled, but you can enable them at deployment time.To set up e-mail notifications using the J2EE SDK deployment tool, follow these steps:
The Open Object dialog appears. Find <petstore.home>/opc.ear (or <petstore.home>/src/apps/opc/build/opc.ear if you built the EAR) and click Open Object. The OPC EAR appears in the Applications tree on the left panel.
In the inspector on the right panel, select the Env. Entries tab. Select the param/SendApprovalMail entry, and set its value to true.
In the inspector on the right panel, select the Env. Entries tab. Select the param/SendConfirmationMail entry, and set its value to true.
In the inspector on the right panel, select the Env. Entries tab. Select the param/SendCompletedOrderMail entry, and set its value to true.
In the inspector on the right panel, select the Resource Refs tab. Select the mail/MailSession entry and edit the deployment settings at the bottom of the panel:
Change the Host field to the name of the mail server through which the confirmation e-mails should be sent. Change the User Name to the name you use to access the mail server. From the main menu, select File -> Save. Setting Up E-mail Notifications by Editing the Deployment DescriptorsTo set up e-mail notifications by editing the deployment descriptors, follow these steps:
Using a text editor, open <petstore.home>/src/apps/opc/src/ejb-jar.xml Enable order approval notifications. Look for these lines: <env-entry>Ensure that the env-entry-value entry is set to true. Enable order confirmation notifications. Look for these lines: <env-entry>Ensure that the env-entry-value entry is set to true. Enable order completion notifications. Look for these lines: <env-entry>Ensure that the env-entry-value entry is set to true. Save your changes to the standard EJB deployment descriptor. Open the OPC application's J2EE RI specific deployment descriptor. Using a text editor, open <petstore.home>/src/apps/opc/src/sun-j2ee-ri.xml. Configure the mail service. Look for these lines: <mail-configuration>
Change the value of the mail-host entry to the name of the mail server through which the confirmation e-mails should be sent. Change the value of the name entry to the name you use to access the mail server. Rebuild the OPC EAR. If you use the provided build files to rebuild the application, the OPC EAR is placed in <petstore.home>/apps/opc/build/opc.ear. (For more information on building the application, see Building the Demo.) To test the e-mail notifications, visit the Storefront, create a new user with your e-mail address, and complete an order. If the order is approved, you will receive an e-mail. You will receive one or more e-mails as parts of the order are fulfilled. When the order is completely fulfilled, you will receive one final e-mail. (For more information on how orders work in the pet store application, see Using the Demo.) Adding a New LocalizationThe Storefront of the Java Pet Store Demo is internationalized, and comes with the English (en) and Japanese (ja) localizations.To add another localization, follow these steps:
Place these in the subdirectory <petstore.home>/src/apps/petstore/src/docroot/<locale.code>/, where <locale.code> is the string representation of the locale. For example, the JSP pages for the Japanese localization are located in the directory <petstore.home>/src/apps/petstore/src/docroot/ja/. Create a localized screen definitions file. Place the screen definitions (which use your localized JSP pages, of course) in a file called <petstore.home>/src/apps/petstore/src/docroot/WEB-INF/screendefinitions_<locale.code>.xml, where <locale.code> is the string representation of the locale. For example, the Japanese screen definitions are stored in <petstore.home>/src/apps/petstore/src/docroot/WEB-INF/screendefinitions_ja_JP.xml. Add new catalog data for the locale. The XML file <petstore.home>/src/apps/petstore/src/docroot/populate/Populate-UTF8.xml contains the data used to populate the pet store's database. Localizing the catalog for a particular language involves adding new data to this XML file. To support localization, the CategoryDetails, ProductDetails, and ItemDetails elements take a xml:lang locale attribute. Before adding your own localized data, you may find it helpful to refer to the Japanese data in the XML file for examples. Configuring the DatabaseThe Storefront and Supplier applications in the Java Pet Store Demo can
be configured to use a different database from the default one (Cloudscape).
Using a different database may require different SQL statements (e.g. To configure the sample application to use a different database:
Change the value of the Change the value of the You also have the option of changing the catalog and inventory information
used to populate the sample application's database. To modify this data,
edit the file | |||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||