209 76 14MB
English Pages 1088 Year 2003
Front cover
WebSphere Commerce mmerce V5.5 Handbook book Customization and Deployment Guide Runtime architecture, programming model, business and store models overview Team development scenario to create, customize, build, deploy and manage a store Implement advanced multi-tiered runtime configurations Integrate MQ, e-mail, and Commerce Analyzer
John Ganci Hernan Cunico Daniel Dunn Steve Insley Ryan Karchner Emad Muhanna Nicolai Nielsen Abhishek Singh Sean Zhu
ibm.com/redbooks
International Technical Support Organization WebSphere Commerce V5.5 Handbook Customization and Deployment Guide November 2003
SG24-6969-00
Note: Before using this information and the product it supports, read the information in “Notices” on page xxi.
First Edition (November 2003) This edition applies to IBM WebSphere Commerce V5.5, Business Edition on the Microsoft Windows 2000, IBM AIX, Sun Solaris, and IBM OS/400 platforms. In addition, this edition applies to IBM WebSphere Commerce Studio V5.5, Business Developers Edition for Microsoft Windows 2000. © Copyright International Business Machines Corporation 2003. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii The team that wrote this redbook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Become a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxvii Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxvii Part 1. Introduction to WebSphere Commerce V5.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1 Platform support and product packaging. . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.1 Supported platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.2 IBM WebSphere Commerce V5.5 product editions . . . . . . . . . . . . . . 5 1.1.3 IBM WebSphere Commerce Studio V5.5 product editions . . . . . . . . . 6 1.2 Features and benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2.1 IBM WebSphere Commerce V5.5, Professional Edition . . . . . . . . . . . 8 1.2.2 IBM WebSphere Commerce V5.5, Business Edition . . . . . . . . . . . . 13 1.3 Target audience of this IBM Redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.3.1 Roles and skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.3.2 Matching topics in this redbook to roles and skills . . . . . . . . . . . . . . 17 1.4 For more information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.4.1 IBM WebSphere Commerce product documentation . . . . . . . . . . . . 20 1.4.2 Web sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.4.3 IBM Redbooks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Chapter 2. Runtime architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2 WebSphere Commerce software components . . . . . . . . . . . . . . . . . . . . . 30 2.2.1 Web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.2.2 WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.2.3 Database Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.2.4 WebSphere Commerce Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2.2.5 WebSphere Commerce Payments Server . . . . . . . . . . . . . . . . . . . . 32 2.2.6 Enablement software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.3 WebSphere Commerce Server subsystems . . . . . . . . . . . . . . . . . . . . . . . 34 2.3.1 Member subsystem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.3.2 Catalog subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 2.3.3 Trading subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
© Copyright IBM Corp. 2003. All rights reserved.
iii
2.3.4 Order subsystem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.3.5 Merchandising subsystem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.3.6 Marketing subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.3.7 Inventory subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.3.8 Messaging subsystem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.4 Runtime topology selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 2.4.1 Runtime topology selection criteria . . . . . . . . . . . . . . . . . . . . . . . . . . 41 2.4.2 WebSphere Commerce runtime topologies . . . . . . . . . . . . . . . . . . . 47 2.4.3 Topology mapping to implementation details . . . . . . . . . . . . . . . . . . 57 2.5 For more information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Chapter 3. Business and store models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3.1 Business and store models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.1.1 Direct sales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.1.2 Hosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 3.1.3 Value chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 3.2 Business model infrastructure and architecture . . . . . . . . . . . . . . . . . . . . 69 3.2.1 Organization structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.2.2 Access control model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.2.3 Business policy framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 3.3 Store architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.3.1 Store assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.3.2 Store architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 3.3.3 Store packaging and models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 3.3.4 Store data assets and architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 86 3.3.5 Catalog data assets and concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 91 3.3.6 Tools and store data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 3.3.7 Customize a store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 3.3.8 Publish a store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 3.4 For more information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Chapter 4. Programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 4.2 WebSphere Commerce Server framework . . . . . . . . . . . . . . . . . . . . . . . 112 4.2.1 Servlet engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.2.2 Protocol Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.2.3 Adapter manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 4.2.4 Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 4.2.5 Web controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 4.2.6 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 4.2.7 Entity beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 4.2.8 Data beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 4.2.9 Data Bean Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
iv
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
4.2.10 JavaServer Page (JSP) templates . . . . . . . . . . . . . . . . . . . . . . . . 119 4.2.11 WebSphere Commerce .xml configuration file . . . . . . 119 4.3 Application flow of an HTTP request . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 4.4 Design patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 4.4.1 Model-view-controller design pattern . . . . . . . . . . . . . . . . . . . . . . . 122 4.4.2 Command design pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 4.4.3 Display design pattern. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 4.5 Persistent object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 4.6 Access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 4.7 Customizing application assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 4.7.1 Asset types to customize and development tooling . . . . . . . . . . . . 128 4.7.2 Matching skills to customization needs . . . . . . . . . . . . . . . . . . . . . . 130 4.8 For more information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Chapter 5. Site and store administration . . . . . . . . . . . . . . . . . . . . . . . . . 133 5.1 Administration tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.1.1 WebSphere Commerce Configuration Manager . . . . . . . . . . . . . . . 134 5.1.2 WebSphere Commerce Administration Console. . . . . . . . . . . . . . . 139 5.1.3 WebSphere Commerce Accelerator . . . . . . . . . . . . . . . . . . . . . . . . 142 5.1.4 WebSphere Commerce Organization Administration Console . . . . 145 5.1.5 WebSphere Commerce Loader Package . . . . . . . . . . . . . . . . . . . . 147 5.1.6 WebSphere Commerce Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . 148 5.1.7 WebSphere Commerce Payments Console . . . . . . . . . . . . . . . . . . 149 5.1.8 WebSphere Application Server Administration Console . . . . . . . . . 150 5.1.9 DB2 Control Center. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 5.2 Key operational categories to manage . . . . . . . . . . . . . . . . . . . . . . . . . . 152 5.3 IT specialist roles and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 5.3.1 System administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 5.3.2 Site administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 5.3.3 Store administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 5.3.4 Database administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 5.4 Line-of-business user roles and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 5.4.1 Business relationship roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 5.4.2 Customer service roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 5.4.3 Marketing manager role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 5.4.4 Operational roles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 5.4.5 Organizational management roles . . . . . . . . . . . . . . . . . . . . . . . . . 168 5.4.6 Product management and merchandising roles . . . . . . . . . . . . . . . 169 5.5 For more information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Part 2. Development guidelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Chapter 6. WebSphere Commerce site development methodology. . . . 173 6.1 Systematic development methodology . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Contents
v
6.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 6.2.1 Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 6.2.2 Work products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.2.3 Deliverable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.2.4 Customer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.2.5 Customer IT team . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.2.6 Project team . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6.2.7 Project database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 6.2.8 Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 6.2.9 Strategy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 6.3 Development methodology: phase and life cycle . . . . . . . . . . . . . . . . . . 178 6.3.1 Core development phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 6.4 Using the methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 6.4.1 Customizing and adopting the methodology . . . . . . . . . . . . . . . . . . 182 6.4.2 New and transition sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 6.4.3 Project roles and skills requirements . . . . . . . . . . . . . . . . . . . . . . . 183 6.4.4 Structuring information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 6.4.5 Case studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 6.5 Related methodology concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 6.5.1 IBM Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 6.5.2 Rational Unified Process® (RUP®). . . . . . . . . . . . . . . . . . . . . . . . . 185 6.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Chapter 7. Development environment and build cycle . . . . . . . . . . . . . . 187 7.1 WebSphere Commerce Studio overview . . . . . . . . . . . . . . . . . . . . . . . . 188 7.1.1 WebSphere Commerce Studio workspace . . . . . . . . . . . . . . . . . . . 188 7.1.2 WebSphere Commerce Studio plug-ins . . . . . . . . . . . . . . . . . . . . . 198 7.1.3 Custom code packaging and incremental deployment . . . . . . . . . . 201 7.2 Team development environment overview . . . . . . . . . . . . . . . . . . . . . . . 202 7.2.1 Optimistic team model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 7.2.2 Ideal work flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 7.2.3 Source control management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 7.2.4 Defect tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 7.3 Build environment overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 7.3.1 Benefits of daily build and smoke tests . . . . . . . . . . . . . . . . . . . . . . 209 7.3.2 Concepts of daily build and smoke tests. . . . . . . . . . . . . . . . . . . . . 210 7.3.3 Build automation for daily builds and smoke tests . . . . . . . . . . . . . 212 7.4 Deployment overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 7.4.1 Development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 7.4.2 Test environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 7.4.3 Staging environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 7.4.4 Production environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 7.4.5 Practice deployment and create backup plan . . . . . . . . . . . . . . . . . 215
vi
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
7.4.6 Production debug vs development debugging . . . . . . . . . . . . . . . . 215 Chapter 8. Globalization guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 8.1 Introduction to globalization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 8.2 Globalization in WebSphere Commerce . . . . . . . . . . . . . . . . . . . . . . . . . 221 8.3 Cultural considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 8.3.1 Date and time formatting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 8.3.2 Currency and number formatting . . . . . . . . . . . . . . . . . . . . . . . . . . 229 8.3.3 Name and address formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 8.4 WebSphere Commerce application model . . . . . . . . . . . . . . . . . . . . . . . 237 8.4.1 Language table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 8.4.2 Introduction to encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 8.4.3 Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 8.4.4 WebSphere Commerce data model: input . . . . . . . . . . . . . . . . . . . 247 8.4.5 WebSphere Commerce data model: output . . . . . . . . . . . . . . . . . . 250 8.5 Globalized catalog content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 8.6 Globalized store design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 8.6.1 Globalized page framework: one template for stores/languages . . 253 8.6.2 Support for bi-directional languages . . . . . . . . . . . . . . . . . . . . . . . . 259 8.6.3 Understanding the localized store assets . . . . . . . . . . . . . . . . . . . . 263 8.6.4 Creating a new display format for WebSphere Commerce . . . . . . . 268 8.6.5 Adding a new currency to WebSphere Commerce . . . . . . . . . . . . . 270 8.6.6 How to add/delete a language/currency for a store archive . . . . . . 271 8.7 Globalized tools framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 8.8 Globalization in the messaging system . . . . . . . . . . . . . . . . . . . . . . . . . . 279 8.9 Globalization tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 8.9.1 Handling apostrophes and special characters . . . . . . . . . . . . . . . . 283 8.9.2 Using locale-dependent Cascading Style Sheets (CSS) . . . . . . . . 285 8.9.3 National language-enabled alert/confirm/prompt boxes . . . . . . . . . 285 8.9.4 Input field validation: UTF-8 Input validation . . . . . . . . . . . . . . . . . . 286 8.9.5 Submit NL command parameters using hidden forms . . . . . . . . . . 287 Part 3. ITSO B2B working example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Chapter 9. Requirements analysis and solution design . . . . . . . . . . . . . 291 9.1 Business scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 9.2 Requirements analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 9.2.1 ITSO challenges and requirements. . . . . . . . . . . . . . . . . . . . . . . . . 296 9.2.2 Initial context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 9.2.3 System context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 9.2.4 Use case model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 9.3 Solution design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 9.3.1 Systems architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 9.3.2 Component model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Contents
vii
9.3.3 ITSO store navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 9.3.4 ITSO store catalog hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 9.3.5 ITSO store organizational hierarchy . . . . . . . . . . . . . . . . . . . . . . . . 317 Chapter 10. ITSO sample code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 10.1 Description of sample code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 10.2 Prepare DeployTool files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 10.2.1 Copy WebSphere Commerce files . . . . . . . . . . . . . . . . . . . . . . . . 321 10.2.2 Copy WebSphere Application Server files . . . . . . . . . . . . . . . . . . 322 10.2.3 Copy WebSphere Commerce Studio files. . . . . . . . . . . . . . . . . . . 322 Chapter 11. Implement a team development environment . . . . . . . . . . . 323 11.1 Team development environment scenario . . . . . . . . . . . . . . . . . . . . . . 324 11.2 Build and SCM node implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 328 11.2.1 CVS overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 11.2.2 CVSNT Server implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 11.2.3 WebSphere Commerce Studio installation . . . . . . . . . . . . . . . . . . 336 11.2.4 Publish store archive within WebSphere Test Environment . . . . . 336 11.2.5 CVS client configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 11.3 Development node implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 11.3.1 WebSphere Commerce Studio installation . . . . . . . . . . . . . . . . . . 338 11.3.2 CVS client configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 11.4 Development Integration Test node implementation. . . . . . . . . . . . . . . 338 Chapter 12. Create a store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 12.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 12.2 Package and verify store archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 12.2.1 Back up workspace and databases . . . . . . . . . . . . . . . . . . . . . . . 344 12.2.2 Create the Packaging project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 12.2.3 Package a store archive (SAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 12.2.4 Publish the store archive (SAR) . . . . . . . . . . . . . . . . . . . . . . . . . . 350 12.2.5 Verify the store after publish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 12.3 Import store assets into CVS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 12.3.1 Create a CVS module from the project . . . . . . . . . . . . . . . . . . . . . 351 12.3.2 Add the files to CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 12.4 Required customization of basic store assets . . . . . . . . . . . . . . . . . . . . 354 12.4.1 Store directory and identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 12.4.2 Hardcoded references. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 12.4.3 Store address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 12.4.4 Catalog data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 12.4.5 Store front-end assets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 12.5 Further customization of basic store assets . . . . . . . . . . . . . . . . . . . . . 367 12.5.1 Default and supported currencies . . . . . . . . . . . . . . . . . . . . . . . . . 367 12.5.2 Default and supported locales. . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
viii
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
12.5.3 Organizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 12.5.4 Business accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 12.5.5 Contracts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 12.5.6 Taxes, shipping couriers and shipping prices . . . . . . . . . . . . . . . . 384 12.5.7 Payment information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 12.6 Publish the store archive to the workspace. . . . . . . . . . . . . . . . . . . . . . 384 12.6.1 Package the customized store archive . . . . . . . . . . . . . . . . . . . . . 385 12.6.2 Publish the customized store archive to runtime. . . . . . . . . . . . . . 385 12.6.3 Verify the customized store archive . . . . . . . . . . . . . . . . . . . . . . . 385 12.6.4 Publish the store archive to the workspace. . . . . . . . . . . . . . . . . . 385 12.6.5 Verify customized store in the WebSphere Test Environment . . . 387 12.7 Add the store front files to CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 12.8 Set up additional team development nodes . . . . . . . . . . . . . . . . . . . . . 388 12.8.1 Turn off directory pruning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 12.8.2 Checking out the projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 12.8.3 Package and publish data-only store archive . . . . . . . . . . . . . . . . 392 Chapter 13. Customize a store: Price Watch example . . . . . . . . . . . . . . . 393 13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 13.2 Solution design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 13.2.1 Use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 13.2.2 Solution overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 13.2.3 Solution limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 13.2.4 Data storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 13.2.5 Data access (entity bean) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 13.2.6 Controller commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 13.2.7 Task commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 13.2.8 Passing data to the JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 13.2.9 Price watch list page JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 13.2.10 E-mail template JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 13.2.11 Access control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 13.3 Price Watch example pre-conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . 402 13.4 Configuring the e-mail transport and SMTP server . . . . . . . . . . . . . . . . 403 13.4.1 Setting up the James SMTP server . . . . . . . . . . . . . . . . . . . . . . . 403 13.4.2 Adding the new message type to the database . . . . . . . . . . . . . . 403 13.4.3 Configuring the e-mail transport . . . . . . . . . . . . . . . . . . . . . . . . . . 405 13.4.4 Configuring the e-mail message type . . . . . . . . . . . . . . . . . . . . . . 405 13.5 Creating the new database table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 13.6 Creating the new data access beans . . . . . . . . . . . . . . . . . . . . . . . . . . 408 13.6.1 Create the entity bean. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 13.6.2 Create the EJB/RDB mapping for the entity bean. . . . . . . . . . . . . 425 13.6.3 Create an access bean for the entity bean . . . . . . . . . . . . . . . . . . 428 13.6.4 Generate the deploy code and test the bean . . . . . . . . . . . . . . . . 429
Contents
ix
13.6.5 Update the bean with new FinderHelpers . . . . . . . . . . . . . . . . . . . 434 13.7 Creating the new commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 13.7.1 Create the command interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 13.7.2 Create the command implementation class . . . . . . . . . . . . . . . . . 439 13.7.3 Add the task commands to the workspace . . . . . . . . . . . . . . . . . . 449 13.7.4 Register the new command in the command registry . . . . . . . . . . 449 13.7.5 Create the PriceWatchListDisplayCmd command . . . . . . . . . . . . 450 13.7.6 Create the task commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 13.7.7 Create access control policies for the commands. . . . . . . . . . . . . 461 13.7.8 Enable component tracing in development environment . . . . . . . 463 13.8 Creating the new data bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 13.8.1 Data bean types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 13.8.2 Further considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 13.8.3 Creating the price watch data bean . . . . . . . . . . . . . . . . . . . . . . . 467 13.9 Creating the new JavaServer Pages. . . . . . . . . . . . . . . . . . . . . . . . . . . 470 13.9.1 Globalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 13.9.2 Creating the JSP file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 13.9.3 Registering a new view for the price watch list page . . . . . . . . . . 480 13.9.4 Using an external editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 13.9.5 Changes to the item display page . . . . . . . . . . . . . . . . . . . . . . . . . 481 13.9.6 Changes to the site header page . . . . . . . . . . . . . . . . . . . . . . . . . 482 13.10 Creating the batch e-mail command . . . . . . . . . . . . . . . . . . . . . . . . . . 482 13.10.1 Create the command interface . . . . . . . . . . . . . . . . . . . . . . . . . . 483 13.10.2 Create the command implementation class . . . . . . . . . . . . . . . . 483 13.10.3 Import the data bean for the e-mail command . . . . . . . . . . . . . . 489 13.10.4 Register the new command in the command registry . . . . . . . . . 490 13.11 Importing the e-mail template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 13.11.1 Adding the JSP to your workspace . . . . . . . . . . . . . . . . . . . . . . . 491 13.11.2 JSP content. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 13.11.3 Registering a new view for the e-mail template . . . . . . . . . . . . . 493 13.12 Configuring the scheduler to run the batch job . . . . . . . . . . . . . . . . . . 493 13.12.1 Make the command schedulable . . . . . . . . . . . . . . . . . . . . . . . . 494 13.12.2 Configure the scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 13.13 Testing the Price Watch example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 13.13.1 Testing the new functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 Chapter 14. Build and deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 14.1 Build and deployment overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 14.2 Build procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 14.2.1 Check out source from CVS to Build and SCM node . . . . . . . . . . 508 14.2.2 Modify store archive build script and unpack descriptor . . . . . . . . 508 14.2.3 Modify database SQL scripts and XML files . . . . . . . . . . . . . . . . . 510 14.2.4 Build application assets archive (JAR) . . . . . . . . . . . . . . . . . . . . . 514
x
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
14.2.5 Build store archive (SAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 14.2.6 Build verification test (BVT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 14.2.7 Source configuration management (SCM) of build files . . . . . . . . 517 14.3 Deployment procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 14.3.1 Publish the store archive (SAR) . . . . . . . . . . . . . . . . . . . . . . . . . . 520 14.3.2 Deploy application assets archive (JAR). . . . . . . . . . . . . . . . . . . . 522 14.3.3 Load access control policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 14.3.4 Configure e-mail for Price Watch . . . . . . . . . . . . . . . . . . . . . . . . . 525 14.3.5 Verify the runtime and store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 Chapter 15. Manage the ITSO store. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 15.1 Product management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 15.1.1 Add a category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 15.1.2 Add a product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 15.2 Create organizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 15.2.1 Organizations in ITSO store archive . . . . . . . . . . . . . . . . . . . . . . . 533 15.2.2 Create seller organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 15.2.3 Create a buyer organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 15.3 Create a business account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 15.3.1 Business accounts in ITSO store archive . . . . . . . . . . . . . . . . . . . 542 15.3.2 Create a business account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 15.4 Create a contract. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544 15.4.1 Contracts in ITSO store archive . . . . . . . . . . . . . . . . . . . . . . . . . . 544 15.4.2 Create contract using the Accelerator . . . . . . . . . . . . . . . . . . . . . . 545 15.4.3 Activate contract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 15.4.4 Verify the contract is enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 Part 4. Runtime deployment scenarios. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 Chapter 16. Windows: Migrate a single-tier to a multi-tier . . . . . . . . . . . 553 16.1 Scenario overview and planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 16.1.1 Common reasons for migrating to multi-tiers . . . . . . . . . . . . . . . . 554 16.1.2 Migration scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 16.1.3 Hardware and software perquisites. . . . . . . . . . . . . . . . . . . . . . . . 557 16.1.4 Hardware used in the ITSO runtime environment . . . . . . . . . . . . . 557 16.1.5 Software used in the ITSO runtime environment . . . . . . . . . . . . . 558 16.2 Single-tier implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 16.2.1 Windows installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 16.2.2 WebSphere Commerce V5.5 installation . . . . . . . . . . . . . . . . . . . 561 16.2.3 DB2 UDB V8.1 Fix Pack 3 installation . . . . . . . . . . . . . . . . . . . . . 562 16.2.4 WebSphere Application Server V5 Fix Pack 1 installation . . . . . . 563 16.2.5 WebSphere Commerce V5.5.0.2 Fix Pack 2 installation . . . . . . . 569 16.2.6 WebSphere Commerce instance creation . . . . . . . . . . . . . . . . . . 571 16.2.7 WebSphere Commerce Payments instance creation . . . . . . . . . . 573
Contents
xi
16.2.8 Database backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 16.2.9 Start servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 16.2.10 Verify the runtime environment and store functionality . . . . . . . . 577 16.3 Add a remote Database Server node . . . . . . . . . . . . . . . . . . . . . . . . . . 582 16.3.1 Windows 2000 installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 16.3.2 Install DB2 V8.1 Enterprise Edition Server . . . . . . . . . . . . . . . . . . 582 16.3.3 DB2 UDB V8.1 Fix Pack 3 installation . . . . . . . . . . . . . . . . . . . . . 584 16.3.4 Backup and restore of databases . . . . . . . . . . . . . . . . . . . . . . . . . 584 16.3.5 Configure DB2 connectivity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 16.3.6 Verify the remote DB2 Server node configuration. . . . . . . . . . . . . 587 16.4 Add remote Web Server node. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 16.4.1 Review preconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 16.4.2 Install IBM HTTP Server and WebSphere plug-in. . . . . . . . . . . . . 588 16.4.3 WebSphere Application Server V5 Fix Pack 1 installation . . . . . . 589 16.4.4 Configure IBM HTTP Server for SSL . . . . . . . . . . . . . . . . . . . . . . 590 16.4.5 Verify IBM HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 16.4.6 IBM HTTP Administration (optional) . . . . . . . . . . . . . . . . . . . . . . . 594 16.4.7 Modify Web Server host name . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 16.4.8 Configure the Web server static content . . . . . . . . . . . . . . . . . . . . 597 16.4.9 Verify the remote Web Server configuration . . . . . . . . . . . . . . . . . 598 Chapter 17. Solaris: Three-tier environment using Oracle9i and Sun ONE Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 17.1 Scenario overview and planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 17.1.1 Scenario overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 17.1.2 Hardware and software prerequisites . . . . . . . . . . . . . . . . . . . . . . 601 17.1.3 Software used within the ITSO test environment . . . . . . . . . . . . . 602 17.1.4 Software installation paths and variables . . . . . . . . . . . . . . . . . . . 603 17.1.5 Hardware used within the ITSO test environment. . . . . . . . . . . . . 603 17.1.6 File system planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 17.2 Solaris installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 17.2.1 Network information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 17.2.2 Installing Solaris 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 17.2.3 Installing Solaris 8 maintenance update . . . . . . . . . . . . . . . . . . . . 607 17.2.4 Installing Solaris 8 recommended patches . . . . . . . . . . . . . . . . . . 608 17.3 Web Server node implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 17.3.1 Pre-installation tasks for the iPlanet Web Server . . . . . . . . . . . . . 611 17.3.2 Installing the iPlanet Web Server . . . . . . . . . . . . . . . . . . . . . . . . . 612 17.3.3 Enabling SSL for the iPlanet Web Server . . . . . . . . . . . . . . . . . . . 615 17.3.4 Disabling the iPlanet servlet engine . . . . . . . . . . . . . . . . . . . . . . . 620 17.3.5 Verifying the Sun ONE Web Server installation . . . . . . . . . . . . . . 620 17.3.6 Installing the WebSphere plug-in . . . . . . . . . . . . . . . . . . . . . . . . . 621 17.3.7 Verifying the WebSphere plug-in . . . . . . . . . . . . . . . . . . . . . . . . . 622
xii
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
17.4 Database Server node implementation . . . . . . . . . . . . . . . . . . . . . . . . . 623 17.4.1 Oracle9i installation prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . 623 17.4.2 Installing Oracle9i Enterprise Edition (server installation) . . . . . . . 629 17.4.3 Preparing the database for WebSphere Commerce . . . . . . . . . . . 634 17.5 WebSphere Commerce node implementation . . . . . . . . . . . . . . . . . . . 639 17.5.1 Oracle9i client installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640 17.5.2 WebSphere Commerce installation. . . . . . . . . . . . . . . . . . . . . . . . 645 17.5.3 Create users and groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646 17.5.4 Installing the remaining WebSphere Commerce components . . . 647 17.5.5 WebSphere Commerce instance creation . . . . . . . . . . . . . . . . . . 650 17.5.6 WebSphere Commerce post-instance config . . . . . . . . . . . . . . . . 659 17.5.7 Creating a WebSphere Commerce Payment instance . . . . . . . . . 660 17.5.8 WebSphere Commerce payment post-instance config . . . . . . . . . 664 17.5.9 Start/stop the WebSphere Commerce instance . . . . . . . . . . . . . . 665 17.5.10 Regenerating Web server plug-in configurations . . . . . . . . . . . . 666 17.5.11 iPlanet Web Server configuration for WebSphere Commerce . . 667 17.6 Verify the runtime environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 17.6.1 Publish a store archive (SAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 17.6.2 Configure Web server for static content . . . . . . . . . . . . . . . . . . . . 670 17.6.3 Compile the WebSphere Commerce store JSPs . . . . . . . . . . . . . 671 17.6.4 Launch store from Site Administration Console . . . . . . . . . . . . . . 671 17.6.5 Verify the sample store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 Chapter 18. AIX: Three-tier using DB2 and IBM HTTP Server. . . . . . . . . 675 18.1 Scenario overview and planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 18.1.1 Scenario overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 18.1.2 Hardware and software prerequisites . . . . . . . . . . . . . . . . . . . . . . 677 18.1.3 Hardware used in the ITSO runtime environment . . . . . . . . . . . . . 677 18.1.4 Software used in the ITSO runtime environment . . . . . . . . . . . . . 678 18.1.5 Software installation paths and variables . . . . . . . . . . . . . . . . . . . 679 18.1.6 Installation approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 18.2 AIX installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 18.2.1 Network planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 18.2.2 AIX installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 18.2.3 File system planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 18.2.4 Netscape 7 Web browser (optional) . . . . . . . . . . . . . . . . . . . . . . . 682 18.2.5 AIX software prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 18.2.6 Disable wsmserver on port 9090. . . . . . . . . . . . . . . . . . . . . . . . . . 684 18.3 Web Server node implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685 18.3.1 AIX installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685 18.3.2 Installing IBM HTTP Server and WebSphere plug-in . . . . . . . . . . 686 18.3.3 Configure the IBM HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . 687 18.3.4 Install WebSphere Application Server V5 fixes . . . . . . . . . . . . . . . 691
Contents
xiii
18.4 DB2 Server node implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 18.4.1 AIX installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 18.4.2 Install DB2 UDB V8.1 Enterprise Server Edition . . . . . . . . . . . . . . 692 18.4.3 Install DB2 UDB V8.1 Fix Pack 1 . . . . . . . . . . . . . . . . . . . . . . . . . 695 18.4.4 Create a file system for DB2 databases (optional) . . . . . . . . . . . . 696 18.5 WebSphere Commerce Payments node implementation . . . . . . . . . . . 698 18.5.1 AIX installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 18.5.2 Install DB2 UDB V8.1 Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 18.5.3 Configure and verify the DB2 client and server. . . . . . . . . . . . . . . 701 18.5.4 Create the non-root user(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 18.5.5 Install WebSphere Commerce Payments software. . . . . . . . . . . . 704 18.5.6 Verify the WebSphere Commerce Payments installation . . . . . . . 710 18.5.7 Install WebSphere Application Server V5 fixes . . . . . . . . . . . . . . . 710 18.5.8 Verify the WebSphere Application Server . . . . . . . . . . . . . . . . . . . 713 18.5.9 Modify the owner and file permissions of the httpd.conf . . . . . . . . 715 18.5.10 Create the WebSphere Commerce Payments instance . . . . . . . 716 18.5.11 Configure the IBM HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . 719 18.5.12 Verify WebSphere Commerce Payments instance . . . . . . . . . . . 721 18.6 WebSphere Commerce node implementation . . . . . . . . . . . . . . . . . . . 723 18.6.1 AIX installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 18.6.2 Install DB2 UDB V8.1 Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 18.6.3 Configure and verify DB2 client and server. . . . . . . . . . . . . . . . . . 725 18.6.4 Create the non-root user(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 18.6.5 Install WebSphere Commerce and supporting software . . . . . . . . 726 18.6.6 Verify the WebSphere Commerce installation . . . . . . . . . . . . . . . 731 18.6.7 Install WebSphere Application Server V5 fixes . . . . . . . . . . . . . . . 731 18.6.8 Verify the WebSphere Administration Console . . . . . . . . . . . . . . . 731 18.6.9 Configure Web server WebSphere plug-in (optional) . . . . . . . . . . 731 18.6.10 WebSphere Commerce instance creation . . . . . . . . . . . . . . . . . 733 18.6.11 Verify the WebSphere Commerce instance creation . . . . . . . . . 738 18.6.12 Configure the remote Web server for WebSphere Commerce . . 741 18.6.13 Compile WebSphere Commerce tools JSPs . . . . . . . . . . . . . . . 743 18.6.14 Verify the WebSphere Commerce administration tools . . . . . . . 744 18.6.15 Configure and verify WebSphere Commerce Payments . . . . . . 746 18.7 Verify the runtime environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747 18.7.1 Back up the databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 18.7.2 Publish a sample store archive (SAR) . . . . . . . . . . . . . . . . . . . . . 749 18.7.3 Configure the Web server static content . . . . . . . . . . . . . . . . . . . . 750 18.7.4 Compiling WebSphere Commerce store JSPs (optional) . . . . . . . 751 18.7.5 Verify WebSphere Commerce administration tools . . . . . . . . . . . 751 18.7.6 Verify functionality of sample store . . . . . . . . . . . . . . . . . . . . . . . . 751 18.7.7 Restore databases (optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 18.7.8 Remove the published sample store (optional) . . . . . . . . . . . . . . . 752
xiv
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
18.8 Additional configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 Chapter 19. OS/400: Two-tier remote database server . . . . . . . . . . . . . . 755 19.1 Scenario overview and planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756 19.1.1 Skill requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756 19.1.2 Hardware and software requirements . . . . . . . . . . . . . . . . . . . . . . 756 19.1.3 Hardware used in the ITSO runtime environment . . . . . . . . . . . . . 756 19.1.4 Software used in the ITSO runtime environment . . . . . . . . . . . . . 757 19.1.5 Software installation paths and root directories . . . . . . . . . . . . . . 758 19.2 Pre-installation steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758 19.2.1 Verify user profiles required during the installation . . . . . . . . . . . . 759 19.2.2 Create a remote database entry . . . . . . . . . . . . . . . . . . . . . . . . . . 759 19.2.3 Create an instance user profile . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 19.3 WebSphere Commerce installation process . . . . . . . . . . . . . . . . . . . . . 760 19.3.1 Custom installation process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760 19.3.2 Verify a custom installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761 19.3.3 WebSphere Application Server installation log . . . . . . . . . . . . . . . 762 19.3.4 WebSphere Commerce installation log . . . . . . . . . . . . . . . . . . . . . 763 19.4 PTF installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763 19.5 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765 19.5.1 Considerations before creating the instance . . . . . . . . . . . . . . . . . 765 19.5.2 Updating SQL packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766 19.5.3 Installing the Configuration Manager client . . . . . . . . . . . . . . . . . . 768 19.5.4 Starting the Configuration Manager . . . . . . . . . . . . . . . . . . . . . . . 769 19.6 Instance creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771 19.6.1 Instance creation requirements when using a remote database. . 771 19.6.2 Create a WebSphere Commerce instance . . . . . . . . . . . . . . . . . . 772 19.6.3 Verifying the instance creation . . . . . . . . . . . . . . . . . . . . . . . . . . . 773 19.6.4 Completing the configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775 19.6.5 Create a WebSphere Commerce Payments instance . . . . . . . . . 775 19.6.6 Completing the configuration for the Payments instance . . . . . . . 776 19.6.7 Verifying the instance creation . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 19.7 Enabling SSL for IBM HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 19.8 Start the application servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 19.8.1 Start the WebSphere Commerce Payment instance . . . . . . . . . . 778 19.8.2 Stop the WebSphere Commerce Payments instance . . . . . . . . . . 779 19.8.3 Start the WebSphere Commerce instance . . . . . . . . . . . . . . . . . . 779 19.8.4 Stop the WebSphere Commerce instance . . . . . . . . . . . . . . . . . . 779 19.9 Publish a store. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780 19.9.1 Pre-compile the JSPs files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 19.10 Back up WebSphere Commerce and components . . . . . . . . . . . . . . . 781 19.11 Uninstall WebSphere Commerce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 19.11.1 Uninstall WebSphere Commerce . . . . . . . . . . . . . . . . . . . . . . . . 783
Contents
xv
19.11.2 Uninstalling Configuration Manager client. . . . . . . . . . . . . . . . . . 784 19.11.3 Uninstalling WebSphere Application Server . . . . . . . . . . . . . . . . 784 Part 5. Integration and customization scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 Chapter 20. Commerce analytics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787 20.1 Commerce analytics overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 20.1.1 Business drivers for commerce analytics . . . . . . . . . . . . . . . . . . . 788 20.1.2 WebSphere Commerce analytical features. . . . . . . . . . . . . . . . . . 789 20.1.3 Reports overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792 20.1.4 Analytics to action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 20.1.5 WebSphere Commerce Analyzer architecture . . . . . . . . . . . . . . . 798 20.1.6 Where to find more information. . . . . . . . . . . . . . . . . . . . . . . . . . . 800 20.2 WebSphere Commerce Analyzer integration . . . . . . . . . . . . . . . . . . . . 801 20.2.1 WebSphere Commerce Analyzer integration scenario overview . 802 20.2.2 WebSphere Commerce node configuration . . . . . . . . . . . . . . . . . 804 20.2.3 WebSphere Commerce Analyzer node installation. . . . . . . . . . . . 809 20.2.4 WebSphere Commerce Analyzer pre-configuration . . . . . . . . . . . 817 20.2.5 WebSphere Commerce Analyzer database configuration . . . . . . 819 20.2.6 Prepare promote steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 20.2.7 WebSphere Commerce Analyzer business options configuration 852 20.2.8 Post-configuration steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859 20.2.9 Accessing out-of-box Accelerator reports . . . . . . . . . . . . . . . . . . . 864 20.2.10 Change passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867 20.3 Create customized reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 868 20.3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 868 20.3.2 Before customizing a new report. . . . . . . . . . . . . . . . . . . . . . . . . . 869 20.3.3 Creating input and output JSP files . . . . . . . . . . . . . . . . . . . . . . . . 871 20.3.4 Defining the report with XML files . . . . . . . . . . . . . . . . . . . . . . . . . 873 20.3.5 Add the XML files to the resources.xml file . . . . . . . . . . . . . . . . . . 875 20.3.6 Add the customized report to a page in Accelerator . . . . . . . . . . . 876 20.3.7 Modifying the .properties files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877 20.3.8 Adding view commands to the database . . . . . . . . . . . . . . . . . . . 879 20.3.9 Modify SQL and test the customized report . . . . . . . . . . . . . . . . . 880 20.3.10 Adding access control to the customized report . . . . . . . . . . . . . 882 Chapter 21. Messaging integration with MQ and e-mail . . . . . . . . . . . . . 883 21.1 Messaging architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884 21.1.1 Leveraging WebSphere Application Server messaging . . . . . . . . 885 21.1.2 Inbound messaging system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889 21.1.3 Outbound messaging system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900 21.1.4 Predefined inbound and outbound messages. . . . . . . . . . . . . . . . 906 21.2 WebSphere MQ installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911 21.2.1 WebSphere MQ installation scenarios . . . . . . . . . . . . . . . . . . . . . 912
xvi
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
21.2.2 WebSphere MQ installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 914 21.2.3 WebSphere MQ verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915 21.2.4 WebSphere MQ CSD installation . . . . . . . . . . . . . . . . . . . . . . . . . 916 21.3 WebSphere MQ configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 21.3.1 Create the MQ queue manager . . . . . . . . . . . . . . . . . . . . . . . . . . 916 21.3.2 Create MQ queues for WebSphere Commerce . . . . . . . . . . . . . . 919 21.4 WebSphere JCA-JMS configuration for MQ . . . . . . . . . . . . . . . . . . . . . 920 21.4.1 Add Windows user ID to mqm group . . . . . . . . . . . . . . . . . . . . . . 921 21.4.2 Configure JCA-JMS: WebSphere Application Server . . . . . . . . . . 921 21.4.3 Verify MQ_INSTALL_Root environment variable . . . . . . . . . . . . . 927 21.4.4 Enable tracing for message components . . . . . . . . . . . . . . . . . . . 927 21.4.5 Verify the WebSphere MQ configuration. . . . . . . . . . . . . . . . . . . . 928 21.4.6 Configure JCA-JMS: WebSphere Studio Application Developer . 929 21.5 WebSphere Commerce configuration for MQ . . . . . . . . . . . . . . . . . . . . 932 21.5.1 WebSphere Commerce configuration for MQ . . . . . . . . . . . . . . . . 933 21.5.2 WebSphere Commerce Studio configuration for MQ . . . . . . . . . . 935 21.6 Scenario: add new inbound message for MQ . . . . . . . . . . . . . . . . . . . . 936 21.6.1 Solution prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937 21.6.2 Prepare UserRegistrationAdd controller command. . . . . . . . . . . . 938 21.6.3 Update the template map file user_template.xml . . . . . . . . . . . . . 938 21.6.4 Create a new DTD file for inbound XML message . . . . . . . . . . . . 942 21.6.5 Update .xml to include new DTD . . . . . . . . . . . . . . . . . 945 21.6.6 Create inbound XML message . . . . . . . . . . . . . . . . . . . . . . . . . . . 946 21.6.7 Verify new inbound XML message . . . . . . . . . . . . . . . . . . . . . . . . 948 21.7 Scenario: e-mail notification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 950 21.7.1 Java Apache Mail Enterprise Server (James) configuration . . . . . 950 21.7.2 Enable the e-mail transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954 21.7.3 Configure the e-mail transport. . . . . . . . . . . . . . . . . . . . . . . . . . . . 955 21.7.4 Configure the e-mail message type . . . . . . . . . . . . . . . . . . . . . . . 955 21.7.5 Verify e-mail notification for password reset . . . . . . . . . . . . . . . . . 957 Part 6. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959 Appendix A. AIX tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961 Common tasks and commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962 AIX performance monitoring tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965 Starting and stopping TCP/IP daemons . . . . . . . . . . . . . . . . . . . . . . . . . . 966 Shut down AIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966 List AIX file systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966 Directory list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966 Adding additional IP addresses to an interface. . . . . . . . . . . . . . . . . . . . . 967 Installing OpenSSH on AIX 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967 Appendix B. Solaris tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969
Contents
xvii
Solaris 8 installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 970 Solaris 8 pre-installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 970 Solaris 8 installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 971 Solaris 8 interactive installation and configuration . . . . . . . . . . . . . . . . . . 973 Installing software on Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974 Solaris 8 post-install configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 977 Solaris 8 maintenance update installation. . . . . . . . . . . . . . . . . . . . . . . . . 978 Solaris 8 recommended patches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 980 Common Solaris tasks and commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 982 Where to find information about Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 986 Appendix C. DB2 tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 987 DB2 backup and restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988 Back up a DB2 database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988 Back up DB2 database via Control Center . . . . . . . . . . . . . . . . . . . . . . . . 988 Restore a DB2 database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 DB2 tasks using smitty on AIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 Create a logical volume. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 Create an AIX journal file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991 Allocate storage for a file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 992 Create users and groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 992 DB2 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 Create a volume group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 Create a logical volume. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 Create a journal file system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 Allocate space to a file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 Mount a file system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 Create a database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994 List databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994 Drop a database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994 Catalog a TCP/IP node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994 Attach to a remote node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994 Catalog a remote database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995 Connect to a remote database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995 Disconnect from a remote database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995 Appendix D. Oracle tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997 Oracle9i commands and tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 Oracle9i server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 Oracle9i listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999 Oracle utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1000 Testing Oracle connectivity using JDBCTEST . . . . . . . . . . . . . . . . . . . . . . . 1001 Oracle backup and restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002
xviii
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Important Oracle files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002 Log files and trace files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002 Oracle configuration files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003 Verifying user creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003 Cleaning database after deleting an instance . . . . . . . . . . . . . . . . . . . . . . . 1004 Where to find more information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004 Appendix E. WebSphere Commerce Studio implementation . . . . . . . . 1005 WebSphere Commerce Studio installation. . . . . . . . . . . . . . . . . . . . . . . . . . 1006 Windows 2000 installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1007 Install WebSphere Commerce Studio V5.5. . . . . . . . . . . . . . . . . . . . . . . 1008 Install WebSphere Studio Application Developer V5.0.1 PTF . . . . . . . . 1010 Install WebSphere Test Environment V5.0.1 . . . . . . . . . . . . . . . . . . . . . 1012 Install WebSphere Studio Application Developer V5.0.1 Interim Fix 3 . . 1013 Install DB2 UDB V8.1 Fix Pack 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1014 Install WebSphere Commerce Studio Toolkit V5.5.0.2 Fix Pack . . . . . . 1016 WebSphere Commerce Studio configuration . . . . . . . . . . . . . . . . . . . . . . . . 1021 Required post-install configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1021 Optional post-install configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1025 Configure the default Web browser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027 Set default XML editor to optimize performance . . . . . . . . . . . . . . . . . . . 1027 WebSphere Commerce Studio verification . . . . . . . . . . . . . . . . . . . . . . . . . 1028 Start the WebSphere Commerce Payments Server . . . . . . . . . . . . . . . . 1028 Start the WebSphere Commerce Server . . . . . . . . . . . . . . . . . . . . . . . . 1028 Appendix F. Additional material. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029 Locating the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029 Using the Web material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1030 System requirements for downloading the Web material . . . . . . . . . . . . 1030 Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031 IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031 Other publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1032 Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033 How to get IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1035
Contents
xix
xx
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Notices This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing, IBM Corporation, North Castle Drive Armonk, NY 10504-1785 U.S.A. The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you. Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. COPYRIGHT LICENSE: This information contains sample application programs in source language, which illustrates programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. You may copy, modify, and distribute these sample programs in any form without payment to IBM for the purposes of developing, using, marketing, or distributing application programs conforming to IBM's application programming interfaces.
© Copyright IBM Corp. 2003. All rights reserved.
xxi
Trademarks The following terms are trademarks of the International Business Machines Corporation in the United States, other countries, or both: ™ ^™ ibm.com® iSeries™ pSeries™ xSeries® z/OS® zSeries® AIX 5L™ AIX® AS/400® ClearCase® Cloudscape™ Domino™ DB2 Extenders™
DB2 Universal Database™ DB2® Informix® Intelligent Miner™ IBM Payment Server™ IBM® Lotus Notes® Lotus® MQSeries® Net.Data® Notes® OS/400® PowerPC 604™ PowerPC® POWER3™
QuickPlace® Rational Unified Process® Rational® Redbooks™ Redbooks (logo) ™ RS/6000® RUP® S/390® Sametime® Tivoli® TCS® VisualAge® WebSphere® XDE™
The following terms are trademarks of other companies: Intel is a trademark of Intel Corporation in the United States, other countries, or both. Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. Other company, product, and service names may be trademarks or service marks of others.
xxii
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Preface This IBM® Redbook is a customization and deployment guide for IBM WebSphere Commerce V5.5. The redbook provides IT architects, IT specialists, and developers with the critical knowledge to design, develop, deploy and manage a WebSphere® Commerce runtime environment and store. Part 1, Introduction to WebSphere Commerce, provides an overview of the WebSphere Commerce runtime architecture, programming model, business and store models, and administration of a site and store. Part 2, Design and development guidelines, provides IT architects and developers with design and development guidelines for an e-commerce development methodology, development environment, build cycle, and globalization. Part 3, ITSO B2B working example, includes business requirements analysis and solution design, team development environment, store creation, store customization, build and deployment, and store administration. Part 4, Runtime deployment scenarios, provides IT specialists procedures for implementing advanced multi-tiered runtime scenarios on Windows, Solaris, AIX® and OS/400®. The scenarios highlight best practices and advanced multi-tier configurations such as remote Web server, database and payment nodes. Part 5, Integration deployment scenarios, provides IT architects, IT specialists and developers with the knowledge required to implement and customize integrated solutions including WebSphere Commerce Analyzer, MQ and e-mail. Part 6, Appendixes, includes tips on AIX, Solaris, DB2®, Oracle and WebSphere Commerce Studio implementation.
The team that wrote this redbook This redbook was produced by a team of specialists from around the world working at the International Technical Support Organization, Raleigh Center.
© Copyright IBM Corp. 2003. All rights reserved.
xxiii
The IBM Redbook team left to right (Hernan Cunico, Abhishek Singh, Nicolai Nielsen, Sean Zhu, Steve Insley, John Ganci, center - Ryan Karchner)
John Ganci is a Senior Software Engineer, WebSphere Specialist at the IBM ITSO, Raleigh Center. He writes extensively and teaches classes on WebSphere and related topics. John has 14 years of experience in product and application design, development, system testing, and consulting. His areas of expertise include e-commerce, WebSphere Application Server, pervasive computing, Linux and Java™ programming. Hernan Cunico is a Senior I/T Specialist at IBM Global Services in Argentina. He has nine years of experience in system administration and the e-business field. He has worked at IBM for five years. His areas of expertise include networking, Internet security, e-commerce, iSeries™ and cross-platform e-business and e-commerce solutions. He has participated in several residencies producing Redbooks related to WebSphere Commerce.
xxiv
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Daniel Dunn is a WebSphere Commerce Application Development Architect, an I/T Architect, in IBM Software Group, Canada. He has been in the field of software development for e-commerce applications since 1996. He holds a degree in Computer Science and Economics from the University of Toronto, Canada. His areas of expertise include WebSphere application architecture and development, WebSphere Studio team development environment, relational database design and management, multi-platform system integration, and software automation. Steve Insley is a Senior IT Consultant in the United Kingdom. He has six years of experience in the field of application development, system integration and consulting for e-commerce and e-business solutions. He holds a degree in Computer Science from the University of Warwick, England. His areas of expertise include application design, J2EE, WebSphere Application Server, and WebSphere Commerce. He has worked on several major WebSphere Commerce customer engagements in the UK. Steve has recently moved from IBM UK to work for etc (European Technology Consultants Ltd). Ryan Karchner is an undergraduate student at Penn State University. He is currently working toward a BS degree in Information Sciences and Technology and a minor in Business/Liberal Arts. His main area of interest is the integration of information technology with financial investment, business management, and business analytics. He joined the IBM International Technical Support Organization as a Co-op Pre-professional IT Specialist. Emad Muhanna is is the Globalization Architect responsible for the WebSphere Commerce products in IBM Software Group, Toronto Lab. He has five years of experience in the areas of software globalization and e-commerce solutions. He holds a degree in Computer Engineering from McGill University in Montreal, Canada. His areas of expertise include software globalization, Java internationalization and localization, automation of localization testing, J2EE technology, WebSphere Commerce, and WebSphere Application Server. He has presented at several conferences about software globalization development techniques, globalization verification testing, mock translation, and automation of localization and translation verification testing. Nicolai Nielsen is an I/T Specialist with IBM Global Services, Denmark. He has eight years of experience in the field of consulting, application development and systems integration. He holds a Masters degree in Engineering from the Technical University of Denmark. Over the last two years, he has worked on several WebSphere Commerce V5.1 and V5.4 projects. Abhishek Singh is an Advisory IT Specialist in IBM Global Services, Australia. He has five years of experience in the Telecommunications and Government sectors in the areas of e-business and e-commerce solutions, performing application architecture, designing, development, and systems integration. He
Preface
xxv
holds a Bachelor's degree in Computer Systems Engineering from the University of South Australia, and is now a PhD candidate in Computer Systems Engineering from the same university. His areas of expertise include systems integration, application architecture and development, technical team leadership, and in particular WebSphere Commerce, WebSphere Application Server, and WebSphere MQ products Sean Zhu is a Software Engineer in the IBM Software Group. He currently provides support for IBM WebSphere Commerce at the IBM Developer Relations Technical Support Center. He has five years of experience working on e-commerce projects utilizing object-oriented technologies and middleware tools. He is certified in WebSphere Commerce and DB2 and very familiar with e-business solutions design and development using products such as Rational® and WebSphere. He holds an MSc degree in Information Systems and an MBA from Arizona State University. Thanks to the following people for their contributions to this project: Zamil Janmohamed, IBM Canada Sanjoy Banik, Gen-i Limited in New Zealand Valerie Westcott, IBM Canada Keri-Anne Lounsbury, IBM Canada Erin Heximer, IBM Canada Eric Koeck, IBM Canada Kirsten Rutherford, IBM Canada Eric Poulin, IBM Canada Robert Werkama, IBM US Fen Wang, IBM Canada Khalyl Khan, IBM Canada Walfrey Ng, IBM Canada Erik Neathery, IBM Canada Gavin Singh, IBM Canada Ross McKegney, IBM Canada Patrick Yau, IBM Canada Abdul-Kader Farra, IBM Canada Norm Smith, IBM US Juha Nevalainen, IBM Finland Terry Hudson, IBM UK Adrian Warman, IBM UK Brian Lima, IBM Canada David Yuan, IBM Canada Sanjeev Sharma, IBM Canada Scott Ripley, IBM Canada Eugene Lam, IBM Canada Bill Holtshouser, IBM US
xxvi
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Mike Chang, IBM Canada Roke Jung, IBM Canada Jose Ortiz, IBM US Jacob Vandergoot, IBM Canada Kar-Ho Chan, IBM Canada Ibrahim Meru, IBM Canada Mikito Hirota, IBM Japan Donna Sutarno, IBM Canada Ronald van Loon, IBM Netherlands
Become a published author Join us for a two- to six-week residency program! Help write an IBM Redbook dealing with specific products or solutions, while getting hands-on experience with leading-edge technologies. You'll team with IBM technical professionals, Business Partners and/or customers. Your efforts will help increase product acceptance and customer satisfaction. As a bonus, you'll develop a network of contacts in IBM development labs, and increase your productivity and marketability. Find out more about the residency program, browse the residency index, and apply online at: ibm.com/redbooks/residencies.html
Comments welcome Your comments are important to us! We want our Redbooks™ to be as helpful as possible. Send us your comments about this or other Redbooks in one of the following ways: Use the online Contact us review redbook form found at: ibm.com/redbooks
Send your comments in an Internet note to: [email protected]
Mail your comments to: IBM Corporation, International Technical Support Organization Dept. HZ8 Building 662 P.O. Box 12195 Research Triangle Park, NC 27709-2195
Preface
xxvii
xxviii
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Part 1
Part
1
Introduction to WebSphere Commerce V5.5 This part of the redbook provides an overview of the product, describes the WebSphere Commerce runtime architecture, business and store models, programming model, and tools and tasks for managing a site and store.
© Copyright IBM Corp. 2003. All rights reserved.
1
2
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
1
Chapter 1.
Introduction Just for a moment, imagine that you have been asked to implement your company’s e-commerce Web site. You have two fundamental choices: build the commerce system from scratch or buy a pre-packaged e-commerce product. You can wake up now; your nightmare is over. Recognizing the e-commerce needs of small, medium, and large companies, IBM has developed several editions of IBM WebSphere Commerce V5.5, including Express Edition, Professional Edition, and Business Edition. Each of the product editions includes a secure and scalable runtime architecture, a flexible J2EE programming model, and sample stores to speed application development. This chapter includes the following topics:
Platform support and product packaging Features and benefits Target audience of this IBM Redbook For more information
© Copyright IBM Corp. 2003. All rights reserved.
3
1.1 Platform support and product packaging The IBM WebSphere Commerce product is packaged into separate integrated suites of software for runtime deployment (WebSphere Commerce) and development tooling (WebSphere Commerce Studio). IBM WebSphere Commerce V5.5 is available in three editions: Business, Professional and Express. The Business Edition includes all features of the Professional Edition and additional functionality specific to B2B, hosting and value chains involving multiple enterprises or parties. The runtime deployment packages are available on many operating systems, including Microsoft® Windows® 2000, IBM AIX, Sun Solaris, IBM OS/400, Linux on Intel® based systems, and Linux on IBM ^ iSeries, pSeries™, and zSeries®. While writing this redbook, we focused on the Business Edition, since it is a superset of the other editions. Note: The Express Edition was not available at the time of writing. Therefore, this redbook does not include information on this edition. The development tooling product packaging is available in three editions: Business Developer, Professional Developer and Express Developer. The development product editions are only available for Microsoft Windows 2000. While writing this redbook, we focused on the IBM WebSphere Commerce Studio V5.5, Business Developer Edition.
1.1.1 Supported platforms IBM WebSphere Commerce V5.5 is supported on the following platforms:
4
Microsoft Windows 2000 Server + Service Pack 3 or higher IBM AIX 5.1 + Maintenance Level 2 (ML) or higher Sun Solaris 8 + Maintenance Update 7 (MU) + Recommended 7 IBM OS/400 Version 5 Release 2 (V5R2M0) Linux: – Linux on Intel-based systems (x86) • Red Hat Enterprise Linux AS V2.1 • SuSE Linux Enterprise Server V8 – Linux on IBM ^™ iSeries – Linux on IBM ^ pSeries – Linux on IBM ^ zSeries and S/390®
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
1.1.2 IBM WebSphere Commerce V5.5 product editions Table 1-1 provides a summary of the software included with the Business and Professional Editions by platform. For more detailed information on the WebSphere Commerce supported software, refer to the Fundamentals Guide, IBM WebSphere Commerce V5.5 and the product installation guides for the desired platforms. Table 1-1 Software stack summary for IBM WebSphere Commerce V5.5 Software
Windows
AIX
Solaris
OS/400
Linux
IBM WebSphere Commerce * WebSphere Commerce Server * WebSphere Commerce Payments (cassettes for Paymentech, VisaNet, BankServArch, CustomOffline, OfflineCard) * Blaze Rules Server and Innovator runtime 4.5.5 * Recommendations Engine powered by LikeMinds 5.5 Note: The Business Edition includes all features of the Professional Edition plus additional functionality for B2B, hosting, and value chains (supply and demand).
5.5
5.5
5.5
5.5
5.5
IBM WebSphere Application Server
5.0
5.0
5.0
5.0
5.0.2 (FP2)
IBM WebSphere Application Server, Network Deployment Edition
5.0
5.0
5.0
5.0
5.0.2 (FP2)
IBM DB2 Universal Database™, Enterprise Server Edition
8.1 + FP1
8.1 + FP1
8.1 + FP1
Built-in
8.1 + FP2
IBM DB2 Extenders™
8.1 + FP1
8.1 + FP1
8.1 + FP1
N/A
Built-in
IBM DB2 Intelligent Miner™ for Data
8.1
8.1
8.1
8.1
8.1
IBM HTTP Server
1.3.26
1.3.26
1.3.26
Built-in
1.3.26.2
IBM Developer Kit, Java Technology Edition
1.3.1 SR3W
1.3.1 SR3W
N/A
Built-in
1.3.1 SR3W
Java 2 SDK, Enterprise Edition
N/A
N/A
1.3.1 FP5
N/A
N/A
IBM Directory Server
4.1.1
4.1.1
4.1.1
N/A
5.1
IBM WebSphere Commerce Analyzer
5.5
N/A
N/A
N/A
N/A
Chapter 1. Introduction
5
Software
Windows
AIX
Solaris
OS/400
Linux
Lotus® Sametime®
3.0
3.0
3.0
3.0
3.0
Lotus QuickPlace® Note: only included with Business Edition
3.0
3.0
3.0
3.0
3.0
Alternate Web Server The IBM HTTP Server V1.3.26 is included with WebSphere Commerce for all platforms. WebSphere Commerce supports the following alternate Web Servers on the listed platform (not included): Microsoft Windows 2000: – Microsoft Internet Information Server V5.0 – Sun ONE Web Server, Enterprise Edition V6.0 (formerly iPlanet) Sun Solaris – Sun ONE Web Server, Enterprise Edition V6.0 (formerly iPlanet)
Alternate databases IBM DB2 Universal Database V8.1, Enterprise Server Edition + Fix Pack 1 (Fix Pack 2 on Linux) is supported and included with WebSphere Commerce on all platforms (built-in database for OS/400). WebSphere Commerce also supports Oracle9i Database Release 2 (9.2.0.1), Enterprise Edition or Standard Edition (not included).
1.1.3 IBM WebSphere Commerce Studio V5.5 product editions IBM WebSphere Commerce Studio V5.5 is available in three editions: Business Developer, Professional Developer, and Express Developer. These correspond to the WebSphere Commerce runtime editions (Business, Professional and Express). WebSphere Commerce Studio consolidates all development tools into a single environment for developing front-end and back-end (business logic) application assets as well as a development test environment with debug support. Table 1-2 on page 7 provides a summary of the software included with IBM WebSphere Commerce Studio V5.5. For more detailed information on the WebSphere Commerce Studio supported software, refer to the Fundamentals Guide, IBM WebSphere Commerce V5.5 and Installation Guide, IBM WebSphere Commerce Studio V5.5 product guides.
6
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Table 1-2 Software stack summary for WebSphere Commerce Studio V5.5 Software
Version
IBM WebSphere Studio Application Developer * WebSphere Test Environment
5.0.0.2
IBM WebSphere Commerce Toolkit for WebSphere Studio
5.5
IBM WebSphere Commerce Configuration Manager plug-in for WebSphere Studio
5.5
IBM WebSphere Commerce Online Help plug-in for WebSphere Studio
5.5
IBM DB2 Universal Database, Enterprise Server Edition
8.1 + FP1
IBM WebSphere Commerce Note: Professional Developer Edition includes WebSphere Commerce V5.5, Professional Edition Business Developer Edition includes WebSphere Commerce V5.5, Business Edition
5.5
Note: Oracle9i Database software is also supported by WebSphere Commerce Studio V5.5 (not included).
Java levels supported in WebSphere Commerce Table 1-3 provides a summary of the Java levels supported in IBM WebSphere Commerce V5.5 versus IBM WebSphere Commerce V5.4. Table 1-3 Java level summary for WebSphere Commerce Java technology
WebSphere Commerce V5.5
WebSphere Commerce V5.4
Java 2 Enterprise Edition (J2EE)
1.3
1.2
Enterprise JavaBeans (EJB)
1.1
1.1 (1.0 + VisualAge® for Java wrapper for 1.1)
Java Servlet
2.3
2.2
JavaServer Pages (JSP)
1.2
1.1
JDK
1.3.1
* 1.3.1 for WebSphere Application Server V4 * 1.2.2 for VisualAge for Java
Chapter 1. Introduction
7
1.2 Features and benefits This section provides a listing of features and benefits of IBM WebSphere Commerce V5.5 for the Professional and Business Editions.
1.2.1 IBM WebSphere Commerce V5.5, Professional Edition IBM WebSphere Commerce V5.5, Professional Edition provides enhancements over previous versions and supports the following enterprise capabilities: Consumer direct store model (B2C) Enhancements include additional promotion rules, sophisticated search capabilities and enhanced store configuration services to improve the online buying experience of customers. Integration enhancements There are a number of integration solutions that address the enterprise needs through a mix of prepackaged and add-on capabilities. Key enhancements include: – IBM WebSphere Business Integration support: Provide a new transport mechanism used by subsystems to interact with external systems through WebSphere Business Integration collaborations. This is done by sending synchronous messages and taking advantage of the existing WebSphere Commerce messaging system. – Support end-to-end integration with SAP through WebSphere Business Integration Reference Application. – WebSphere Commerce Messaging system: Existing WebSphere Commerce Common Connector Framework (CCF) is enhanced to support Java 2 Enterprise Edition Connector Architecture (J2EE/CA) standard including JavaMail Connector, JMS Connector and File Connector. – MQ Transport Adapter: Upgrades to support J2EE/JCA compliant. Marketing and merchandising The marketing and merchandising features provided enhanced targeted e-mail campaign, advanced rules-based discounts or promotions and improved tooling for merchandising associations (cross-sells and up-sells). – E-mail support:
8
•
E-mail delivery of news and promotions
•
Manage e-mail activities at store level instead of site level and view statistics on e-mail activities
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
– Marketing campaigns •
Support e-mail as a campaign delivery mechanism
•
Time sharing of multiple initiatives on same spot
– Advanced discounts and promotions •
Rules-based discount supports complex promotion models such as shipping discount and buy one, get one free
•
Supports advanced scheduler for upcoming promotions
– Coupons enhancements •
Allow guest shoppers to capture and redeem eCoupons and manage eCoupons using a coupon wallet
•
Allow merchandiser to create eCoupons promotion, and manage eCoupon promotion and modify eCoupon promotion terms
– Cross-sells and up-sells •
Enhancements in merchandising and campaigns tooling allow target product to be recommended at runtime based on the content of the current page, shopping cart and previous purchases
•
Predefined merchandising associations in catalog
Live Help/Customer Care Collaboration The integrated live help Customer Care function is integrated out-of-the-box and is based on Lotus Sametime instant messaging. This feature allows your partners, suppliers, and customers to have real-time communication with you for decision-making and negotiations. Your business decisions and processes can be streamlined with this collaboration tool, making it easier and faster to do business. Enhancements include: – Support for multiple queues and queue management – Support monitoring of customized customer attributes in a store – Support customer requests to be routed into queues Catalog Management tooling The Catalog Management tooling simplifies product content management through the following enhancements: – Content Creation and Management tooling: Allows user to perform product and editorial content creation and management task quickly and effectively. – Bulk File Aggregation: Enhanced bulk file management tools provide out-of-the-box support for importing content from trading partners and bulk file import support to the Loader Package.
Chapter 1. Introduction
9
Product Advisor enhancements Product Advisor creates an interactive online product catalog that provides customers with different ways of finding what they want, called shopping metaphors. Enhancements include: – Creating a search space: Two search methods are supported. Separate search space would perform optimized parametric search with focus on categories, and base search space would search the WebSphere Commerce database that is created during instance configuration. – Creating the Product Exploration metaphor: Allows a customer to view products that have matching parameter values within a given category of products. – Creating the Product Comparison metaphor: Allows a customer to view the related products side by side for similarities and differences. – Creating a Guided Sell metaphor: Provides a series of multiple choice questions to guide customers to refine their searches to a smaller list of products. Analytics and Business Intelligence WebSphere Commerce Analyzer is packaged with WebSphere Commerce. Commerce Analyzer enables WebSphere Commerce customers to analyze information related to their customers' e-commerce activities. WebSphere Commerce customers can improve the effectiveness of their company's marketing campaigns and promotions. WebSphere Commerce Analyzer significantly extends analytical capabilities provided by the Entry version, which was packaged with Version 5.4. In this release, WebSphere Commerce Analyzer provides the following features: – A Business Intelligence (BI) infrastructure integrated with the following IBM Data Management programs: • •
IBM DB2 Universal Database V8.1, Enterprise Server Edition IBM DB2 Intelligent Miner for Data V8.1
– A documented and customizable datamart. – Extraction, transformation, move and load (ETML) functions to extract and transform WebSphere Commerce operational data sources using aggregation and summarizing techniques. This now includes support for coupons, discounts and multiple stores. – Data mining models, which enable the analyzing of complex data characterizations, relationships, and projections with regard to customer segmentation. – End-user Web analytical reporting enablement for the WebSphere Commerce Reporting Framework.
10
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Operational reports Operational reports, based on WebSphere Commerce Reporting Framework, are generated in real time. These reports can provide useful information about the sales, traffic, and customers from your site. The following types of reports are accessible through the system: – – – – – – – – – – –
Category Product Order Item Detail Order Item Fulfillment Order Status Region Region (all stores) Site Overview Store Activity Store Performance Evaluation Usage
Tivoli® Web Site Analyzer The Tivoli Web Site Analyzer V4.2 helps turn raw Web data into valuable e-business intelligence. It provides you with a clear picture of the overall health and integrity of your e-business infrastructure supporting business impact management. By capturing, analyzing, storing, and reporting on Web site usage, health, integrity and site content, Tivoli Web Site Analyzer provides essential metrics on visitor interactions with the site and the site's overall performance. Its multi-channel data collection consolidates globally distributed Web server logs, including logs generated in a z/OS® environment into a single open data warehouse. In addition, Web page information can be captured dynamically via Tivoli Web Site Analyzer's Web Tracker function providing a more real-time view. Using these functions, Tivoli Web Site Analyzer can create detailed reports and views on Web server activity, visitor statistics, and visitor behavior. Integrating the critical end-user experience dimension provides the benefit of deeper, more complex analysis. WebSphere Commerce Payments WebSphere Commerce Payments provides a secure electronic payment process for Internet merchants through a single, unified interface. Based on open standards-based technology, WebSphere Commerce Payments works with plug-ins called payment cassettes to support multiple payment protocols. Support for existing cassettes include OfflineCard, CustomOffline VisaNet, and BankServACH cassettes. Enhancements include: – Support for a new cassette for Paymentech including connectivity is added
Chapter 1. Introduction
11
– Add support for SSL connectivity to VirtualNet system via VisaNet cassette – Add support for SSL and leased line connectivity to the FHMS system via the VisaNet cassette – Automatic restart of Commerce Payments without manual intervention to support 24x7 operation and recoverability System management WebSphere Commerce provides the following enhancements for systems management: – Administration: System management options can be separately installed by way of the WebSphere Commerce custom install. – Organization Administration Console: This tool can be used by an administrator in the customer organization as well as by the site administrator to manage all customers. – Problem Determination: The WebSphere Commerce Problem Determination tool automatically validates the correctness of WebSphere Commerce installation and instance creation and JRAS, the WebSphere Commerce logging infrastructure consolidated with WebSphere Application Server to allow for use of common tooling and to correlate logging data throughout the system. – Performance Monitoring: Integrated use of WebSphere Application Server PMI (Performance Monitoring Interface) enabling WebSphere Commerce data to be viewed through the Tivoli Performance Viewer. Installation WebSphere Commerce V5.5 improves the ease of installation and configuration to ensure a system is installed correctly and prerequisites are available. Enhancements include: – WebSphere Commerce and all its associated software can now be installed through the WebSphere Commerce InstallShield based on InstallShield for Multiplatform Edition (ISMPE). – Express Install allows you to quickly install WebSphere Commerce and create a WebSphere Commerce instance with minimal user interaction. – Configuration Manger is enhanced to support remote machine configurations, and the Password Manager Tool lets you manage WebSphere Commerce passwords from a single location. – A new Problem Determination (PD) Tool: a Java-based tool that analyzes the up-and-running logs and generates reports for troubleshooting problems.
12
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Web services You can allow WebSphere Commerce to be the service provider by enabling its business functions as Web services that can be accessed by external systems. You can also allow WebSphere Commerce to be the service requester by enabling it to invoke Web services hosted by external systems.
1.2.2 IBM WebSphere Commerce V5.5, Business Edition IBM WebSphere Commerce V5.5, Business Edition supports all of the enterprise capabilities of IBM WebSphere Commerce V5.5, Professional Edition, plus the following Business-to-Business (B2B) benefits: Channel Management IBM WebSphere Commerce V5.5, Business Edition provides new channel management capabilities to support integrated value chains for transactions involving multiple parties. This enables enterprises to optimize the flow of products, goods, services, and information through the value chain, while streamlining the management and administrative aspects of orchestrating these relationships. The key capabilities to support both demand and Supply Chains include: – Business relationship management between channel partners and suppliers – Product information management for channel partners and suppliers – Distributed order management – Channel inventory monitoring – Order hand-off and order status tracking – Co-marketing with channel partners and suppliers – Multi-party Request-For-Quote (RFQ) and Request-For-Proposal (RFP) – Private marketplace and partner hosting – Secured sign-on and access control for channel partners and suppliers – Self-provisioning for channel partners and suppliers – Collaboration with channel partners and suppliers B2B direct store enhancements (ToolTech) Hosting New to IBM WebSphere Commerce V5.5, Business Edition is the ability to support hosting of business partners in the value chain model. WebSphere Commerce also supports the hosting of merchants or other business by an Internet Service Provider (ISP) or other hosting provider. A hosting hub is a Web site, usually owned by an ISP, where merchants can build a store for shoppers. Merchant stores can have catalogs filtered from a reseller hub catalog, or have their own catalog.
Chapter 1. Introduction
13
Value chains New to IBM WebSphere Commerce V5.5, Business Edition is the ability to support value chains. Value chains support transactions involving multiple enterprises or parties. Products, goods, services, or information are delivered through parties of the value chain from producers to end users. A value chain also has relationship and administrative aspects, which allow for managing the relationship of parties in the value chain. Two new value chains are as follows: – Demand Chains Demand Chains support both indirect sales and direct sales channels. A Demand Chain is composed of the enterprises that sell a business’s goods or services. For example, a Demand Chain may be composed of buyers who initiate the sales transaction, the resellers who sell the manufacturer’s goods, and the manufacturer who creates the goods. – Supply Chains A Supply Chain is composed of the enterprises that provide services to a business. WebSphere Commerce provides the architectural infrastructure to support Supply Chains that take the form of a private marketplace. A private marketplace provides a forum for vendors to offer their wares for sale. Buyers enter this forum and after browsing through the available options, select the appropriate goods or services. Request-For-Quote (RFQ) Request for Quote (RFQ), only available in the Business Edition, provides the capability for an RFQ to solicit quotes for a specific set of goods and services between buyer and supplier. Enhancements include: – New RFQ closing rules, for example an RFQ will be closed if a specific number of responses are received – Provide targeted RFQ support, attachments to RFQ, made-to-orders items in RFQ, and multi-round RFQ support – Allow creation of RFQ without setting up the interest list, add items from the requisition list, grouping of the products in RFQ, substitution of products in response, and specify a fulfillment center in the response Online Buyer/Seller Collaboration (Collaborative Workspaces) Available only in Business Edition, it provides a contract draft and proposal discussion template, based on Lotus QuickPlace. This template is integrated into the business-to-business store model included with the software. A seller company's sales or account manager can create a draft contract, share this contract with buyers in the buying organization, and also discuss the contract using a threaded discussion on Lotus Domino™. Additional features also
14
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
allow online buyers and sellers to make decisions about the quantity and content of orders, delivery dates, promotions, and designs of new products.
1.3 Target audience of this IBM Redbook As is the nature of a handbook, this redbook is multi-purpose: it includes architecture, design, development, integration, deployment and administration topics. The target audience of the redbook can be best matched by role to the topic of interest within the redbook.
1.3.1 Roles and skills There are a number of common roles that are needed for a team to execute a WebSphere Commerce project during the development life cycle. In this section, we define the following key roles and skills to be used as a cross-reference with the topics of interest within the redbook:
Project manager IT architect/technical lead WebSphere Commerce site administrator WebSphere Commerce store administrator Database schema owner (creation/migration expert) Database administrator (DBA) Java programmer Web developer Tester Line-of-business (LOB) user
Project manager The project manager is responsible for managing and leading the project team throughout all phases of the project and also acts as a contact point to interact with the customer. The project manager should have a general understanding of the WebSphere Commerce product and be familiar with the product architecture.
IT architect/technical lead The IT architect looks after the overall project technical architecture/design, quality assurance of the solution, knowledge transfer to customers, and mentoring to the project technical team members. The architect should have WebSphere Commerce architecture and design skills. Based upon project scope and complexity, one or more WebSphere Commerce architects can work to create detailed project technical designs. The work effort can be divided based on common WebSphere Commerce subsystems, such as Catalog, Member,
Chapter 1. Introduction
15
Order, and communication with back-end or legacy systems. The technical design will be developed with the assistance of the lead developer.
WebSphere Commerce site administrator The WebSphere Commerce site administrator installs, configures, and maintains WebSphere Commerce and the associated software and hardware. The site administrator responds to system warnings, alerts, and errors, and diagnoses and resolves system problems. This role typically controls access and authorization (creating and assigning members to the appropriate role), manages the Web site, monitors performance, and manages load balancing tasks. The site administrator may also be responsible for establishing and maintaining several server configurations for different stages of development such as testing, staging, and production. This role also handles critical system backups and resolves performance problems. For very large sites, some of the installation and configuration task may be performed by the system administrator.
WebSphere Commerce store administrator The WebSphere Commerce store administrator manages the store archive publishing, changes to taxes, shipping and managing store operations. The store administrator may be a lead on the store development team, and is the only role on the team with the authority to publish a store archive (except for the site administrator). In larger IT shops, this may be a designated person on the deployment or operations team.
Database schema owner (creation/migration expert) The WebSphere Commerce V5.5 database schema contains over 600 tables with numerous columns. It is critical that someone on the development team be very familiar with the WebSphere Commerce database schema for the development implementation and/or migration. In addition, the database owner is often responsible for managing the WebSphere Commerce XML data files that are used to populate the WebSphere Commerce instance database with catalog data, store and site data.
Database administrator (DBA) The database creation or migration activity role could also be performed by the DBA. The DBA is responsible for the creation and/or migration of the WebSphere Commerce instance database and ongoing database operations.
Java programmer The WebSphere Commerce programmer is responsible for the Java programming of the application assets of the site. The WebSphere Commerce architect/technical lead can also participate in implementing the new or transitioned site. The WebSphere Commerce programmer must have in-depth
16
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
knowledge of the WebSphere Commerce framework, programming and store models. In addition, they must have a strong background in J2EE programming and development tooling. The focus of the Java programmer will be on developing WebSphere Commerce commands (servlets) and EJBs.
Web developer The Web developer will focus on the front-end assets such as JavaServer Pages (JSPs), HTML and management of product images within the display pages. The Web developer is also known as a Web designer.
Tester There are many types of tests, such as unit test, functional verification test (FVT), system verification test (SVT), integration test, and customer acceptance test (CAT). The test lead is responsible for developing and executing a test plan for quality assurance. The members of the test team should be well versed in the product architecture, features of the site, and operational usage to simulate the transactions of a customer and a line-of-business user.
Line-of-business (LOB) user The line-of-business (LOB) users are typically responsible for managing the operations of the site. They can be marketing users where they are responsible for promoting the Web site to customers, managing the data needs for catalog management, and customer service-related tasks. Within WebSphere Commerce, there are many predefined roles that can be assigned to LOB users. The WebSphere Commerce administration tools can be configured to allow access only to specific functions within the tools by user role assigned to the user logged into the tool.
1.3.2 Matching topics in this redbook to roles and skills The topic set in this WebSphere Commerce V5.5 Handbook is diverse. Table 1-4 on page 18 provides a summary of the topics in this redbook, by part and chapter, aligning them with the defined roles and skills.
Chapter 1. Introduction
17
Table 1-4 Matching redbook topics to roles and skills Part
Chapter
Primary
Secondary
Part 1, “Introduction to WebSphere Commerce V5.5” Ch 1, ”Introduction”
All roles
Ch 2, ”Runtime architecture”
All roles
Ch 3, ”Business and store models”
All roles
Ch 4, ”Programming model”
IT architect Java programmer
Web developer Site administrator
Ch 5, ”Site and store administration”
Site administrator Store administrator LOB DBA Tester
Project manager IT architect Java developer Web developer
Ch 6, ”WebSphere Commerce site development methodology”
IT architect Java programmer Web developer
Project manager Site administrator Store administrator
Ch 7, ”Development environment and build cycle”
Java programmer Web developer
IT architect Site administrator Store administrator
Ch 8, ”Globalization guidelines”
IT architect Java programmer Web developer
Site administrator Store administrator
Part 2, “Development guidelines”
18
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Part
Chapter
Primary
Secondary
Ch 9, ”Requirements analysis and solution design”
IT architect
Project manager
Ch 10, ”ITSO sample code”
IT architect Java programmer Web developer Site administrator
Project manager
Ch 11, ”Implement a team development environment”
Java programmer Web developer
Site administrator IT architect
Ch 12, ”Create a store”
Web developer
IT architect Java developer Store administrator
Ch 13, ”Customize a store: Price Watch example”
Java programmer
IT architect Web developer
Ch 14, ”Build and deployment”
Java programmer Site administrator Web developer Store administrator
IT architect Tester
Ch 15, ”Manage the ITSO store”
Site administrator Store administrator LOB
IT architect Web developer Java programmer
Ch 16, ”Windows: Migrate a single-tier to a multi-tier”
Site administrator
IT architect DBA Tester
Ch 17, ”Solaris: Three-tier environment using Oracle9i and Sun ONE Web Server”
Site administrator
IT architect DBA Tester
Ch 18, ”AIX: Three-tier using DB2 and IBM HTTP Server”
Site administrator
IT architect DBA Tester
Ch 19, ”OS/400: Two-tier remote database server”
Site administrator
IT architect DBA Tester
Part 3, “ITSO B2B working example”
Part 4, “Runtime deployment scenarios”
Chapter 1. Introduction
19
Part
Chapter
Primary
Secondary
Ch 20, ”Commerce analytics”
Site administrator Store administrator LOB Web developer
IT architect DBA Schema owner Tester
Ch 21, ”Messaging integration with MQ and e-mail”
Site administrator Java programmer
IT architect Store administrator Tester
Ax A, “AIX tips”
Site administrator
DBA Tester
Ax B, “Solaris tips”
Site administrator
DBA Tester
Ax C, “DB2 tips”
Site administrator DBA Schema owner
Tester
Ax D, “Oracle tips”
Site administrator DBA Schema owner
Tester
Ax E, “WebSphere Commerce Studio implementation”
Java programmer Web developer
Site administrator IT architect
Ax F, “Additional material” (sample code)
Java programmer Web developer
IT architect Tester
Part 5, “Integration and customization scenarios”
Part 6, “Appendixes”
1.4 For more information There is a vast amount of information available on WebSphere Commerce and related topics, such as WebSphere Application Server, WebSphere Studio Application Developer, and DB2. Sometimes the key to solving a problem is knowing where to find the necessary information. This section highlights the key product documentation, Web sites and IBM Redbooks.
1.4.1 IBM WebSphere Commerce product documentation Even if you are a big fan of IBM Redbooks, you should be aware that there is a vast amount of knowledge available only in the product documentation. The
20
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
product documentation PDFs and online help are updated periodically and can be downloaded from the WebSphere Commerce Technical Library found at: IBM WebSphere Commerce V5.5, Business Edition http://www.ibm.com/software/genservers/commerce/wcbe/library/lit-tech-gener al.html
IBM WebSphere Commerce V5.5, Professional Edition http://www.ibm.com/software/genservers/commerce/wcpe/library/lit-tech-gener al.html
We have categorized the product documentation as follows: Readme files for WebSphere Commerce and WebSphere Commerce Studio It is very important that you review the contents of the Readme files. Online information – WebSphere Commerce online information The online information is installable with the WebSphere Commerce runtime or can be downloaded and viewed from a Web browser. It is very useful when looking for information by search topic, role, and task. – WebSphere Commerce Studio online information The online information is installable with the WebSphere Commerce Studio or can be downloaded and accessed from a Web browser. It is very useful when looking for information by search topic. Overview – What’s New in IBM WebSphere Commerce V5.5 – Fundamentals Guide, IBM WebSphere Commerce V5.5 Runtime environment installation and configuration The runtime environment installation and configuration guides are listed by platform: – Microsoft Windows • •
Quick Beginnings Guide for Windows 2000, IBM WebSphere Commerce V5.5 Installation Guide, IBM WebSphere Commerce V5.5 for Windows 2000
– UNIX® (IBM AIX and SUN Solaris) • • •
Quick Beginnings Guide for AIX, IBM WebSphere Commerce V5.5 Quick Beginnings Guide for Solaris, IBM WebSphere Commerce V5.5 Installation Guide, IBM WebSphere Commerce V5.5 for UNIX Systems
Chapter 1. Introduction
21
– IBM OS/400 • •
Quick Beginnings Guide for OS/400, IBM WebSphere Commerce V5.5 Installation Guide, IBM WebSphere Commerce V5.5 for OS/400
– Linux • •
Quick Beginnings Guide for Linux, IBM WebSphere Commerce V5.5 Installation Guide, IBM WebSphere Commerce V5.5 for Linux
– Additional Software Guide, IBM WebSphere Commerce V5.5 (common for all platforms) Development environment installation and configuration – Installation Guide, IBM WebSphere Commerce Studio V5.5 Migration guides The migration guides are listed by the version to migrate from and by platform. Integration – WebSphere Commerce Analyzer •
Installation and Configuration Guide, IBM WebSphere Commerce Analyzer V5.5
•
Datamart Reference, IBM WebSphere Commerce Analyzer V5.5
•
Technical Reference, IBM WebSphere Commerce Analyzer V5.5
– WebSphere Commerce Payments •
Payments Programming Guide and Reference, IBM WebSphere Commerce V5.5
•
Payments Cassette for Paymentech Supplement, IBM WebSphere Commerce V5.5
•
Payments Cassette for BankServACH Supplement, IBM WebSphere Commerce V5.5
•
Payments Cassette for VisaNet Supplement, IBM WebSphere Commerce V5.5
•
Payments Offline Cassette Supplement, IBM WebSphere Commerce V5.5
•
Payments Custom Offline Cassette Supplement, IBM WebSphere Commerce V5.5
Store development and programming – Sample Store Guide, IBM WebSphere Commerce V5.5 – Store Development Guide, IBM WebSphere Commerce V5.5 – Programming Guide and Tutorials, IBM WebSphere Commerce V5.5
22
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
– Web Services Guide, IBM WebSphere Commerce V5.5 Administration – Administration Guide, IBM WebSphere Commerce V5.5 – Security Guide, IBM WebSphere Commerce V5.5
1.4.2 Web sites This section lists Web sites where you can find additional information on WebSphere Commerce and related topics: IBM WebSphere Commerce V5.5, Business Edition – Home page http://www.ibm.com/software/genservers/commerce/wcbe/index.html
– Technical Library http://www.ibm.com/software/genservers/commerce/wcbe/library/lit-tech-ge neral.html
– Support http://www.ibm.com/software/genservers/commerce/wcbe/support/
IBM WebSphere Commerce V5.5, Professional Edition – Home page http://www.ibm.com/software/genservers/commerce/wcpe/index.html
– Technical Library http://www.ibm.com/software/genservers/commerce/wcpe/library/lit-tech-ge neral.html
– Support http://www.ibm.com/software/genservers/commerce/wcpe/support/
IBM WebSphere Commerce Zone (development information) http://www.software.ibm.com/wsdd/zones/commerce/
IBM Services for IBM WebSphere Commerce Software http://www.ibm.com/software/genservers/commerce/services/
How to Buy IBM WebSphere Commerce http://www.ibm.com/software/swprod/swprod.nsf/(BuildHTBPage)?OpenAgent&DocI D=BMAL-5KSR6N
IBM Redbooks http://www.ibm.com/redbooks
Chapter 1. Introduction
23
1.4.3 IBM Redbooks IBM Redbooks are developed and published by IBM's International Technical Support Organization (ITSO). We develop and deliver skills, technical know-how, and materials to technical professionals of IBM, Business Partners, and customers, and to the marketplace generally. The ITSO teams with IBM Divisions and Business Partners in the process of developing IBM Redbooks, Redpapers, hints & tips, training, and other materials. The ITSO is part of the IBM Global Technical Support organization within IBM Global Sales and Distribution. The ITSO's value-add information products address product, platform, and solution perspectives. They explore integration, implementation, and operation of realistic customer scenarios. IBM Redbooks and Redpapers can be downloaded as PDFs at: http://www.ibm.com/redbooks
If you are interested in participating in creating an IBM Redbook, Redpaper or workshop, click the Residency link on the IBM Redbooks Web site.
WebSphere Commerce Redbooks We recommend the following IBM Redbooks for WebSphere Commerce: WebSphere Commerce V5.5 Handbook, Customization and Deployment Guide, SG24-6969 WebSphere Commerce V5.5 Capacity Planning, SG24-6304 (expected publish date 12/2003) WebSphere Digital Media V5.5 Solutions Guide, SG24-6085 (expected publish date 2/2004) Best Practices and Tooling for Creating IBM WebSphere Commerce Sites, REDP3616 WebSphere Commerce V5.4 Catalog Design and Content Management, SG24-6885 WebSphere Commerce Portal V5.4, Using WebSphere Commerce V5.4 and WebSphere Portal V4.2, SG24-6890
WebSphere Redbooks We recommend the following IBM Redbooks for WebSphere Application Server V5 and WebSphere Studio Application Developer V5: IBM WebSphere Application Server V5.0 Systems Management and Configuration: WebSphere Handbook Series, SG24-6195
24
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
WebSphere V5.0 Applications: Ensuring High Performance and Scalability, SG24-6198 IBM WebSphere V5.0 Security WebSphere Handbook Series, SG24-6573 WebSphere Studio Application Developer Version 5 Programming Guide, SG24-6957
Other Redbooks The following Redbooks may be useful for specific integration topics with WebSphere Commerce and supporting software: Enhance Your Business Applications: Simple Integration of Advanced Data Mining Functions, SG24-6879 DB2 UDB/WebSphere Performance Tuning Guide, SG24-6417 Patterns: Custom Designs for Domino & WebSphere Integration, SG24-6903 IBM Certification Study Guide - pSeries AIX System Administration, SG24-6191 IBM HTTP Server (powered by Apache) for iSeries, SG24-6716 Enterprise Business Portals II with IBM Tivoli Access Manager, SG24-6885 Measuring e-business Web Usage, Performance, and Availability, SG24-6931
Chapter 1. Introduction
25
26
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
2
Chapter 2.
Runtime architecture The objective of this chapter is to provide IT architects, IT specialists, developers and project managers with the fundamental knowledge of the WebSphere Commerce V5.5 runtime architecture to make informed decisions when designing or implementing an e-commerce solution. The terms runtime architecture, systems architecture, and runtime environment are synonymous in the context of this redbook. The chapter includes the following topics:
Overview WebSphere Commerce software components WebSphere Commerce Server subsystems Runtime topology selection For more information
© Copyright IBM Corp. 2003. All rights reserved.
27
2.1 Overview This section identifies the key components of the WebSphere Commerce runtime architecture. We have categorized the components for the WebSphere Commerce Server as follows (see Figure 2-1 on page 29): WebSphere Commerce software components We have listed the primary software components for WebSphere Commerce. There are many additional software components ncluded in the IBM WebSphere Commerce V5.5 product packaging that have not been listed here but that can be integrated with WebSphere Commerce. – – – – – –
Web server WebSphere Application Server Database Server WebSphere Commerce Server WebSphere Commerce Payments Server Enablement software (optional software components)
WebSphere Commerce Server subsystems The subsystems run within the WebSphere Commerce enterprise application on the WebSphere Commerce Server, and provide the infrastructure to support the features used by the administration tooling and stores. – – – – – – – –
Member subsystem Catalog subsystem Trading subsystem Order subsystem Merchandising subsystem Marketing subsystem Inventory subsystem Messaging subsystem
Common server runtime (framework) The common server runtime provides a framework in which the commerce applications are deployed and executed. Business interaction engine The subsystems and server runtime operate within an interaction engine that provides all of the components with the necessary business context. These are governed by the contextual frameworks such as policies, entitlement, stores, personalization, and globalization. Administration tools The administration tools are used to configure and manage the WebSphere Commerce site and store operations.
28
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
– – – – –
WebSphere Commerce Configuration Manager WebSphere Commerce Administration Console WebSphere Commerce Accelerator WebSphere Commerce Organization Administration Console WebSphere Commerce Payments Administration Console
Information for each of the listed administration tools can be found in Chapter 5, “Site and store administration” on page 133.
Administration Console Commerce Accelerator Organization Administration Console
WebSphere Application Server WebSphere Commerce Payments Server WebSphere Commerce Server Administration tools Administration Console
Configuration Tools
Policies
Stores
Entitlement
Personalization
Globalization
Common Server Runtime
WebSphere Commerce instance database
Subsystems Member Subsystem
Trading Subsystem
Catalog Subsystem
Marketing Subsystem
Merchandizing Subsystem
Order Subsystem
Inventory Subsystem
File e-mail
ICS
WebSphere Commerce .xml
HTTP
Configuration Manager Server
WebSphere Commerce Payments database
Messaging Subsystem
MQ
Configuration Manager (client)
Accelerator
Business Interaction Engine
Development Tools WebSphere Commerce Studio
Organization Administration Console
Commerce
Database Server
WC Payments Administration Console
WebSphere Commerce node Web Server + WebSphere plug-in
Web Browser Administration Tools
Transport adapters Figure 2-1 WebSphere Commerce Server runtime components
Chapter 2. Runtime architecture
29
2.2 WebSphere Commerce software components As described in 1.1, “Platform support and product packaging” on page 4, there are many software components included with IBM WebSphere Commerce V5.5. In this section, we will limit our discussion to the following software components of the WebSphere Commerce runtime architecture:
Web server WebSphere Application Server Database Server WebSphere Commerce Server WebSphere Commerce Payments Server Note: The WebSphere Commerce node architecture depicted in Figure 2-1 on page 29 shows a single-tier configuration. The software components listed in this section can be distributed on separate nodes for scalability and security reasons. For more detailed information on runtime configurations, refer to 2.4, “Runtime topology selection” on page 41.
2.2.1 Web server The Web server can be installed on the WebSphere Commerce node or a remote node, which can be optionally clustered for load balancing using the WebSphere Application Server V5, Network Deployment Edition Edge components. Regardless of whether the Web server is local or remote, it must be configured to use the WebSphere Application Server plug-in. There are several supported Web server plug-ins. The IBM HTTP Server and plug-in are found on the WebSphere Application Server CD included with WebSphere Commerce. The majority of the WebSphere Commerce tooling and store application assets are J2EE components (JSPs, servlets, EJBs, etc.) that run on the application server located on the WebSphere Commerce node. There are some static HTML pages and images found in the WebSphere Commerce tools and stores that can be served by the Web server. Incoming HTTP requests from Web browser clients are received by the Web server and WebSphere plug-in. The WebSphere plug-in, via the use of the plugin-cfg.xml file, redirects requests to applications on the WebSphere Application Server on the WebSphere Commerce node. In the event that you want to set up a remote Web server, you must manually configure the WebSphere Application Server virtual host aliases and regenerate the WebSphere plugin-cfg.xml file on the WebSphere Commerce node. The updated plugin-cfg.xml file must then be manually copied to the remote Web server. The Web server host name must be updated in the WebSphere
30
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Commerce instance and WebSphere Commerce Payments instance via the Configuration Manager. In addition, static application assets that are to be served by the Web server (HTML, images) must also be manually copied to the remote Web server. Once the remote Web server has reloaded the plugin-cfg.xml file and the WebSphere Application Server has been restarted to reflect the configuration changes, the remote Web server host name can be used by the Web browser client to access the WebSphere Commerce tools and stores. For more information on implementing a remote Web server, refer to 16.4, “Add remote Web Server node” on page 587. For information on alternative supported Web servers by platform, refer to “Alternate Web Server” on page 6.
2.2.2 WebSphere Application Server The WebSphere Commerce Server leverages the J2EE technologies provided by the WebSphere Application Server such as JSPs, servlets (WebSphere Commerce commands), EJBs, XML, Web Services, security, MQ embedded messaging, etc. IBM WebSphere Commerce V5.5 includes the IBM WebSphere Application Server V5 base edition and Network Deployment Edition. The base edition is suitable for single-tier, two-tier and three-tier runtime configurations. When multiple WebSphere Application Servers are needed for scalability, such as horizontal application clustering, then the Network Deployment Edition is needed.
2.2.3 Database Server IBM DB2 Universal Database V8.1, Enterprise Server Edition is included with WebSphere Commerce V5.5. In addition, Oracle9i (9.2.0.1) Enterprise Server and Standard Edition are supported (not included). The Database Server is used for the WebSphere Commerce instance database and the WebSphere Commerce Payments database. The WebSphere Commerce instance database is used for store configuration data such as taxes, shipping, customer profile information, and the product catalog. There are over 600 tables and numerous columns built into the WebSphere Commerce V5.5 schema. The WebSphere Commerce Payments database is used for payment configuration, such as accounts, payment types, cassettes and payment transaction data.
Chapter 2. Runtime architecture
31
The database server software can be installed on the same node as WebSphere Commerce or on a remote Database Server node. For more information on implementing a remote Database Server node, refer to 16.3, “Add a remote Database Server node” on page 582.
2.2.4 WebSphere Commerce Server The WebSphere Commerce Server is a WebSphere enterprise application, which runs on its own application server within the WebSphere Application Server. The WebSphere Commerce application software is installed via the WebSphere Commerce Installer. After installation, WebSphere Commerce must be configured using the Configuration Manager. The Configuration Manager is used to create the WebSphere Commerce instance. During instance creation, an application server for the WebSphere Commerce Server and the enterprise application is deployed. For most runtime topologies, the configuration of the WebSphere Application Server is performed for the user via the WebSphere Commerce Configuration Manager. When adding a remote Web server, remote WebSphere Commerce Payments node, and clustering using the WebSphere Application Server Network Deployment Edition, some manual configuration is needed.
2.2.5 WebSphere Commerce Payments Server The WebSphere Commerce Payments Server is a WebSphere enterprise application that runs on its own application server within the WebSphere Application Server. After installation, the WebSphere Commerce Payments must be created using the Configuration Manager. When creating a WebSphere Commerce Payments instance using the Configuration Manager, the WebSphere Commerce Payments instance application server is created and the WebSphere Commerce Payments enterprise application is deployed. The WebSphere Commerce Payments Server can be installed on the WebSphere Commerce node or on a remote node. For information on implementing a remote WebSphere Commerce Payments node, refer to 18.5, “WebSphere Commerce Payments node implementation” on page 698.
32
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
2.2.6 Enablement software There are several enablement software components included with WebSphere Commerce that can be optionally installed. In addition, we have listed WebSphere enablement software that can be leveraged by WebSphere Commerce.
WebSphere Commerce enablement software This section describes the functionality provided by the following enablement software included with IBM WebSphere Commerce V5.5: Personalization There are two personalization solutions included with WebSphere Commerce, Blaze Rules and LikeMinds collaborative filtering. The personalization software can be used to improve the customer experience by tailoring the site to a number of criteria, such as customer profile, shopping cart contents, and purchase history. Commerce analytics WebSphere Commerce V5.5 has improved analytics capability through the use of WebSphere Commerce Analyzer and IBM DB2 Intelligent Miner for Data V8.1, and IBM DB2 UDB V8.1 warehousing features. There are many business intelligence reports included with WebSphere Commerce, which leverage the technology of the WebSphere Commerce Reporting Framework and are accessible from the WebSphere Commerce Accelerator. For more information, refer to Chapter 20, “Commerce analytics” on page 787. Messaging integration WebSphere Commerce V5.5 includes messaging adapters for HTTP, e-mail, MQ, InterChange Server (ICS), and file. Inbound messaging supports the HTTP and MQ adapters and can be customized to support other protocols. Outbound messaging support includes WebSphere MQ, WebSphere InterChange Server (ICS), e-mail, and file adapters. WebSphere Commerce ships with a sample J2C-based connector that can be customized. For more information, refer to Chapter 21, “Messaging integration with MQ and e-mail” on page 883. Collaboration Customer Care, which is a Lotus Sametime V3.0 application integrated with WebSphere Commerce, provides live help in real time between customers and customer service representatives (CSRs).
Chapter 2. Runtime architecture
33
Collaborative Workspaces, which is built-upon Lotus QuickPlace V3.0 and only available with the Business Edition, provides an environment where business customers and line-of-business users can interact. Directory Server (LDAP) IBM Directory Server V4.1.1 is an LDAP directory server included with WebSphere Commerce V5.5. WebSphere Commerce can optionally be configured to use LDAP as the member repository instead of the default WebSphere Commerce instance database. LDAP provides for better integration and single sign-on (SSO) for multiple participating applications sharing the same LDAP directory.
WebSphere enablement software The IBM WebSphere software brand includes many enablement software solutions that can be leveraged by WebSphere Commerce. This section highlights the WebSphere Foundations, Tools and Business Portals. WebSphere Foundation and Tools The WebSphere Application Server is a J2EE based application server. The WebSphere Commerce Server (application server) is an enterprise application and has its own application server. WebSphere Commerce V5.5 includes the IBM WebSphere Application Server V5 base edition and the Network Deployment Edition. WebSphere Commerce can leverage the technologies provided by the WebSphere Application Server and WebSphere tooling, namely WebSphere Studio Application Developer for the development of Java and related application assets. WebSphere Business Portals WebSphere Business Portals help extend and personalize the user experience. The integration of WebSphere Commerce V5.5 and WebSphere Portal V5 will be delivered in an upcoming Enhancement Pack.
2.3 WebSphere Commerce Server subsystems The subsystems provide a great deal of functionality for the WebSphere Commerce Server. The subsystems are used to integrate other components and external nodes as well as make it vastly easier for the store developer to customize, deploy, and manage a store.
34
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
2.3.1 Member subsystem The Member subsystem is a component of the WebSphere Commerce Server that provides a framework for managing the following participants of the system:
Organizational entity (for example, IBM) Organizational unit (for example, IBM Software Group) Member group - group of users Members - users, member groups, organizational entity
The member data is stored within either a WebSphere Commerce instance database or an LDAP directory server database. By default, WebSphere Commerce uses the instance database as its registry. The major functions of the Member subsystems are to provide member registration and profile management. Other closely related services of the Member subsystem include authentication, access control, and session management.
User registration methods To facilitate various requirements for e-commerce Web sites, WebSphere Commerce provides several methods for user registration, as seen in Figure 2-2.
1
WebSphere Commerce
Customer
WebSphere Commerce instance database Customer Service Representative
MQ Applications
2 MQ
3a
3
3b LDAP
4
JNDI LDAP API
LDAP Directory Management Tool
3c
Mass Loader
Directory Applications
Legacy DB LDIF
Mass Import Files
Figure 2-2 User registration and update methods
1. WebSphere Commerce online registration This involves the registration of members online for the e-commerce Web site. Users will be prompted for registration before catalog navigation or during the order checkout process. This is the most common and direct approach of the user registration method. This method does not support mass registrations.
Chapter 2. Runtime architecture
35
2. MQ WebSphere Commerce also supports member registration from back-end systems, such as ERP systems using WebSphere MQ. To enable this method, the WebSphere Commerce message transport adapter and MQ need to be configured. WebSphere Commerce provides an inbound messaging service for creating and updating customer registration. This method is very useful if you have legacy systems, which you need to Web enable. This approach is best suited for an enterprise integration solution. By default, WebSphere Commerce does not provide outbound services over MQ for the Member subsystem. We demonstrate how to register a new user in 21.6, “Scenario: add new inbound message for MQ” on page 936, using WebSphere MQ. 3. Using LDAP WebSphere Commerce also supports integration with industry-standard LDAP directory for user registration. If LDAP is used as a user registry, then WebSphere Commerce will synchronize with the LDAP directory, based on the mapping parameters defined in the WebSphere Commerce ldapentry.xml file between WebSphere Commerce and LDAP. When the registered user in LDAP logs into the WebSphere Commerce system, the user entry is replicated on the fly to the WebSphere Commerce store database. WebSphere Commerce will synchronize with the LDAP directory to retrieve and update the user registration. 4. Using WebSphere Commerce Loader Package (MassLoad) WebSphere Commerce Loader Package is used for mass database updates. The MassLoad tool can be used for mass registration of users. This method is especially useful in the migration from previous versions, in database management, and in member registration exchange across WebSphere Commerce systems. The registered users will manage their user profile by updating the registration information, adding, modifying or deleting address entries in the address book. Also, a customer service representativecan update the user profiles.
Member security services The following security services are closely related to the Member subsystem: Roles The Member subsystem allows its users and organizational entity members to be assigned roles. The roles define the activities that members are allowed to perform. Role assignment is the responsibility of the site administrator.
36
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Authentication WebSphere Commerce supports two modes of authentication: – Basic authentication (using user ID and password) This mode of authentication is the default and can be used with the WebSphere Commerce store database or an LDAP directory. – Certificate-based authentication (using x.509 certificates) The authentication mode is configured via the WebSphere Commerce Configuration Manager within the Web server tab of the instance properties. Access control To facilitate database management and ensure security, access to WebSphere Commerce must be restricted to specific individuals and organizations. The process of restricting access is referred to as access control. Access control can be defined as security guidelines that: – Allow or deny a user of a system access to the resources managed by a system. – Specify what actions the user can perform on each resource. Access control is managed through the implementation of access control policies and policy groups. – Access control policies An access control policy authorizes a group of users to perform particular actions on a group of WebSphere Commerce resources. Unless authorized through one or more access control policies, users have no access to any functions. Access control policies grant authorization to a specific group of users to perform particular actions on resources in a specified resource group. An access control policy consists of four parts: •
Access group: The group of users to which the policy applies.
•
Action group: A group of actions.
•
Resource group: The resources controlled by the policy. A resource group may include business objects such as contract or order, or a set of related commands.
•
Relationship (optional): Each resource type can have a set of relationships associated with it. Each resource can have a set of users that fulfill each relationship.
– Policy groups Different organizations in an e-commerce site require different sets of access control policies. For example, a seller organization would require
Chapter 2. Runtime architecture
37
shopping-related policies, while a buyer organization would not need them. In order to accomplish this type of requirement, in WebSphere Commerce, access control policies are partitioned into access control policy groups. In order for an access control policy to be applied in the site, it must belong to an access control policy group. Then, based on their business and access control requirements, organizations subscribe to the appropriate access control policy groups. Session control WebSphere Commerce is a WebSphere application that is based on the J2EE specification. For this reason, WebSphere Commerce follows the servlet specification for session management. – Session manager: You can configure WebSphere Commerce session manager from the Session Management tab via the Configuration Manager to use either WebSphere Commerce or WebSphere Application Server. The WebSphere Commerce session manager offers better performance, but does not allow extra information to be added to the session and the WebSphere Application Server does. – Session types: WebSphere Commerce supports two types of session management: cookie based and URL rewriting. For security reasons, cookie-based session management uses two types of cookies: non-secure session cookies, which are used to manage the session data, and secure authentication cookies used to manage authentication data.
Single sign-on WebSphere Commerce supports single sign-on when configured with an LDAP directory.
38
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
2.3.2 Catalog subsystem The Catalog subsystem provides online catalog navigation, merchandising features, interest lists, and search capabilities. The Catalog subsystem includes all logic and data relevant to a catalog, including categories, products and their attributes, items, and any associations or relationships among them. It interacts with the Member subsystems and the Order subsystems to obtain information about viewing templates and pricing. The following features are provided: Groupings A generic grouping construct is introduced for categorizations of various products. The owner of a catalog group may not necessarily be the owner of all the catalog entries in the group. This allows portal owners to define the categories of products offered while other suppliers can add their products to the catalog group. Catalog entries One or more catalog entries can belong to a catalog group. A set of base object types is provided to represent products, stock keeping unit (SKU) items, packages, and bundles in a catalog entry. Merchandising associations These make it possible to create an association between any two catalog objects, which become cross-sells, up-sells, and promotions. Globalization support The catalog design addresses the requirement to support multicultural features such as product display and currency format according to the locale.
2.3.3 Trading subsystem The Trading subsystem in WebSphere Commerce provides the logic, function and data relevant for negotiating the price and quantity of a product or set of products between the buyer and seller organization. For the Professional Edition, the trading subsystem includes auctions. For the Business Edition, the trading subsystem includes auctions, contracts, and Request for Quote (RFQ) components that are used to carry out specific transactions between organizations.
Chapter 2. Runtime architecture
39
2.3.4 Order subsystem The Order subsystem is a component of the WebSphere Commerce Server that provides shopping carts, order processing, and order management function support. Related services, such as pricing, taxation, payment, inventory, and fulfillment, are also part of the order subsystem. Order processing capabilities include quick order or buy, scheduled orders, multiple pending orders, reorders, and splitting or back orders.
2.3.5 Merchandising subsystem The Merchandising subsystem is a component of the WebSphere Commerce Server that provides functionality for cross-selling, up-selling, suggested accessories, and merchandising associations between products in the catalog.
2.3.6 Marketing subsystem The Marketing subsystem is a component of the WebSphere Commerce Server, and provides numerous marketing concepts to your site. Components of the marketing subsystem provide functionality to create marketing campaigns including product recommendations, advertisements, and electronic coupons, discounts, customer profiles, and collaboration.
2.3.7 Inventory subsystem The Inventory subsystem provides real-time inventory management. Components of the inventory subsystem provide functionality to record inventory received from vendors and that is returned by customers, adjust inventory quantity, determine the disposition of returned inventory, and ship and receive inventory.
2.3.8 Messaging subsystem The Messaging system provides WebSphere Commerce with the ability to communicate externally. This communication includes sending messages to and receiving messages from back-end systems or external systems, as well as sending notification to customers and administrators that events have occurred within WebSphere Commerce. This is accomplished through two subsystems: an inbound system that manages inbound messages coming from back-end and external systems, and an outbound messaging system that allows you to send notification to users as well as outbound messages to back-end systems and external systems.
40
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
For example, you can set up the messaging system to send e-mail messages notifying your customers that their orders have been shipped. The messaging system provides a mechanism for integrating WebSphere Commerce with back-end systems. You can configure WebSphere Commerce to send an outbound message to a back-end system whenever an order is created at your store. This order information can be used by the back-end system to do necessary order fulfillment processing. The back-end system can later send order status messages back to WebSphere Commerce indicating that order delivery has taken place or an order invoice has been issued. E-mail can also be sent to update the customer.
2.4 Runtime topology selection IBM WebSphere Commerce V5.5 leverages the runtime architecture of the IBM WebSphere Application Server V5 base edition and Network Deployment Edition. The terms runtime architecture, runtime environment and runtime topology are synonymous in this redbook. In this section, we describe the criteria used to select the appropriate topology for your business needs, highlight the benefits of the supported WebSphere Commerce runtime topologies, and provide a mapping to information on implementing the desired runtime topology.
2.4.1 Runtime topology selection criteria A variety of factors come into play when considering the appropriate topology, or configuration, for a WebSphere Commerce deployment. The selection criteria typically include a review of your requirements in the following areas:
Security Performance Throughput Scalability Availability Maintainability Session management Topology selection criteria summary
This section reviews these factors, their availability, and support provided by the IBM WebSphere Application Server base edition and IBM WebSphere Application Server Network Deployment Edition.
Security Security concerns usually require a physical separation of the Web server from the application server processes, typically across one or more firewalls. A
Chapter 2. Runtime architecture
41
common configuration would be the use of two firewalls to create a demilitarized zone (DMZ). Information in the DMZ has some protection based on protocol filtering between the Internet and the DMZ. A Web server intercepts the requests and forwards them on through the next firewall. The sensitive portions of the application and business data reside behind the second firewall, which filters based on IP addresses or domains.
Performance Performance involves minimizing the response time for a given transaction load. Although a number of factors relating to application design can affect performance, one or both of the following techniques are commonly used: Vertical scaling Involves creating additional application server processes on a single physical machine, providing for software/application server failover as well as load balancing across multiple JVM (application server processes). Vertical scaling allows an administrator to profile an existing application server for bottlenecks in performance, and potentially use additional application servers, on the same machine, to get around these performance issues. Horizontal scaling Involves creating additional application server processes on multiple physical machines to take advantage of the additional processing power available on each machine. This provides hardware failover support and allows an administrator to spread the cost of an implementation across multiple physical machines.
Throughput Throughput, while related to performance, involves the creation of a number of application server instances to service the same requests. IBM WebSphere Application Server Network Deployment provides clusters, which logically group a number of application servers. The application servers are added through vertical and/or horizontal scaling. .
Note: There is no longer the concept of server groups and clones, as in WebSphere Application Server V4.0. Now each application server cooperates in a cluster, as a cluster member.
42
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Scalability Multiple machines can be configured to add processing power, improve security, maximize availability, and balance workloads. The components that provide functions for configuring scalability include: WebSphere Application Server cluster support Clusters allow the creation of a logical group of servers that all host and run the same application(s). Members of a cluster can be located on the same machine (vertical scaling) and/or across multiple machines (horizontal scaling). The use of application server clusters can improve the performance of a server, simplify its administration, and enable the use of workload management. However, an administrator will need to assess whether the cost of implementing a clustered configuration (network traffic, performance) outweighs the benefits of a clustered environment. For more details, see IBM WebSphere V5.0 Applications: Ensuring High Performance and Scalability, SG24-6198. WebSphere workload management (WLM) Incoming processing requests from clients are transparently distributed among the clustered application servers. WLM enables both load balancing and failover, improving the reliability and scalability of WebSphere applications. Note: IBM WebSphere Application Server Network Deployment provides three types of workload management (WLM): Web server WLM Uses the Load Balancer feature from Edge Components as an IP sprayer to distribute HTTP requests across Web servers. Web server plug-in WLM Distributes servlet requests across Web containers. Enterprise Java Services (EJS) WLM Distributes EJB requests across EJB containers. IP sprayer Transparently redirects incoming HTTP requests from Web clients to a group of Web servers. Although the clients behave as if they are communicating directly with a given Web server, the IP sprayer is actually intercepting all requests and distributing them among all the available Web servers in the group. IP sprayers (such as the Load Balancer component of Edge
Chapter 2. Runtime architecture
43
Components or Cisco Local Director) can provide scalability, load balancing, and failover for Web servers.
Availability To avoid a single point of failure and maximize system availability, the topology must have some degree of process redundancy. High-availability topologies typically involve horizontal scaling across multiple machines. Vertical scaling can improve availability by creating multiple processes, but the machine itself becomes a point of failure. In addition, an IP sprayer can direct client HTTP requests to available Web servers, bypassing any that are offline. Another server can back up the IP sprayer, which eliminates it as a single point of failure. Improved availability is one of the key benefits of scaling up to multiple machines. IBM WebSphere Application Server Network Deployment provides tools that let you manage availability by distributing critical functionality across multiple machines. Applications hosted on multiple machines generally have less down time and are able to service client requests more consistently. The following commonly used techniques can be combined to take advantage of the best features of each and create a highly available system.
Hardware and process redundancy Eliminate the single points of failure in a system by including hardware and process redundancy as follows: Use horizontal scaling to distribute application servers across multiple physical machines. If a hardware or process failure occurs, cluster application servers are still available to handle client requests. Web servers and IP sprayers can also benefit from horizontal scaling. Use backup servers for databases, Web servers, IP sprayers, and other important resources. This ensures that they remain available if a hardware or process failure occurs. Deploy an application in multiple cells. If an entire cell goes offline, the other cells are still available to handle client requests.
44
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Process isolation Provide process isolation so that failing servers do not negatively impact the remaining healthy servers of a configuration. The following configurations provide some degree of process isolation: Deploy the Web server onto a different machine from the application servers. This ensures that problems with the application servers do not affect the Web server, and vice versa. Use horizontal scaling, which physically separates application server processes onto different machines. Deploy an application in multiple cells. Problems are confined to one cell while the other cells remain available.
Load balancing Use load-balancing techniques to make sure that individual servers are not overwhelmed with client requests. These techniques include: Use of an IP sprayer to distribute requests to the Web servers in the configuration. Directing requests from high-traffic Web sites to more powerful servers. The Edge Components included with IBM WebSphere Application Server Network Deployment provide these features.
Failover support The application must continue to process client requests when servers are stopped or restarted. Ways to provide failover support include: Use horizontal scaling with workload management to take advantage of its failover support. Use the HTTP transport to distribute client requests among application servers.
Hardware-based high availability In most cases there is very little to be gained by configuring WebSphere to work in conjunction with a hardware-based high-availability product, for example HACMP, Sun Cluster, or MC/ServiceGuard. The only case where a hardware-based HA solution would provide value is where WebSphere serves as the coordinator of a distributed (two-phase commit) transaction. In all other cases, the cluster capabilities inherent in Network Deployment should be sufficient to provide high availability of the WebSphere runtime.
Chapter 2. Runtime architecture
45
Maintainability The topology affects the ease with which system hardware and software can be updated. For instance, using multiple WebSphere cells or horizontal scaling can make a system easier to maintain because individual machines can be taken offline without interrupting other machines running the application. Sometimes maintainability conflicts with other topology considerations. For example, limiting the number of application server instances makes the application easier to maintain but can have a negative effect on throughput, availability, and performance. When deciding how much vertical and/or horizontal scaling is to be used in a topology, consideration needs to be made for hardware upgrades, for example, adding or upgrading CPUs and memory.
Session management Unless only a single application server is used, or the application is completely stateless, maintaining session state between HTTP client requests will also be a factor in determining the chosen topology. Network Deployment provides two different functions for the sharing of sessions between multiple application server processes: Database persistence Session data is persisted to a database shared by the application servers. Memory-to-memory replication Provides replication of session data between the memories of different application server JVMs. A JMS publish/subscribe mechanism, called WebSphere Internal Messaging, is used to provide assured session replication between the JVM processes, by leveraging the internal JMS provider provided with WebSphere Application Server. This means that a database product is not required for persistence. Memory-to-memory replication is faster, by virtue of the high-performance messaging implementation used by WebSphere V5.0. However, it is only available in the Network Deployment environment. Note: This mechanism is new to IBM WebSphere Application Server Network Deployment V5.0. Prior versions of WebSphere provided persistence of the session to a database only. In addition, the configuration of any IP sprayers (such as provided with the Edge Components) needs to be considered when session state is a factor.
46
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Within WebSphere Commerce, there are two methods of session control for applications, cookie-based and URL rewriting, which are described in “Member security services” on page 36.
Topology selection criteria summary The preceding factors are not mutually exclusive. They can be combined in many different ways. Table 2-1 provides a summary of the topology selection criteria available with IBM WebSphere Application Server Network Deployment. Table 2-1 Topology selection summary Topology
Security
Performance
Throughput
Maintainability
Availability
Session
Vertical scaling
Limited benefit
Limited to resources on a single machine
Easiest to maintain
Process isolation
Required
Horizontal scaling
Best in general
Best in general
Code migration to multiple nodes
Process and hardware redundancy
Required
HTTP separation
Allow for firewalls and DMZs
Usually better than local
Usually better than local
Three tiers
Most options for firewalls
Typically slower than single JVM API
Clustering can improve throughput
One cell
Ease of maintenance
Multiple cells
Harder to maintain than single cell
Process, hardware and software redundancy
2.4.2 WebSphere Commerce runtime topologies This section provides a graphical view of various runtime topologies supported by WebSphere Commerce, and highlights the advantages and disadvantages of each of the following topologies: Single-tier
Chapter 2. Runtime architecture
47
Two-tier remote Database server node Two-tier remote Web Server redirector node Three-tier Vertical application server cluster Load balanced horizontal Web and application server cluster
Terminology The illustrations used to represent each topology will include boxes that represent logical runtime functions. The terminology used is taken from the Patterns for e-business Web site at: http://www.ibm.com/developerworks/patterns
Note: In the Patterns for e-business, a runtime node represents a logical function. That node may actually be implemented using multiple physical machines. Do not confuse that with the concept of a physical node in WebSphere. Network zones The runtime environments (topologies) depicted in this section are separated into network zones for security reasons. The network zones are as follows: – Outsize world – Demilitarized zone (DMZ) – Internal network Domain and protocol firewalls A firewall is a hardware/software system that manages the flow of information between two networks. Firewalls can prevent unauthorized Internet users from accessing private networks connected to the Internet, especially intranets, and can block some virus attacks - as long as those viruses are coming from the Internet. Load balance node The load balancer node provides horizontal scalability by dispatching HTTP requests among several identically configured Web server or Web server redirector nodes. Using a load balancer may introduce the need to ensure session affinity. In these topologies, the load balancer node is implemented using the Edge Components included with the IBM WebSphere Application Server V5, Network Deployment Edition. Web server redirector node A Web server redirector node includes the HTTP Server and the WebSphere plug-in. This type of node typically is used to serve static HTML pages and
48
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
images, and to redirect application requests via the WebSphere plug-in to the WebSphere Application Server. In most of the topologies seen in this section, the Web server redirector node will be located in the DMZ. Directory and security services node The directory and security services node supplies information on the location, capabilities, and attributes (including user ID/password pairs and certificates) of resources and users known to this Web application system. This node can supply information for various security services (authentication and authorization) and can also perform the actual security processing, for example, to verify certificates. The authentication in most current designs validates the access to the Web application server part of the Web server, but this node also authenticates for access to the database server. In these topologies, the directory and security services node is implemented using the IBM Directory Server V4.1. Database server node The function of this node is to provide a persistent data storage and retrieval in support of the user-to-business transactional interaction. The data stored is relevant to the specific business interaction, for example bank balance, insurance information, and current purchase by the user. It is important to note that the mode of database access is perhaps the most important factor determining the performance of this Web application, in all but the simplest cases. The recommended approach is to collapse the database accesses into single or very few calls. One approach for achieving this is by coding and invoking stored procedure calls on the database. Both IBM DB2 UDB V8.1 Enterprise Server Edition and Oracle9i Standard and Enterprise Edition Release 2 are supported by IBM WebSphere Commerce V5.5. Deployment Manager In a WebSphere Application Server V5, Network Deployment Edition environment, the Deployment Manager is the focal point for configuration and operation. Though not technically a defined Patterns for e-business runtime node, it is important to this discussion to depict this node in the topologies. For each of the topologies, a decision needs to be made regarding the placement of the Deployment Manager and master cell repository. The Deployment Manager can be located on a dedicated machine or it can co-exist with a WebSphere Application Server installation. We would recommend placing it on a dedicated machine.
Chapter 2. Runtime architecture
49
Single-tier A single-tier (also called 1-tier) configuration consists of all the runtime software components installed on a single physical machine. This is easiest to set up and would be suitable as a development or test environment. It would not, in most cases, satisfy the scalability, security and availability requirements of a production site unless you are using a high-end IBM zSeries or iSeries server. The only way to scale with this type of configuration is to scale vertically by adding memory, disk space, processors to the server, and in the most extreme cases, upgrading the server to a more powerful system. A simple single-tier system is shown in Figure 2-3.
Internal network
I N T E R N E T
HTTP HTTPS
Firewall
Outside world
WebSphere Commerce node
application databases
Figure 2-3 WebSphere Commerce single-tier topology
Two-tier remote Database server node In a two-tier remote database server configuration, the database is installed on a separate database server node, as seen in Figure 2-4 on page 51. Separating the database server from the WebSphere Commerce node provides for greater scalability and security by having the ability to add a firewall between the nodes.
50
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
HTTP HTTPS
Protocol Firewall
I N T E R N E T
WebSphere Com m erce node
Internal netw ork
HTTP HTTPS
Domain Firewall
DMZ
O utside w orld
Database server node
application databases
Figure 2-4 WebSphere Commerce two-tier remote database server runtime environment
Two-tier remote Web Server redirector node In a two-tier (also called 2-tier) remote Web server configuration, the Web server is installed on a separate node from the WebSphere Commerce node, as seen in Figure 2-4. The remote Web Server node provides for greater scalability and security. In the case of the remote Web server two-tier, the application assets of the WebSphere Commerce node are further protected by being behind an additional firewall. Only the Web server is accessible via HTTP or HTTPS through the firewall by Internet users.
Chapter 2. Runtime architecture
51
H TT P H TTP S
Protocol Firewall
I N T E R N E T
W eb serv er red irec to r no de H TT P S erver W eb S p here plu g in
In tern al n e tw o rk
H TT P H TT P S
Domain Firewall
DMZ
O u tsid e w o rld
W eb S p he re W eb C o m m erce S erver n od e
a pplication d atabases
Figure 2-5 WebSphere Commerce two-tier remote Web server redirector topology
The two-tier remote Web server topology includes the HTTP Server and the WebSphere plug-in. HTTP server separation topologies physically separate the HTTP (Web) server from the application servers, typically to place the HTTP server in a DMZ. Using a DMZ provides an additional layer of security for back-end servers and data. The Web server redirector node is used to serve static HTML pages and images, and to redirect application requests to application servers on remote systems using the HTTP or HTTPS protocol.
Three-tier A three-tier topology (also called 3-tier) separates the Web server redirector node, WebSphere Commerce node, and Database server nodes, as shown in Figure 2-6 on page 53. The primary reasons for implementing a three-tier topology are security and scalability.
52
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
HTTP HTTPS
DMZ
Web server redirector node HTTP Server
Internal network
HTTP HTTPS
WebSphere plugin
Domain Firewall
I N T E R N E T
Protocol Firewall
Outside world
WebSphere Web Commerce Server node
Database server node
application databases
Figure 2-6 WebSphere Commerce three-tier topology
Figure 2-7 on page 54 depicts a variation of WebSphere Commerce three-tier topology, where the WebSphere Commerce Payments node is separate from the WebSphere Commerce node.
Chapter 2. Runtime architecture
53
HTTP HTTPS
Protocol Firewall
I N T E R N E T
Internal network
Web server redirector node HTTP Server WebSphere plugin
HTTP HTTPS
Domain Firewall
DMZ
Outside world
WebSphere Commerce node
WebSphere Commerce Payments node
Database server node
application databases
Figure 2-7 WebSphere Commerce three-tier with remote WebSphere Commerce Payments node
Vertical application server cluster Vertical scaling refers to configuring multiple application servers on a single machine, usually by creating a cluster of associated application servers all hosting the same application(s). When a WebSphere Commerce instance is created, a WebSphere Commerce application server is created and the enterprise application is deployed to it. The three-tier vertical application configuration is depicted in Figure 2-8 on page 55.
54
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
DMZ
O u ts id e w o rld
In te rn a l n e tw o r k
HTTP HTTPS
W e b s erve r r e d ir e c to r n o d e HTTP S e rv e r
HTTP H TTPS
W eb S p h ere p lu g -in
W e b S p h e re C o m m e rc e a p p lic a tio n s e rv e r 1
Domain Firewall Domain Firewall
I N T E R N E T
Protocol Firewall
W e b S p h e re C o m m e rc e n o d e
W e b S p h e re C o m m e rc e a p p lic a tio n s e rv e r 2
C lu s te r 1
D a ta b a s e server node
a p p lic a tio n d a ta b a s e s
D e p lo y m e n t M anager
W e b S p h e re C o m m e rc e P a ym e n ts a p p lic a tio n s e rv e r
Figure 2-8 Vertical scaling with clusters
There are a few key points to reference from Figure 2-8. First, there is a one-to-one relationship between a WebSphere Commerce instance or cluster (vertical or horizontal) and the WebSphere Commerce Payments instance (application server). Second, a WebSphere Commerce Payments instance cannot be a member of a cluster. Third, in previous releases of WebSphere Application Server an additional server in a vertical cluster was known as a clone. The IBM WebSphere Application Server V5, Network Deployment Edition, Deployment Manager is used to manage the application servers in the vertical or horizontal cluster.
Advantages Vertical scaling has the following advantages: Efficient use of machine processing power. An instance of an application server runs in a single Java virtual machine (JVM) process. However, the inherent concurrency limitations of a JVM process prevent it from fully utilizing the processing power of a machine. Creating additional JVM processes provides multiple thread pools, each corresponding to the JVM associated with each application server process. This avoids concurrency limitations and lets the application server use the full processing power of the machine. Load balancing. Vertical scaling topologies can make use of the WebSphere workload management.
Chapter 2. Runtime architecture
55
Process failover. Vertical scaling can provide failover support among application servers of a cluster. If one application server instance goes offline, the other instances on the machine continue to process client requests.
Disadvantages Single machine vertical scaling topologies have the drawback of introducing the host machine as a single point of failure in the system.
Load balanced horizontal Web and application server cluster Load-balancing products can be used to distribute HTTP requests among application server instances that are running on multiple physical machines. The Network Dispatcher component of Edge Components is an IP sprayer that performs intelligent load balancing among Web servers using server availability, capability, workload, and other criteria. Figure 2-9 depicts a simple load-balanced Web server cluster and application server cluster to distribute requests among application servers on multiple machines. In this example, the Web servers are installed on the same node as the application servers. The Web server (cluster) can be on separate systems from the application servers. Outside world
Internal network
DMZ
HTTP/ HTTPS
Load Balancer node
Backup Load Balancer node
Domain Firewall
I N T E R N E T
Protocol ProtocolFirewall Firewall
HTTP/ HTTPS
WebSphere Commerce node application Web server 1 Server 1 WebSphere plugin
WebSphere Commerce node application server 2
Web Server 2 WebSphere plugin
Directory & Security services LDAP Database server Application data Deployment Manager
Figure 2-9 Simple IP sprayer-based horizontally scaled topology
A backup node for the load balancer node is normally configured in order to eliminate it as a single point of failure.
56
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Note: In an IP sprayer (or similarly configured) topology, each Web server can be configured to perform workload management over all application servers in a specific cluster. In this configuration, session affinity will be preserved, no matter which Web server is passed the request by the IP sprayer. Horizontal scaling exists when the members of an application server cluster are located across multiple physical machines. This lets a single application span several machines, yet still present a single logical image. The Web server plug-in distributes requests to cluster member application servers on the application server nodes. The Network Dispatcher component of Edge Components, which can distribute client HTTP requests, can be combined with clustering to reap the benefits of both types of horizontal scaling.
Advantages Horizontal scaling using clusters has the following advantages: Provides the increased throughput of vertical scaling topologies but also provides failover support. This topology allows handling of application server process failures and hardware failures without significant interruption to client service. Optimizes the distribution of client requests through mechanisms such as workload management or remote HTTP transport.
Disadvantages Horizontal scaling using clusters has the following disadvantage: Increased maintenance effort.
2.4.3 Topology mapping to implementation details Table 2-2 includes a summary of various supported WebSphere Commerce runtime topologies and where to find information to implement the topology. Table 2-2 Topology summary ad map to implementation details Topology
Information
Single-tier
* IBM WebSphere Commerce product installation guides by platform * 16.2, “Single-tier implementation” on page 559 on Windows
Chapter 2. Runtime architecture
57
Topology
Information
Two-tier remote Database server node
* IBM WebSphere Commerce product installation guides by platform * 16.3, “Add a remote Database Server node” on page 582 on Windows * Chapter 19, “OS/400: Two-tier remote database server” on page 755
Two-tier remote Web Server redirector node
* IBM WebSphere Commerce product installation guides by platform * 16.4, “Add remote Web Server node” on page 587 on Windows
Three-tier
* IBM WebSphere Commerce product installation guides by platform * Chapter 16, “Windows: Migrate a single-tier to a multi-tier” on page 553 * Chapter 17, “Solaris: Three-tier environment using Oracle9i and Sun ONE Web Server” on page 599 * Chapter 18, “AIX: Three-tier using DB2 and IBM HTTP Server” on page 675*
Vertical application server cluster
* IBM WebSphere Commerce product installation guides by platform * IBM WebSphere V5 Edge of Network Patterns, SG24-6896 * IBM WebSphere Application Server V5.0 Systems Management and Configuration: WebSphere Handbook Series, SG24-6195 * WebSphere V5.0 Applications: Ensuring High Performance and Scalability, SG24-6198
Load balanced horizontal Web and application server cluster
* IBM WebSphere Commerce product installation guides by platform * IBM WebSphere V5 Edge of Network Patterns, SG24-6896 * IBM WebSphere Application Server V5.0 Systems Management and Configuration: WebSphere Handbook Series, SG24-6195 * WebSphere V5.0 Applications: Ensuring High Performance and Scalability, SG24-6198
2.5 For more information Refer to the following product guides for additional information on the WebSphere Commerce architecture: Fundamentals Guide, IBM WebSphere Commerce V5.5 WebSphere Commerce V5.5 online documentation Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 IBM WebSphere Commerce product installation guides: – Microsoft Windows •
Quick Beginnings Guide for Windows 2000, IBM WebSphere Commerce V5.5
•
Installation Guide, IBM WebSphere Commerce V5.5 for Windows 2000
– UNIX (IBM AIX and SUN Solaris)
58
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
•
Quick Beginnings Guide for AIX, IBM WebSphere Commerce V5.5
•
Quick Beginnings Guide for Solaris, IBM WebSphere Commerce V5.5
•
Installation Guide, IBM WebSphere Commerce V5.5 for UNIX Systems
– IBM OS/400 •
Quick Beginnings Guide for OS/400, IBM WebSphere Commerce V5.5
•
Installation Guide, IBM WebSphere Commerce V5.5 for OS/400
IBM WebSphere Application Server V5.0 Systems Management and Configuration: WebSphere Handbook Series, SG24-6195 WebSphere V5.0 Applications: Ensuring High Performance and Scalability, SG24-6198 IBM WebSphere V5 Edge of Network Patterns, SG24-6896
Chapter 2. Runtime architecture
59
60
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
3
Chapter 3.
Business and store models One of the most significant advances in IBM WebSphere Commerce V5.5, Business Edition is the addition of several new business models and supporting infrastructure. The new business models include Hosting, and value chains for the Demand Chain and Supply Chain models, as well as enhancements to the B2B direct and consumer direct models. This chapter describes the business models, the sample store instantiations of the business models, and the infrastructure added to support the new models. In addition, we analyze the components of the sample stores and describe the new options available for store publishing. This chapter is organized into the following topics:
Business and store models Business model infrastructure and architecture Store architecture For more information
© Copyright IBM Corp. 2003. All rights reserved.
61
3.1 Business and store models IBM WebSphere Commerce V5.5, Business Edition includes all the features of the Professional Edition, plus additional support for B2B, including the new business models for hosting, and value chains (demand and supply). Table 3-1 provides a summary of the business models and corresponding sample store model listed by the supported WebSphere Commerce edition. The sample stores are packaged in a store archive file for deployment. In Table 3-1 we have listed the composite store archive name for the sample store. In WebSphere Commerce V5.5, there is a new concept of composite or all contents of the store archive and component store archives containing a subset of functionality of the sample store model. We describe this concept in greater detail throughout the chapter. Table 3-1 Summary of business and store models Business model name
Store model name
Composite store archive name
Professional Edition
Business Edition
Consumer direct (B2C)
FashionFlow
ConsumerDirect.sar
X
X
B2B Direct
ToolTech
B2BDirect.sar
X
Hosting
Hosting
Hosting.sar
X
Demand Chain
Demand Chain
DemandChain.sar
X
Supply Chain
Supply Chain
SupplyChain.sar
X
Note: For more detailed on each of the sample store models, refer to the Sample Store Guide, IBM WebSphere Commerce V5.5 product guide. IBM WebSphere Commerce V5.5 provides the architecture infrastructure to support the business models. The business models are categorized as follows: Direct sales – Consumer direct – B2B direct Hosting Value chains – Demand Chain – Supply Chain
62
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
3.1.1 Direct sales Both the consumer direct and B2B direct are direct sales business models. In this section we describe the distinguishing features of each. Note: The IBM WebSphere Commerce V5.5, Professional Edition only supports the consumer direct business model.
Consumer direct Consumer direct supports commerce transactions involving products, services, or information between businesses and consumers. Consumers typically purchase goods or services directly from a business. Consumer direct is commonly known in the industry as business-to-consumer (B2C) commerce. Figure 3-1 depicts the interaction of consumer-oriented customers (shoppers) with a retail e-commerce site. The consumer direct model is included in the WebSphere Commerce Professional and Business Editions. All other models are only supported by the Business Edition.
Customers
Customers shop at the retailer.
Retailer
Figure 3-1 Consumer direct business model
In a typical consumer direct business, customers buy directly from the business, usually a retailer, as seen in Figure 3-1. The business can be a retailer, a manufacturer that sells its goods directly to consumers through their own retail outlet, or any other business that sells goods or provides services directly to consumers. For example, a business that sells to consumers directly through a catalog would be considered a consumer direct business. Organizations that are not traditionally considered businesses, such as governments, can also be considered consumer direct businesses. Governments may provide goods and services directly to customers.
B2B direct The B2B direct model supports commerce transactions involving products, services, or information between two businesses or parties. Typical B2B direct transactions occur between buyers, suppliers, manufacturers, resellers, distributors, and trading partners. Figure 3-2 on page 64 depicts the interaction of business customers with a business direct e-commerce site.
Chapter 3. Business and store models
63
Business
Buyers from one business purchase goods or services from another.
Business
Figure 3-2 B2B direct business model
In a typical B2B direct business, businesses purchase goods or services directly from another business. The selling business can be a wholesaler, a distributor, a manufacturer, or a retailer who sells to buyers from other businesses. Organizations that are not traditionally considered businesses, such as governments and the media, can also be considered B2B direct businesses. Governments may provide goods and services directly to businesses.
3.1.2 Hosting The hosting model supports hosting of merchants or other businesses by an Internet Service Provider (ISP) or other hosting provider. There are two possible sides to the hosting business: Hosted stores Site that allows customers to locate the stores that are hosted by the provider (optional) In order to manage relationships with the hosted stores, hosting models usually include a hub (known in WebSphere Commerce as a hub store). This hub provides self-provisioning tools that allows the merchant to create and administer a store, as well as tools that allow the hosting provider to manage all hosted stores. Hosting providers typically include a store in which customers can find and access the stores hosted by the provider. Figure 3-3 on page 65 depicts both merchants and customers interacting with the hosted stores of an Internet Service Provider (ISP).
64
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Merchant
Customers
Host (Internet Service Provider or other)
Merchant
Host (Internet Service Provider or other)
Figure 3-3 Hosting business model variations
As seen in Figure 3-3, the merchant enters the host’s site and creates a store that will be hosted by the site. Hosting providers often provide merchants with simple self-provisioning tools that allow the merchant to administer a hosted store. When a hosted store is open for e-business, customers can access the store via the host’s site or by entering the hosted store directly. In this example, the customer has the option of entering the hosted store or business directly or browsing the host’s site and then being transferred to the hosted store or business. Hosted stores are very similar to consumer direct stores. For specific differences between the two, as implemented in the WebSphere Commerce sample stores, see the Sample Store Guide, IBM WebSphere Commerce V5.5 product guide.
3.1.3 Value chains New to WebSphere Commerce Version 5.5 is the ability to enable online business transactions involving multiple enterprises. Value chains support transactions involving multiple enterprises or parties. Products, goods, services, or information are delivered through the parties of the value chain from producers to end users. A value chain also has relationship and administrative aspects, that is, you can manage the relationship of the partners or enterprises in your value chain, as well as offer some administrative services to those parties. As a result, value chains must manage the two sides of their businesses: their customers and direct sales, and their channel partners and suppliers. Each of these sides requires its own management channels and practices. In order to manage their relationships with partners or suppliers, value chain business models usually include a hub (in WebSphere Commerce known as a hub store). Value chain administrators can administer the operational aspects of
Chapter 3. Business and store models
65
the value chain in the hub store, including enabling partners or suppliers to participate in the value chain, that is, registering them, setting them up, creating collaborations. Partners and suppliers can also access the hub store to complete administrative tasks such as registering users. In order to sell directly to customers (direct sales), value chains usually include a store front, where customers can purchase their good or services directly. WebSphere Commerce supports the transactions through, and relationship management of the following two types of value chains: Demand Chain Supply Chain Figure 3-4 provides an overview of the partners and relationships supported by value chains.
Value chains
Demand chain
Indirect sales (selling through channels)
Consumer direct
Direct sales
B2B direct
Supply chain
Procurement
Strategic sourcing
Sourcing
Private marketplace
Figure 3-4 Value chain business models
Demand Chain A Demand Chain is composed of the enterprises that sell a business’s goods or services. For example, a Demand Chain may be composed of buyers who initiate the sales transaction, the resellers who sell the manufacturer’s goods, and the manufacturer who creates the goods. Alternatively, a Demand Chain may be composed of the resellers who sell a manufacturer’s goods, the manufacturer who makes the goods, and the distributors who supply the manufacturer’s goods
66
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
to the resellers. Demand Chains also support direct sales channels, in which the Demand Chain owner sells directly to customers or partners itself. There are several types of Demand Chains. We have listed the following for reference: Demand Chain hosting: buyers, resellers, manufacturer Demand Chain hosting: resellers, manufacturer, distributor Other Demand Chain scenarios
Demand Chain hosting: buyers, resellers, manufacturer The Demand Chain owner may host stores for its channel partners (for example, resellers or distributors). Figure 3-5 depicts an example of a Demand Chain between buyers, channel partners, and manufacturer. In this example, buyers purchase goods from a manufacturer’s resellers (channel partners). Resellers, in turn, obtain the goods from the manufacturer via the manufacturer’s hub. Note: The resellers may be hosted by the manufacturer or be remote.
Buyers
Channel Partners (Resellers)
Manufacturers or Distributors
Figure 3-5 Demand Chain hosting (hosting for channel partners)
Demand Chain hosting: resellers, manufacturer, distributor In this example, the manufacturer provides a hub for their channel partners including resellers. Resellers and other channel partners may be able to do several functions in this hub, including locating distributors of the manufacturer’s goods. In order to locate suppliers, the reseller may browse a product catalog in the private hub. If the desired products are available from more than one distributor, the reseller can check product availability, distributors’ location, and prices for various distributors. Then, if the reseller chooses, they can split their order between several distributors. The order is then sent to the distributor, who completes the transaction and delivers the goods or services to the reseller. The reseller then sells the goods or services directly to the consumer. The Demand Chain sample store is an example of this reseller, manufacturer and distributor scenario.
Chapter 3. Business and store models
67
Note: The resellers may be hosted by the manufacturer or be remote.
Other Demand Chain scenarios There are many possible Demand Chain scenarios. The scenario details may change depending on the type of business being conducted. For example, if the enterprise is a manufacturer, the purpose of the hub may be to help the manufacturer’s resellers locate the manufacturer’s goods from several distributors. If the enterprise is a distributor, the purpose of the hub may be to help the distributor’s resellers find goods or services from several different suppliers.
Supply Chain business model A Supply Chain is composed of the enterprises that provide services to a business. WebSphere Commerce provides the architectural infrastructure to support Supply Chains that take the form of a private marketplace. A private marketplace provides a forum for vendors to offer their wares for sale. Buyers enter this forum and after browsing through the available options, select the appropriate goods or services. Note: The private marketplace does not support competitive bidding and counter-bidding or other methods of competition. The Supply Chain owner may host a stores for its suppliers.
Buyer
Private marketplace
Supplier
Figure 3-6 Supply Chain business model
Figure 3-6 depicts a Supply Chain where the buyer enters the supplier’s hub to interact and browses the aggregated catalog in which products and offers from multiple suppliers are presented. The buyer can then select the desired offer or request quotes from multiple suppliers. The buyer also has the option of conducting business or procuring from online suppliers directly.
68
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
3.2 Business model infrastructure and architecture This section provides an overview of how the WebSphere Commerce infrastructure and architecture support the business models, including the following topics: Organization structure Access control model Business policy framework Note: The topics found in this section are a summary from the Store Development Guide, IBM WebSphere Commerce V5.5 product guide, which we strongly recommend that you read.
3.2.1 Organization structure The WebSphere Commerce organization structure provides a framework for the actors, or entities in the business scenario. The framework is organized in a hierarchical structure that mimics typical organizational hierarchies with entries for organizations and organizational units and users. The organizations and organizational units in the framework act as owners for the parts of your business. All parts of your business, including customers, administrators, stores, catalogs, and distributors, must be owned by an organization or organizational unit. The organization structure and the access control model, discussed in 3.2.2, “Access control model” on page 72, are closely related, in that the access control model applies access control policies to organizations rather than to individual entities (stores, customers, administrators and so on). The policies that apply to an entity (or resource) are applied to the organizations that own the entity or resource. Figure 3-7 on page 70 outlines the basic WebSphere Commerce organization structure. The basic organization structure is installed during instance creation, regardless of the business model.
Chapter 3. Business and store models
69
o=Root organization
Site Administrators
o=Default organization
Customers
Figure 3-7 WebSphere Commerce organization structure
Root organization The root organization is the top-level organization and is its own parent. All organizations in the WebSphere Commerce organization structure are descendents of the root organization. The site administrators are owned by the root organization. Default organization The default organization is owned by the root organization. All guest customers and all customers in a consumer direct scenario belong to the default organization. Customers in a B2B direct and value chain scenario can belong to either the default organization or other organizations. One or more other levels of organizational entities can exist beneath the parent organizational entities. You can add as many child organizational entities as necessary to support your business.
B2B direct model and organizational structure We have included a diagram and description of the B2B direct business model to explain how the organization structure supports the business model. For similar information on the other business models (consumer direct, hosting, Demand Chain, and Supply Chain), refer to the Store Development Guide, IBM WebSphere Commerce V5.5 product guide.
70
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
o=Root organization
Site Administrators
o=Default organization
o=Seller organization
Seller Administrators
o=Buyer organization
ou=Business Direct organization
Buyers
Business
Figure 3-8 B2B direct model organization structure
In order to place this business online, the entities in the preceding diagram must be assigned to the following organizations: Root organization All organizations in the business become descendents of the root organization. The site administrators who maintain the online site are owned by the root. – Default organization Unlike the consumer direct organization structure, the customers are not owned by the default organization. Instead the customers are buyers who are owned by the buyer organization. – Buyer organization Customers, known in B2B direct businesses as buyers, are assigned their own organization in the B2B direct organization structure.
Chapter 3. Business and store models
71
– Seller organization A seller organization is created to own all the organizations that own stores. The administrators who maintain the store’s functions (for example customer service representatives, catalog and product managers) are termed seller administrators and are owned directly by the seller organization. •
A child organizational unit (ou), B2B direct organization, is created under the seller organization to own the store (Business).
3.2.2 Access control model WebSphere Commerce allows you to determine, through access control, which tasks a particular user, be they customers, buyers, administrators, distributors, manufacturers, or suppliers, can perform in relation to your business. Note: For more detailed information on the access control model, refer to the Store Development Guide, IBM WebSphere Commerce V5.5 and Security Guide, IBM WebSphere Commerce V5.5 product guides. Access control in WebSphere Commerce is composed of the following elements: users, actions, resources, and relationships. Users are the people that use the system. For access control purposes, users must be grouped into relevant access groups. One common attribute that is used to determine membership of an access group is roles. Roles are assigned to users on a per organization basis. Some examples of access groups include registered customers, guest customers, or administrative groups such as customer service representatives. Actions are the activities that users can perform on the resource. For access control purposes, actions must also be grouped into relevant action groups. For example, a common action used in a store is a view. A view is invoked to display a store page to customers. The views used in your store must be declared as actions and assigned to an action group before they can be accessed. Resources are the entities that are protected. For example, if the action is a view, the resource to be protected is the command that invoked the view, for example com.ibm.commerce.command.ViewCommand. For access control purposes, resources are grouped into resource groups. Relationships are the relationship between the user and the resource. Access control policies may require that a relationship between the user and the resource be satisfied. For example, users may only be allowed to display the orders that they have created.
72
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Access control policies Access control policies authorize access groups to perform particular actions on the resources of WebSphere Commerce, as long as the users in the access group satisfy a particular relationship with respect to the resource. WebSphere Commerce provides over 300 default access control policies that are loaded during instance creation. These policies cover a wide range of common business activities, including order creation and processing, and trading, such as request for quotes and contracts (Business Edition). The default policies are documented in the Security Guide, IBM WebSphere Commerce V5.5 product guide.
Access control groups In order for an access control policy to be applied to your store or site, it must belong to an access control policy group and the policy group must be subscribed by the organization that owns the resource. By default, all access control policies provided with WebSphere Commerce are assigned to policy groups. For a list of default policies provided with WebSphere Commerce, see the Security Guide, IBM WebSphere Commerce V5.5 product guide. Although access control policy groups are owned by organizations, they are not automatically applied to the organization. An organization must subscribe to a policy group in order for the access control policies to apply to the organization. If the organization has child organizations, all policy groups the parent subscribes to are automatically applied to the child organizations. However, if the child organization subscribes directly to a policy group, the policy groups subscribed to by the parent organization no longer apply to the child. Note: Refer to the Store Development Guide, IBM WebSphere Commerce V5.5 for a comparison of access control between WebSphere Commerce V5.4 and V5.5.
Basic access control structure The WebSphere Commerce access control structure is flexible enough to support all entities in the supported business models. The diagrams in the following sections demonstrate how access control is applied to a typical example of each business model. The basic access control structure is installed during instance creation, regardless of the business model.
Chapter 3. Business and store models
73
Legend o=Root organization
Owns Subscribes Role
Site administrators have Site Administrator role Site administrators
o=Default organization
Guest shopper management policy group
Management and administration policy group
Common shopping policy group
B2B policy group
B2C policy group
Figure 3-9 Basic access control structure
The root organization owns the following default policy groups:
Management and administration Common shopping B2C B2B
However, the root organization only subscribes to the management and administration policy group. As a result, these policies apply to the site administrators, who are directly under the root. The policies in the management and administration policy group do not apply to the default organization through inheritance, since the default organization subscribes to the guest shopper management policy group. In order for the management and administration policies to apply, the default organization must subscribe to the management and administration policy group explicitly. The default organization owns the guest shopper management policy group. Note: For more detailed information on the default policy groups, see the appendix of the Security Guide, IBM WebSphere Commerce V5.5.
74
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
B2B direct access control structure The Store Development Guide, IBM WebSphere Commerce V5.5 includes diagrams and a description of the access control structure for each of the business models (consumer direct, B2B direct, hosting, Demand Chain, Supply Chain). This section includes a summary of the B2B direct access control structure for example purposes, as seen in Figure 3-10. Legend o=Root organization
Owns
Site administrators have ite Administrator role in the root organization.
Subscribes Role
Site administrators
o=Select organization
o=Default organization
Seller administrators
Guest shopper management access control policy group
Management and administration access control policy group
B2C policy group
Common shopping access contact policy group
B2B policy group
Tooltech policy group
o=Buyer A organization
ou=B2B direct organization
Buyers Store D
Figure 3-10 B2B direct access control structure
Figure 3-10 depicts a basic B2B direct organization structure where the root organization owns and subscribes to the default policy groups as described in “Basic access control structure” on page 73. The B2B direct organization
Chapter 3. Business and store models
75
subscribes directly to the B2B, management and administration, and the common shopping policy groups. The B2B direct organization also owns and subscribes to the ToolTech policy group. The ToolTech policy group contains the following policies: AllUsersForToolTechExecuteToolTechAllUsersViews RegisteredCustomersForOrgForToolTechExecuteToolTech RegisteredCustomerViews Buyers are customers that place orders in a B2Bdirect store. All buyers must be owned by a buyer organization. Typically, buyer organizations do not subscribe to any policy groups, since management and administration policies inherited from the root organization are sufficient. Since access control policy groups are subscribed by organizational entities, if you are creating multiple stores in your site, and want to apply different access control policy groups to individual stores, you must create separate organizations to own each store.
3.2.3 Business policy framework Business policies are sets of rules followed by a store or group of stores that define business processes, industry practices, the scope and characteristics of a store or group of stores offerings, and how the store or site interacts with customers and other business partners. For example, your site may have business policies determining when and how customers are allowed to return products to a store, or business policies that determine what payment methods your store accepts. WebSphere Commerce provides a framework that allows you to implement your store’s business policies in your online store or site. The business policy framework consists of the following parts:
Business policies Business accounts Contracts and service agreements Terms and conditions Business accounts
Business policies In most instances, you will have predefined business policies for your business that you need to implement in your online store or site. WebSphere Commerce provides a set of business policies that you can use as is, or change to meet your needs. For more information on the default business policies provided with WebSphere Commerce, see the WebSphere Commerce Production and
76
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Development online help. For information on how to edit these business policies, see the WebSphere Commerce Production and Development online help.
Business accounts Business accounts define the relationship between a customer and your business. Business accounts track contracts and orders for customer organizations and configure how buyers from customer organizations shop in a store.
Contracts and service agreements Before a customer or business partner (for example resellers or distributors) can access your store, you must create a contract or service agreement that defines customer or business partner access to your store. In the WebSphere Commerce business policy framework, you create contracts for customers and service agreements for other types of business partners. Contracts: A contract with a customer defines what areas of your store the customer can access, what prices the customer will see, and for how long the customer has access to your site and those prices. All stores must contain at least one contract, because without a contract no one but internal administrators can access your store. WebSphere Commerce provides a default contract that applies to all customers shopping at a store. In WebSphere Commerce Professional Edition, the default contract is the only supported contract. Service agreements: A service agreement with a business partner (business partners may be resellers, distributors, manufacturers, suppliers, or other partners) defines your arrangement with the business partner. For example a service agreement with a reseller may define what access the reseller has to your site, whether they can share your catalog, or whether you host a store for them. A service agreement with a distributor may define how customers to your site can receive quotes from a distributor, or how customers can access the distributor’s site from yours.
Terms and conditions Terms and conditions define how contracts and service agreements are implemented for a particular customer or business partner. For contracts, terms and conditions may define what is being sold under the contract, the price of the items being sold, how the items are shipped to the customer, and how the customer pays for the order. For service agreements with business partners, terms and conditions may restrict the products the business partner is allowed to sell. Terms and conditions usually reference business policies, since most aspects of a site or stores operations are defined by business policies. Terms and conditions
Chapter 3. Business and store models
77
provide standard parameters for the business polices they reference. Providing parameters to the business policies allows you to modify the behavior of business policies for each contract.
3.3 Store architecture As IT architects and IT specialists, it is great to build a scalable and secure runtime, but if you do not have an online store that customers are happy with, the rest is pointless. After all, e-commerce is focused around selling goods and services from the online store. In this section, we explore store architecture, including the assets of a store, sample store models and packaging, store data assets, customizing a store, and options for publishing a store to the runtime environment. Note: For more detailed information on the WebSphere Commerce store architecture, understanding the contents of a store, and developing a store, we strongly recommend that you refer to the Store Development Guide, IBM WebSphere Commerce V5.5 product guide. This section includes the following topics on the WebSphere Commerce store:
Store assets Store architecture Store packaging and models Store data assets and architecture Catalog data assets and concepts Tools and store data Customize a store Publish a store
3.3.1 Store assets At the highest level, the store assets can be categorized as follows: Store front assets These are the store pages displayed to a customer. The store front content includes HTML pages, JSPs, images, and multimedia files. The majority of the store pages use JavaServer Page technology (JSP). Each JSP contains HTML static content for headings, descriptions, etc. In addition, the JSPs contain JavaScript to provide client-side input checking and more sophisticated display features. JSPs also include URLs to invoke WebSphere Commerce commands and other views, as well as JSP tags and Java code
78
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
for generating dynamic content. WebSphere Commerce data beans are included within the JSPs to allow access to information from the store database. The results of the access, such as product price or product attributes, are displayed on the store page (JSP). Back office assets (business logic) The back office assets contain the business logic for the store that customers do not see directly. These assets include WebSphere Commerce commands and tasks implemented through Java servlets and EJBs. Store data This includes all of the data related to your store, including product catalog data, tax and shipping information, payment methods, etc. In addition, this includes some configuration data used to manage your store.
3.3.2 Store architecture This section describes the store architecture for the WebSphere Commerce Server instance, WebSphere Commerce Server, and store configuration scenarios.
WebSphere Commerce Server instance WebSphere Commerce Server instance is used to host a WebSphere Commerce store or multiple stores. All stores within a WebSphere Commerce instance share the same WebSphere Commerce instance database and may share some types of data such as the catalog and fulfillment methods. All stores within the instance also share the same EJB container. When a WebSphere Commerce instance is created, the Configuration Manager creates an application server within the WebSphere Application Server for the instance. In addition, during instance creation an instance directory and subdirectories are created for instance configuration files and log files.
WebSphere Commerce Server The WebSphere Commerce Server is an enterprise application deployed to its own application server that provides the infrastructure and functionality for the e-commerce solution. The store assets are deployed and hosted by the WebSphere Commerce Server (running as an application server on the WebSphere Application Server).
Chapter 3. Business and store models
79
Store configurations As noted above, a WebSphere Commerce instance can host a single store or multiple stores. We discuss several combinations of configurations for stores: Single store in an instance Multiple stores in an instance with non-shared resources Multiple stores in an instance with sharing resources
Single store in an instance Figure 3-11 depicts a single store published in a WebSphere Commerce instance. The three asset types are noted in Figure 3-11, including store front, back office (business logic), and store data.
Store front
Single store in an instance
Store 1 Web assets
Business logic
Store data
Store 1 logic Store 1catalog Store 1 orders
Store 1 Web assets
Store 1 logic
Store 2 Web assets
Store 2 logic
Multiple stores in an instance
Store 1 catalog and orders Store 2 catalog and orders
Figure 3-11 Single store in an instance, multiple stores in an instance
Multiple stores in an instance with non-shared resources Figure 3-11 also depicts multiple stores published in a WebSphere Commerce instance. In this example, each store has its own store front, business logic, and store data.
Multiple stores in an instance with sharing resources Figure 3-12 on page 81 depicts multiple stores published in a WebSphere Commerce instance with several examples of how resources can be shared. For
80
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
example, stores can share store front assets, business logic, and the product catalog, or any combination of the asset types. Multiple stores can exist in a single stores Web module. If so, the store assets are separated using the following methods: Store front assets: Store front assets for each store in the stores Web module are stored in a separate store directory (storedir). For example, all store front assets for MyStore are in the MyStore directory. Business logic: The store ID is used to select the command implementation for each store, as specified in the command registry.
Store front
Store 1 Multiple stores in an instance sharing a store front
Store data
Store 1 logic
Shared store front
Store 2
Store 2 logic
Store 1 Web assets
Store 1 logic
Multiple stores in an instance sharing business logic
Multiple stores in an instance sharing catalog data
Business logic
Shared logic
Store 2 Web assets
Store 2 logic
Store 1 Web assets
Store 1 logic
Store 2 Web assets
Store 2 logic
Store 1 catalog and orders Store 2 catalog and orders
Store 1 catalog and orders Store 2 catalog and orders
Shared catalog data
Shared catalog Store 1 orders Store 2 orders
Figure 3-12 Multiple stores in an instance sharing resources
Chapter 3. Business and store models
81
3.3.3 Store packaging and models A store archive (or SAR) file is a zip file used for the packaging and delivery of WebSphere Commerce sample stores. A store archive can contain the following types of assets: Store presentation assets (JSP, images, HTML, properties files) Store data and configuration assets (catalog, tax, shipping, contract, flow configuration, all in XML format) Descriptors that describe contents and control store publishing A store archive can be deployed or published to the runtime using the Publish Tool available from the WebSphere Commerce Administration Console. In previous releases, this functionality was provided from Store Services (discontinued). The topic of store publishing is further discussed in 3.3.8, “Publish a store” on page 97. In WebSphere Commerce V5.5, there are new types of store archives to allow for a more modular approach to store publishing. The store archive containing all assets, which is similar to previous releases, is known as a composite store archive. In addition to the composite store archives (all assets), there is now the concept of component store archives containing a subset of store function that can be published separately. All of the store archives include globalization support for the locales listed in Table 3-2. By default, the store will use the locale of the WebSphere Commerce instance. Table 3-2 WebSphere Commerce store archive supported locales
82
Locale
Language and Territory
langId
en_US
English US
-1
fr_FR
French France
-2
de_DE
German Germany
-3
it_IT
Italian Italy
-4
es_ES
Spanish Spain
-5
pt_BR
Portuguese Brazil
-6
zh_CN
Simplified Chinese China
-7
zh_TW
Traditional Chinese Taiwan
-8
ko_KR
Korean Korea
-9
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Locale
Language and Territory
langId
ja_JP
Japanese Japan
-10
The following sections describe the store archives included with WebSphere Commerce Business Edition:
Consumer direct store archives Consumer direct basic store archive B2B direct store archives Hosting store archives Demand Chain store archives Supply Chain store archives
Consumer direct store archives Table 3-3 provides a listing of the consumer direct store archive names and a brief description of the contents of the store archive. Table 3-3 Consumer direct store archives Store archive name
Description
ConsumerDirect.sar
A sample composite store archive containing the organization structure, predefined user roles, and necessary access control policies to create consumer direct environment, plus a feature-rich working store.
ConsumerDirectOrganizationStructure.sar
A sample store archive containing the organization structure, predefined user roles, and necessary access control policies to create a consumer direct environment.
ConsumerDirectStore.sar
A sample store archive containing all the necessary assets to create a feature-rich working Consumer Direct store.
Consumer direct basic store archive The consumer direct basic store archive (ConsumerDirectBasicStore.sar) is a scaled-down store archive to be used for the development of a store from scratch. It contains the required elements of a store archive, such as one currency, one supported language, one fulfillment, store default contract, one category, one product, simple store front and shopping flow, which includes shopping cart and checkout. By default, the consumer direct basic store archive is not listed from the WebSphere Commerce Administration Console under the Publish menu where other stores are listed.
B2B direct store archives Table 3-4 on page 84 provides a listing of the B2B direct store archive names and a brief description of the contents of the store archive.
Chapter 3. Business and store models
83
Table 3-4 B2B direct store archives Store archive name
Description
B2BDirect.sar
A sample composite store archive containing the organization structure, predefined user roles, and necessary access control policies to create business direct environment, plus a feature-rich working store.
B2BDirectOrganizationStructure.sar
A sample store archive containing the organization structure, predefined user roles, and necessary access control policies to create a B2B direct environment.
B2BDirectSite.sar
A sample store archive containing all the necessary assets to create a feature-rich working B2B direct store.
When publishing the composite store archive (BusinessDirect.sar), all displayed items in Figure 3-13, except root organization and default organization, will be published. The root organization and default organization are created in bootstrap data. The items included in each component store archives are noted in the legend.
o=Root Organization
o=Default Organization
o=Seller Organization
o=Buyer A Organization
ou=B2B
BusinessDirectOrganizationStructure.sar BusinessDirectSite.sar B2B Store
Figure 3-13 B2B direct store archives
84
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Hosting store archives Table 3-5 provides a listing of the hosting store archive names and a brief description of the contents of the store archive. Table 3-5 Hosting store archives Store archive name
Description
Hosting.sar
Contains the organization structure, predefined user roles, and necessary access control policies to create a reseller hosting environment, plus the necessary assets to create a hosting solution, including a service provider site, store directory, shared catalog, and seller stores.
CatalogAssetStore.sar
A sample store archive containing all the necessary assets to create a shared catalog.
HostedStoreFrontAssetStore.sar
Contains all the necessary assets to create a store front.
HostingHub.sar
Contains all the necessary assets to create the hub site.
HostingOrganizationStructure.sar
Contains the organization structure, predefined user roles, and necessary access control policies to create a hosted environment.
StoreDirectory.sar
Contains all the necessary assets to create a navigable directory of all stores available in the site.
Demand Chain store archives Table 3-6 provides a listing of the Demand Chain store archive names and a brief description of the contents of the store archive. Table 3-6 Demand Chain store archives Store archive name
Description
DemandChain.sar
A sample composite store archive containing the organization structure, predefined user roles, and necessary access control policies to create a Demand Chain environment, plus the necessary assets to create a Demand Chain solution, including a channel hub site, shared catalog, and reseller and distributor stores.
CatalogAssetStore.sar
A sample store archive containing all the necessary assets to create a shared catalog.
ChannelHub.sar
A sample store archive containing all the necessary assets to create a hub site.
Chapter 3. Business and store models
85
Store archive name
Description
DemandChainOrganizationStructure.sar
A sample store archive containing the organization structure and predefined user roles to create a Demand Chain environment.
DistributorAssetStore.sar
Contains all the necessary assets to support distributor proxy stores.
DistributorProxyOrganizationStructure.sar
A sample store archive containing the organization structure and predefined user roles to create top level organization structure for the distributor proxy stores.
ResellerStorefrontAssetStore.sar
Contains all the necessary assets to create a reseller store front.
Supply Chain store archives Table 3-7 provides a listing of the Supply Chain store archive names and a brief description of the contents of the store archive. Table 3-7 Supply Chain store archives Store archive name
Description
SupplyChain.sar
Contains the organization structure, predefined user roles, and necessary access control policies to create a supply chain environment.
CatalogAssetStore.sar
Contains all the necessary assets to create a shared catalog.
SupplierAssetStore.sar
Contains all the necessary assets to create a supplier store front.
SupplierHub.sar
Contains all the necessary assets to create a supplier hub site.
SupplyChainOrganizationStructure.sar
Contains the organization structure, predefined user roles, and necessary access control policies to create a supply chain environment.
3.3.4 Store data assets and architecture Store data is the information loaded into the WebSphere Commerce instance database thatallows your store to function. In order to operate properly, a store must have the data in place to support all customer activities. For example, in order for a customer to make a purchase, your store must contain a catalog of goods for sale (catalog data), the data associated with processing orders (tax
86
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
and shipping data), and the inventory to fulfill the request (inventory and fulfillment data).
Store data assets Figure 3-14 contains a summary of the store data assets. For more detailed information refer to the Store Development Guide, IBM WebSphere Commerce V5.5 product guide.
Prices
Catalogs
Business Policies
Site Level Information
Contracts and Accounts
Members
URL Registry Entries
Payment
View Registry Entries
Fulfillment
Command Registry Entries
Inventory Stores
Supported Units of Measure
Orders
Supported Languages
Jurisdictions
Supported Currencies
Taxes
Store Relationships
Shipping
Discounts
Coupons
Campaigns
Customer Profiles
Figure 3-14 WebSphere Commerce store data assets
Chapter 3. Business and store models
87
Store data architecture Data in WebSphere Commerce stores conforms to the architecture depicted in Figure 3-15. The store data assets can be categorized as follows:
WebSphere Commerce Server instance data Core data Configuration data Managed data Operational data
Operational data
Managed data
Configuration data
Sample store archive
Core data
WebSphere Commerce Server instance data
Figure 3-15 Store data architecture
WebSphere Commerce Server instance data The WebSphere Commerce Server instance data is identified as site-level information. When an instance is created, the bootstrap files (XML format) are used to populate the database. The following information is available at the site level and can be shared among multiple stores: Calculation usage types, device types (Web browsers, mobile device, e-mail, etc.) message types, roles and addresses The default site administrator ID (user defined as instance creation) The default URLs, commands, and views
88
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
The default business policies The default groups and access control policies The language and currency supported by the instance The default quantity units and quantity unit conversions The default scheduled jobs and statecodes The default terms and conditions The default organization, which can be used as the store owner The default site organization The default store group The default information for staging
Core data Core data represents the minimum data needed for a store. This type of data is typically packaged within the store archive file and is further categorized by organization and store. Organization The organization core data creates the minimum data for the business model (root organization and default organization within the bootstrap data). The organization data is found in the composite store archives and the component store archive for the organization structure. – Organizational structure – Predefined user roles – Necessary access control policies Store The store data is found in the composite store archives and the component store archive for the store data. – The store identifier in the STOREENT table. This creates a store in the database. – The default contract. – The store identifier in the contract database tables. – The member identifier for the organization that owns the store in the contract database tables. – The store directory in the STORE table. The store directory is the directory in which the store’s Web assets are located. – The nickname or identifier for the store’s address in the STADDRESS table. The nickname is unique for each store.
Chapter 3. Business and store models
89
Configuration data The following configuration data can be set at both the site and store level. The configuration data provides the Web Controller with runtime information for the appropriate commands and views to be invoked in response to each possible service request: URL registry entries, which map URL requests into command invocations. Command registry entries, which basically provide the command implementation class. View registry entries, which map the view names returned by commands with view commands and related JSP templates, based both on the store ID and on the requesting device type.
Managed data The following is a list of managed data created by the sellers, with read-only access for customers (note that store-specific assets have been specified):
Business policies Campaigns Catalogs Contracts Coupons Currencies (store specific) Customers Discounts (store-specific) E-mail activity Fulfillment centers Inventory Jurisdictions (store-specific) Languages (store specific) Members Payment Prices Sellers Taxes (store-specific) Shipping (store-specific) Supported units of measure (store-specific)
Operational data The following data can be created and changed, directly or indirectly, by interacting with the site. Such interactions can be performed both by customers and by sellers (note that, in this last case, operational data resulting from a particular type of interaction can be customers themselves): Auctions
90
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Contracts Customers E-mail activity Fulfillment Inventory (store-specific) Orders (store-specific) Request for quotes (RFQ)
3.3.5 Catalog data assets and concepts The WebSphere Commerce database schema has a rich environment to support a very advanced product catalog. In 3.3.4, “Store data assets and architecture” on page 86, we described the XML representation of data to be imported into the WebSphere Commerce instance database. The primary tools used to manage catalog data in WebSphere Commerce V5.5 are the WebSphere Commerce Accelerator Product Management tool and the Loader Package. This section defines the key catalog concepts for data stored in the WebSphere Commerce instance database. Figure 3-16 depicts the catalog hierarchy of the master catalog, catalog groups, products, and SKUs.
Apparel Master Catalog
Men
Women
Pants
Jeans
Outerwear
Corduroy
Jacket
Topcoat
Sweaters
Turtleneck
Twin set
Skirts
Mid-length
Mini
Master catalog Catalog groups Products SKUs
Figure 3-16 Catalog hierarchy (master catalog, catalog groups, products, SKUs)
Chapter 3. Business and store models
91
Master catalog The catalog object is the root of a catalog for both master catalogs and navigational catalogs. The catalog contains all the hierarchical and navigational information for the catalog. The reference identifier is used in all business objects that define the relationship of catalog groups and catalog entries. The database table for catalog is named CATALOG.
Navigational catalog Navigational catalogs allow for organizing the products differently from the way they are defined in the master catalog in order to catalog data for different types of shoppers.
Catalog group The catalog group object is used to organized the catalog and help shoppers to navigate to the products they wish to view. A catalog group may contain other catalog group,s as seen in Figure 3-16 on page 91. Catalog groups are often referred to as categories. The database table for catalog group is named CATGROUP.
Catalog entry A catalog entry object represents merchandise in the catalog that can be ordered from the catalog. There are four different types of catalog entries, which can be identified by the value of catenttype_id in CATENTRY, including product, SKU (item), bundle, and kit.
Product A product represents a collection of SKUs (items) that have identical attributes but can be distinguished by their attribute values. For example, a catalog may contain a shirt that is available in different sizes (small, medium, large) and colors (red, white, blue).
Attributes (defining and descriptive) A catalog entry can have defining and descriptive attributes. Defining attributes are properties of SKUs such as color or size. Attribute values for a color attribute, for example, are colors such as red, white and blue. Descriptive attributes are simply additional descriptive information, such as cleaning information (dry clean only, etc.). Each unique attribute value combination is used to define the item. Collectively, SKUs can be displayed as a single product with a single price, description, and image as long as a given shopper is given the opportunity to select the size and color values necessary to resolve the selection to a single SKU.
92
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
SKU SKUs and items are synonymous. A SKU represents a tangible unit of merchandise that can be purchased by a shopper. SKUs are products with a unique combination of defining attribute values.
Bundle A bundle is a collection of catalog entries that can be added to the shopping cart with a single selection. It is typically used as a convenient method of packaging items for the shopper to order a collection of items. Bundled items can be sold separately. For example, a bundle may be a computer bundle (system, monitor and printer). The price of the bundle is the collective price of each item.
Pre-built kit A pre-built kit is a collection of catalog entries that cannot be sold separately. For example, the system component of a computer includes a motherboard, hard disk, memory, video adapter, CPU case, CD-ROM, etc. Items such as a motherboard or CPU may not be offered as individual items for purchase. A pre-built kit often has its own price. A pre-built kit can be added to the shopping cart by one selection. Similar to a product, pre-built kits can have defining attributes. Once a pre-built kit is added to the shopping cart, it cannot be modified (it must be removed, attributes reselected, and added again to the cart). In previous releases of WebSphere Commerce, a pre-built kit was known as a package.
Static kit A static kit is a group of products that are ordered as a unit. The information about the products contained in a static kit is predefined and controlled within WebSphere Commerce. The individual components within the order cannot be modified and must be fulfilled together. A static kit will be back-ordered if any of its components are unavailable.
Dynamic kit A dynamic kit is an orderable SKU that consists of one or more SKUs, or components. The definition of the components that make up the kit is not known until the kit is ordered and configured, hence the name dynamic kit.
3.3.6 Tools and store data This section provides a summary of the tools used to manage the store data, including the XML data files before being loaded in the WebSphere Commerce instance, as well as to manage the data once in the instance database.
Chapter 3. Business and store models
93
The primary tools used to manage store data are as follows:
WebSphere Commerce Studio WebSphere Commerce Loader Package WebSphere Commerce Administration Console WebSphere Commerce Organization Administration Console WebSphere Commerce Accelerator
WebSphere Commerce Studio The IBM WebSphere Commerce Studio V5.5 includes IBM WebSphere Studio Application Developer V5. WebSphere Studio Application Developer includes an XML editor that is very useful when modifying the contents of the XML data files packaged as part of the store archive. For more detailed information on modifying the XML data files using the WebSphere Commerce Studio when creating a customized store, refer to Chapter 12, “Create a store” on page 341.
WebSphere Commerce Loader Package The WebSphere Commerce Loader Package is used to aggregate, transform, resolve, and load XML data files into the WebSphere Commerce instance database. The XML data files the Loader Package operates on are packaged with the sample store archives. In addition, the Loader Package utilities can be run via the command line or from a Java API. When a WebSphere Commerce store is published using the WebSphere Commerce Administration Console Publish Tool, the Loader Package utilities are executed in the background to resolve and load the XML data files into the WebSphere Commerce instance database. The Loader Package includes the following utilities: Text Transformation Tool: Convert CSV into an XML file, and transform XML into a WebSphere Commerce XML file. XSL Editor: The XSL editor is used to create and develop the XSL style sheets, which are used to transform (map) the XML data. XML Transformation Tool: This transforms the XML data using the XSL style sheets into WebSphere Commerce XML files. DTD Generator: This tool uses an input file containing database table names and generates either a DTD or an XML schema to describe the select database tables. ID Resolver: Resolve IDs within the database with data to be loaded.
94
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Loader: After ID resolution, the resolved XML data files are imported into the WebSphere Commerce instance database using the Loader, also known as the MassLoad utility. Extractor: Used to extract data in the WebSphere Commerce instance database to an XML file.
WebSphere Commerce Administration Console The WebSphere Commerce Administration Console allows you to control your site or store by completing administrative operations and configuration tasks. You can also use the Administration Console to create new organizations and users, as well as assign users to roles. The Administration Console also allows you to identify which notification and messaging types will be available in your store. The Administration Console contains the publish utility, which allows you to publish sample business and stores.
WebSphere Commerce Organization Administration Console The Organization Administration Console allows you and the buyer administrators to control the organizations that access your site or store. Tasks that you are authorized to perform in your role are displayed on the Organization Administration Console home page menus. These tasks are based on user roles and authority levels, which are defined in XML files on your WebSphere Commerce system and are assigned by the Site Administrator using the Administration Console.
WebSphere Commerce Accelerator The WebSphere Commerce Accelerator is a workbench of online tools that allow you to create and maintain various store assets. A large portion of store data can be created and managed using the Product Management Tool found in the WebSphere Commerce Accelerator.
Summary of tools used to manage store data Table 3-8 provides a summary of the WebSphere Commerce tools used to manage store data, including XML data files before load and store data found in the WebSphere Commerce instance database. Table 3-8 Tools used for creating store data Tools to manage and customize store data WebSphere Commerce Studio (WebSphere Studio Application Developer)
Core data
Configuration data
Managed data
Operational data
Applicable
Applicable
Applicable
In general, not applicable.
Chapter 3. Business and store models
95
Tools to manage and customize store data
Core data
Configuration data
Managed data
Operational data
WebSphere Commerce Loader Package (data is loaded in the form of an XML file)
Applicable.
Applicable.
Applicable.
In general, not applicable.
WebSphere Commerce Administration Console
Applicable * Publish store
Not applicable.
Not applicable.
Not applicable.
WebSphere Commerce Organization Administration Console (Business Edition)
Not applicable.
Not applicable.
Not applicable.
The organization Administration Console allows you to create and approve buyers.
WebSphere Commerce Accelerator
Not applicable.
Not applicable.
The accelerator allows you to create and edit the following data: Campaigns Contracts Fulfillment Discounts Catalog Prices
The accelerator allows you to create operational data for a customer, such as orders, and to manage the inventory.
3.3.7 Customize a store Chances are that one of the sample stores will provide a head start to customizing a store for your needs. However, you may need to customize and add new Web assets, business logic, and your own store data. This is referred to as customizing a store. The easiest and quickest method for store customization is to start with a sample store archive that best matches your needs. You will need to understand the programming model of WebSphere Commerce V5.5 and how to use the development tools included in WebSphere Commerce Studio V5.5 to customize your store. Note: We strongly recommend that you read the Store Development Guide, IBM WebSphere Commerce V5.5 product guide for detailed information.
96
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
To find more information, refer to the following: Store development – Chapter 12, “Create a store” on page 341 – Store Development Guide, IBM WebSphere Commerce V5.5 product guide – Sample Store Guide, IBM WebSphere Commerce V5.5 redbook Overview of the WebSphere Commerce programming model – Chapter 4, “Programming model” on page 109 Detailed description of the WebSphere Commerce programming model – Programmer’s Guide, IBM WebSphere Commerce V5.4 product guide
3.3.8 Publish a store In WebSphere Commerce V5.5, stores are published by selecting the Store Archive -> Publish menu option found in the WebSphere Commerce Administration Console. In previous versions of WebSphere Commerce, store publishing was performed from Store Services, which has been discontinued. In addition, in previous versions the store archive was created from a sample store and then published. The generated store archive needed to be maintained. In WebSphere Commerce V5.5, the store archive is used to publish the store (there is no longer an intermediate step of creating a store archive from the sample store archive and then publishing).
Publish store from a user perspective This section describes the steps taken by a user to publish a store archive. The publish store functionality is found in the WebSphere Commerce Administration Console by selecting Store Archive -> Publish, as seen in Figure 3-17 on page 98.
Chapter 3. Business and store models
97
Figure 3-17 Administration Console: Store Archive -> Publish
The next page to be displayed when publishing a store is a list of the sample store archives. A view pull-down is preset to Default, which lists the composite store archives for the store models (see Figure 3-18 on page 99).
98
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Figure 3-18 Store publish default view (composite store archives)
After you have checked the store archive to publish and clicked Next, you will see a parameters page (see Figure 3-19 on page 100), which is new to WebSphere Commerce V5.5. The store archives can be constructed to allow for parameters to be supplied at the time of publishing. The composite store archive parameters are set to read only (visible but cannot be changed). The component store archives parameters allow for modification. For the purposes of illustration, we checked the ConsumerDirectSite.sar to display the parameters page with fields that can be modified by the user at publish time. Note: We discuss modifying the store parameters in detail in Chapter 12, “Create a store” on page 341. In our example, we provide a working example for adding parameters and changing the existing parameters from read only to a user-driven setting for the ITSO composite store archive.
Chapter 3. Business and store models
99
Figure 3-19 Parameters page for the ConsumerDirectSite.sar
When the user clicks Finish to begin publishing the store archive, the publishing runs as a scheduled job via the WebSphere Commerce scheduler. The status of the job can be monitored by clicking Store Archive -> Publish Status from the WebSphere Commerce Administration Console.
Technical details of store publish There are many new features provided in the store archives and the publishing tools. The ITSO working example for creating a store provides step-by-step examples for many of the features. For details, refer to Chapter 12, “Create a store” on page 341. This section includes the following technical details on store publishing:
100
Register a store archive Publish parameters Unpack store archive during store publish Instantiation during publising Schedule job for store publish Execute publish job Data considerations
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Troubleshooting store publishing
Register a store archive There are two methods a store archive can be registered and become visible from the WebSphere Commerce Administration Console using the Store Archive -> Publish menu option. Copy the store archive to the \instances\\sar directory and it will be displayed in the Administration Console. Update the SARRegistry.xml found in the \xml\tools\devtools directory to include the path of the store archive file, and preview HTML. All sample store archives are found in \samplestores\ directories. Example 3-1 contains a portion of the SARRegistry.xml for the ConsumerDirect.sar for reference. Example 3-1 SARRegistry.xml sample for the ConsumerDirect.sar
Publish parameters The following are a few files that are used for the store publish parameters: store-refs.xml – Descriptor file contained within the store archive – Allows for customizing publish parameters – Optionally edit when customizing/creating a store archive ForeignKeys.dtd – Contains the property name-value pairs needed to create a new store based on the store archive publishNLS.properties – Contains translatable text for the description of the store archive – Contains parameter names and descriptions displayed on the publish parameters page
Chapter 3. Business and store models
101
Figure 3-20 provides samples for the store-refs.xml, ForeignKeys.dtd and publishNLS.properties to highlight the relationship between the files. Sample From Parameter Page WEB-INF/stores/FashionFlow/data/ForeignKeys.dtd
SAR-INF/store-refs.xml
%ForeignKeys.dtd;
store-data-assets.xml
&store.xml; &en_US_store.xml; &catalog.xml; &en_US_catalog.xml;
Figure 3-21 Sample store-data-assets.dtd and store-data-assets.xml
Troubleshooting store publishing This section includes the following key store publishing troubleshooting tips: Standard logging and tracing facilities used by WebSphere Commerce (WebSphere Application Server logging facilities). – \logs\activity.log is a binary log file, viewed with LogAnalyzer – Trace string for publish: com.ibm.websphere.commerce.WC_DEVTOOLS=all=enabled – Refer to IBM WebSphere Commerce V5.5 online documentation for details and tips on troubleshooting Store Publish. If an error occurs during the data loading phase of publishing, the error is displayed on the Publish Details page. Tasks invoked during store publish (for example, IdResolver, ContractImport) may have their own trace. Refer to the Store Development Guide, IBM WebSphere Commerce V5.5 for more information.
106
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
3.4 For more information For more information on the business models, sample stores and access control refer to the following:
Store Development Guide, IBM WebSphere Commerce V5.5 Sample Store Guide, IBM WebSphere Commerce V5.5 Security Guide, IBM WebSphere Commerce V5.5 WebSphere Commerce V5.5 online documentation
Chapter 3. Business and store models
107
108
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
4
Chapter 4.
Programming model The objective of this chapter is to provide an overview of the WebSphere Commerce programming model. Note: For detailed information on the WebSphere Commerce programming model, we strongly recommend that you refer to the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide. The chapter includes the following topics:
Overview WebSphere Commerce Server framework Application flow of an HTTP request Design patterns Persistent object model Access control Customizing application assets For more information
© Copyright IBM Corp. 2003. All rights reserved.
109
4.1 Overview This section defines each of the following WebSphere Commerce application architectures layers, as seen in Figure 4-1:
Database Business objects Business components Controls and view Business processes Store models
Store Models
e-Commerce Business Models: e.g. Consumer Direct (B2C), B2B Direct, Hosting, Demand Chain, Supply Chain
Business Processes
SiteFlows/Workflows: e.g. User Registration, Catalog Navigation, Shopping/Purchasing, Order Processing
Control and Views
Business Components
Servlets/JSPs: e.g. ProductDisplay.jsp, ShoppingCart.jsp, LoginForm.jsp Command Beans and Rule Templates: e.g. OrderProcessCmd, DiscountRuleTemplate
Business Objects
Entity Beans, Access Beans, DataBeans: e.g. User, Order, Product
Database
Tables: e.g. USERS, ORDERS, CATENTRY
Figure 4-1 WebSphere Commerce application architecture
Database WebSphere Commerce uses a database schema designed specifically for e-commerce applications and data requirements. The database is known as the WebSphere Commerce instance database. The instance database is created by default via the WebSphere Commerce Configuration Manager when creating the WebSphere Commerce instance. The WebSphere Commerce instance database contains over 600 database tables, which are used to manage the operations of the WebSphere Commerce site and store. For example, information on customer profiles, taxes, orders, shipping and product catalog data are stored within the instance database. Some
110
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
examples of tables found in the WebSphere Commerce instance database are USERS, ORDERS, and INVENTORY.
Business objects Business objects represent entities within the commerce domain and encapsulate the data-centric logic required to extract or interpret information contained within the database. These entities comply with the Enterprise JavaBeans specification. These entity beans act as an interface between the business components and the instance database. In addition, the entity beans are easier to comprehend than complex relationships between columns in database tables.
Business components Business components are units of business logic. They perform coarse-grained procedural business logic. The logic is implemented using the WebSphere Commerce model of controller commands and task commands. An example of this type of component is the OrderProcess controller command. This particular command encapsulates all of the business logic required to process a typical order. The e-commerce application calls the OrderProcess command, which in turn calls several task commands to perform individual units of work. For example, individual task commands ensure that enough inventory is available to meet the requirements of the order, process the payment, update the status of the order and, when the process has completed, decrement the inventory by the appropriate amount.
Controls and view A Web controller determines the appropriate controller command implementation and view to be used. Implementations can be store specific. Views display the results of commands and user actions. They are implemented using JSP templates. Examples of views include ProductDisplayView (returns a product page showing relevant information for the shopper’s selected product) and OrderCancelView.
Business processes Sets of business components and views together create workflow and site flow processes that are known as business processes. Examples of business processes include: Create an e-mail campaign This business process includes the business components and views related to all steps involved in the process of creating e-mail campaigns.
Chapter 4. Programming model
111
Prepare an online catalog This business process includes the business components and subprocesses related to creating an online catalog. This includes designing the catalog, loading catalog data, creating merchandising associations, and setting pricing information.
Store models When gathered together, the lower layers of the diagram make up e-commerce business models. Each of the business models supported in WebSphere Commerce includes a sample store model. The WebSphere Commerce Business Edition includes the following store models: consumer direct, B2B direct, hosting, Demand Chain, and Supply Chain.
4.2 WebSphere Commerce Server framework This section defines the component architecture of the WebSphere Commerce common server runtime, also known as the WebSphere Commerce Server framework. The WebSphere Commerce common server runtime provides a framework in which the commerce applications are deployed and executed. The framework is based on the Java 2 Enterprise Edition (J2EE) platform architecture. Such a framework provides the capability to handle system and user requests and to perform the corresponding actions in order to fulfill them.
112
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
WebSphere Commerce node WebSphere Application Server WebSphere Commerce Server framework
Thread Thread
Protocol Listeners
HTTP Request servlet
Database Server
Web Server + WebSphere Plugin
Servlet Engine
MQ Listener
.xml
Adapter Manager
Adapter framework
HTTP Browser Adapter
PVC Adapter
Program Adapter
Scheduler Adapter
Registries URL CMD View
Web Controller
JSP Template
Data bean
Task CMD
Controller Command View Command
Data bean commands
Task CMD
Task CMD
Access bean
Data Bean Manager
WebSphere Commerce instance database
Entity bean
Figure 4-2 WebSphere Commerce common server runtime component architecture
Chapter 4. Programming model
113
The major components of the common server runtime or framework are listed as follows and depicted in Figure 4-2 on page 113:
Servlet engine Protocol Listeners Adapter manager Adapters Web controller Commands Entity beans Data beans Data Bean Manager JavaServer Page (JSP) templates WebSphere Commerce .xml configuration file
4.2.1 Servlet engine The servlet engine is the part of the WebSphere Application Server runtime environment that acts as a request dispatcher for HTTP requests. The servlet engine manages a pool of threads to handle requests. Each inbound request is executed on a separate thread. The request is then sent to the appropriate protocol listener, in this case the HTTP request servlet.
4.2.2 Protocol Listeners Protocol listeners receive inbound requests based on the protocols and dispatch them to the adapter manager to find the appropriate adapter for the type of requesting device. WebSphere Commerce includes the HTTP request servlet and MQ listeners.
HTTP request servlet The HTTP request servlet handles incoming HTTP requests. When the HTTP request servlet is initialized, it reads the adapter section within the .xml configuration file to load the adapter settings. When the HTTP request servlet receives a URL request from the servlet engine, it passes the request to the adapter manager.
MQ listener The MQ listener receives requests for inbound XML-based MQ messages from remote programs and then sends the request to the MQ adapter to be processed.
114
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Request device types and sources WebSphere Commerce commands can be invoked as the result of requests from various device types, such as the following:
Web browser client Mobile device with a Web browser (mobile phone, PDA, etc.) B2B application sending XML messages using MQ Procurement system sending requests using XML over HTTP WebSphere Commerce scheduler executing a background job
4.2.3 Adapter manager The adapter manager analyzes the contents of the HTTP header for the User Agent to determine the appropriate adapter to send the request.
4.2.4 Adapters Adapters are device-specific components that enable WebSphere Commerce to perform processing functions before passing on the request to the Web controller. Adapter are responsible for the following tasks: Instruct the Web controller to process the request in a manner specific to the type of device. Translate the message from the device-specific format into a WebSphere Commerce common format (that is, a CommandProperty object). Provide device-specific session persistence. Adapters provided by WebSphere Commerce are as follows:
HTTP browser adapter HTTP PVC adapter Program adapter Scheduler adapter
HTTP browser adapter The HTTP browser adapter provides support for requests to invoke WebSphere Commerce commands received from Web browser clients (HTTP).
HTTP PVC adapter The HTTP PVC adapter is an abstract adapter class that can be used to develop specific PVC adapters, such as a WAP PVC adapter or Portal adapter.
Chapter 4. Programming model
115
Program adapter The program adapter provides support for remote programs to invoke WebSphere Commerce commands. The program adapter receives requests and uses a message mapper to convert the request into a CommandProperty object. After conversion, the program adapter uses the CommandProperty object and executes the request.
Scheduler adapter The scheduler adapter provides support for WebSphere Commerce commands that are run as background jobs. Note: If required, the adapter framework can be extended to create new PVC adapters or to create new adapters that connect to new protocol listeners.
4.2.5 Web controller The WebSphere Commerce Web controller is an application container that follows a design pattern similar to that of an EJB container. This container simplifies the role of commands by providing such services as session management (based upon the session persistence established by the adapter), transaction control, access control, and authentication. The Web controller also plays a role in enforcing the programming model for the commerce application. For example, the programming model defines the types of commands that an application should write. Each type of command serves a specific purpose. Business logic must be implemented in controller commands and view logic must be implemented in view commands. The Web controller expects the controller command to return a view name. If a view name is not returned, an exception is thrown. For HTTP requests, the Web controller performs the following tasks: Begins the transaction using the UserTransaction interface from the javax.transaction package. Gets session data from the adapter. Determines whether the user must be logged on before invoking the command. If required, it redirects the user’s browser to a logon URL. Checks if secure HTTPS is required for the URL. If it is required but the current request is not using HTTPS, it redirects the Web browser to an HTTPS URL. Invokes the controller command and passes it the command context and input properties objects.
116
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
If a transaction rollback exception occurs and the controller command can be retried, it retries the controller command. A controller command normally returns a view name when there is a view command to be sent back to the client. The Web controller invokes the view command for the corresponding view. There are a number of ways to form a response view. These include redirecting to a different URL, forwarding to a JSP template, or writing an HTML document to the response object. Saves the session data. Commits the session data. Commits the current transaction if it is successful. Rolls back the current transaction in case of failure (depending upon circumstances).
4.2.6 Commands WebSphere Commerce commands are beans that contain the programming logic associated with handling a particular request. There are four main types of WebSphere Commerce commands:
Controller command Task command Data bean command View command
Controller command A controller command encapsulates the logic related to a particular business process. Examples of controller commands include the OrderProcessCmd command for order processing and the LogonCmd that allows users to log on. In general, a controller command contains the control statements (for example, if, then, else) and invokes task commands to perform individual tasks in the business process. Upon completion, a controller command returns a view name. The Web controller then determines the appropriate implementation class for the view command and executes the view command.
Task command A task command implements a specific unit of application logic. In general, a controller command and a set of task commands together implement the application logic for a URL request. A task command is executed in the same container as the controller command.
Chapter 4. Programming model
117
Data bean command A data bean command is invoked by the data bean manager when a data bean is instantiated. The primary function of a data bean command is to populate the data bean with data.
View command A view command composes a view as a response to a client request. There are three types of view commands: Redirect view command: This view command sends the view using a redirect protocol, such as the URL redirect. A controller command should return a view command in this view type to return a view using a redirect protocol. When a redirect protocol is used, it changes the URL stacks in the browser. When a reload key is entered, the redirected URL executes instead of the original URL. Direct view command: This view command sends the response view directly to the client. Forward view command: This view command forwards the view request to another Web component, such as a JSP template. There are three ways in which a view command can be invoked: A controller command specifies a view command name when the request has successfully completed. A client requests a view directly. A command detects an error and an error task must be executed to process the error. The command throws an exception with a view command name. When the exception propagates to the Web controller, it executes the error view command and returns the response to the client.
4.2.7 Entity beans Entity beans are the persistent, transactional commerce objects provided by WebSphere Commerce. If you are familiar with the commerce domain, entity beans represent WebSphere Commerce data in an intuitive way. That is, rather than having to understand the whole database schema, you can access data from an entity bean that more closely models concepts and objects in the commerce domain. You can extend existing entity beans. In addition, for your own application-specific business requirements, you can deploy entirely new entity beans. Entity beans are implemented according to the Enterprise JavaBeans (EJB) component model.
118
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
4.2.8 Data beans Data beans are Java beans that are primarily used by Web designers. Most commonly, they provide access to a WebSphere Commerce entity. A Web designer can place these beans on a JSP template, allowing dynamic information to be populated on the page at display time. The Web designer need only understand what data the bean can provide and what data the bean requires as input. Consistent with the theme of separating display from business logic, there is no need for the Web designer to understand how the bean works.
4.2.9 Data Bean Manager WebSphere Commerce data beans inserted into JSP templates allow for the inclusion of dynamic content in the page. The data bean manager activates the data bean so that its values are populated when the following line of code is inserted into the page: com.ibm.commerce.beans.DataBeanManager.activate(data_bean, request)
Where data_bean is the data bean to be activated and request is an HTTPServletRequest object.
4.2.10 JavaServer Page (JSP) templates JSP templates are specialized servlets that are typically used for display purposes. Upon completion of a URL request, the Web controller invokes a view command that invokes a JSP template. A client can also invoke a JSP template directly from the browser without an associated command. In this case, the URL for the JSP template must include the request servlet in its path, so that all of the data beans required by a JSP template can be activated within a single transaction. The request servlet can forward a URL request to a JSP template and execute the JSP template within a single transaction. The data bean manager rejects any URL for a JSP template that does not include the request servlet in its path.
4.2.11 WebSphere Commerce .xml configuration file The WebSphere Commerce .xml configuration file contains the configuration settings for the WebSphere Commerce instance, and is read when the HTTP request servlet is initialized.
Chapter 4. Programming model
119
4.3 Application flow of an HTTP request This section contains a description of the application flow of an HTTP request from a Web browser client to the WebSphere Commerce node to explain how the components interact. The following information corresponds to the detailed flow of an HTTP request from a Web browser client product category display, as seen in Figure 4-3 on page 121: 1. The request is directed to the servlet engine by the WebSphere Application Server plug-in. 2. The request is executed in its own thread. The servlet engine dispatches the request to the HTTP request servlet protocol listener. 3. The HTTP request servlet protocol listener passes the request to the adapter manager. 4. The adapter manager determines which adapter is capable of handling the request and then forwards the request to the appropriate adapter. For example, if the request came from a Web browser, the adapter manager forwards the request to the HTTP browser adapter. 5. The adapter passes the request to the Web controller. 6. The Web controller determines which command to invoke, by querying the command registry. 7. Assuming that the request requires the use of a controller command, the Web controller invokes the appropriate controller command. 8. Once a controller command begins execution, there are two possible paths: – The controller command can access the database using an access bean and its corresponding entity bean. – The controller command can invoke one or more task commands. Then task commands can access the database, using access beans and their corresponding entity beans. 9. Upon completion, the controller command returns a view name to the Web controller. 10.The Web controller looks up the view name in the VIEWREG table. It invokes the view command implementation that is registered for the device type of the requester. 11.The view command forwards the request to a JSP template. 12.Within the JSP template, a data bean is required to retrieve dynamic information from the database. The data bean manager activates the data bean.
120
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
WebSphere Commerce node WebSphere Application Server
15
Protocol Listeners
Servlet Engine
2
Thread
HTTP Request servlet
Thread
Database Server
1
WebSphere Commerce Server framework
Web Server + WebSphere Plugin
Web browser client request
MQ Listener
3 .xml
Adapter Manager
Adapter framework
4 HTTP Browser Adapter
PVC Adapter
Program Adapter
Scheduler Adapter
6
Registries
URL CMD View
Web Controller
9
JSP Template
7
10 8b
Access bean
11
extends
Data bean
View Command
Data bean commands
12
Controller Command
8a
Task CMD Task CMD
Task CMD
8c Access bean
13 Data Bean Manager
14
WebSphere Commerce instance database
Entity bean
Figure 4-3 Application flow of an HTTP request
13.The data bean manager invokes a data bean command, if required. 14.The access bean from which the data bean is extended accesses the database using its corresponding entity bean.
Chapter 4. Programming model
121
15.The JSP writes a response, which is returned to the Web server. The Web server in turn relays that response to the Web browser client for the display of the category display page.
4.4 Design patterns This section includes design patterns for model-view-controller, commands, and display pages.
4.4.1 Model-view-controller design pattern One of the most important requirements for enterprise applications in general, and for online stores in particular, is the ability to fulfill service requests coming from different kinds of devices, each one characterized by a different type of user interface: HTML pages for standard Web browser WML or cHTML for mobile computing (PvC) devices XML messages for business suppliers The Model-View-Controller design pattern provides J2EE applications with the possibility to always use the same functions and data, independently of the final user interface, by keeping separate the business and presentation logic. This separation, invented by Smalltalk and adopted by J2EE, makes supporting multiple types of clients much easier to implement, test, and maintain. In particular, the Model-View-Controller components are: Model It contains all the business data and functions, but does not have any knowledge about the clients requesting them. The architecture is frequently improved by implementing a further subdivision of the model into: – The domain model, consisting only of the business data and of the logic to access it. In J2EE applications, the domain model is usually implemented by Enterprise JavaBeans and data beans. – The application model, consisting of the business processes that manipulate such data. Note that the application model knows what views must be invoked by the controller in order to display the results of its processes, but it doesn’t know anything about the type of the requesting device. In J2EE applications, the application model is usually implemented by Java beans that follow the command pattern.
122
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Views They render data obtained by the model in a way more suitable to the requesting devices. In J2EE applications, views are often implemented as JavaServer Pages templates producing output in HTML, WML, or XML format. Controllers They handle the application workflow by mapping service requests coming from user interfaces into actions to be performed by the model. When the results are available, they invoke the appropriate view in order to display them. In J2EE applications, controllers are usually implemented as servlets. Figure 4-4 illustrates how the Model-View-Controller design pattern is implemented by the WebSphere Commerce architecture. Model Task Command Controller Command
Invokes
Task Command
Invokes
Data Retrieval & Update
Task Command
Data Retrieval & Update
Controller Entities URL
Web Controller
Data Retrieval & Update Database
View
Data Retrieval
Invokes View Command
Data Bean
Forwards
JSP Template
Figure 4-4 WebSphere Commerce implementation of the MVC design pattern
Chapter 4. Programming model
123
4.4.2 Command design pattern Service requests coming from different types of devices are translated by adapters into a common format that can be understood and processed by WebSphere Commerce commands. Moreover, the Web controller translates a service request into an actual command invocation, based on the type of the requesting device and on the addressed store ID. Commands are objects that follow the Java bean naming conventions. They perform some piece of business logic by leveraging the WebSphere Application Server command framework, which is an implementation of the standard command design pattern characterized by: Having both an interface and an implementation class for each command. Using a command factory in order to map the interface with the correct implementation class to be invoked, based both on the default command class name of the interface and on the database command registries. Allowing clients to invoke commands only by using their interface and through the following sequence of invocation steps: – Set the command’s input properties – Invoke an execute() method – Retrieving output properties. WebSphere Commerce supports four different types of commands: Controller commands. These encapsulate all the logic necessary to accomplish a single service request, such as OrderProcess for an order processing request. They invoke task commands to perform single units of work, such as payment processing in the previous example, and control the application logic flow in order to fulfill the whole request. Upon completion of the flow, they return a view name to the Web controller, which is in charge of determining the view implementation class for the particular store and requesting device. Controller commands are targetable, which means that they can be executed on a different container, but only the local target is supported. Task commands. Each task command performs a single unit of work, and usually access a single business data entity using an access bean wrapper that hides the complexity of interacting with Enterprise JavaBeans. Task commands are not targetable, which means that they must be executed on the same container as the invoking controller command. Data bean commands. They are invoked by JSP templates through the data bean manager in order to populate data beans. They’re targetable, but are only supported on the local targets.
124
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
View commands. These can be invoked either by a controller command returning their interface name to the Web controller, or directly by a client. They are of three different types: – Redirect view command, which sends the view using a redirect protocol. – Direct view command, which sends the view directly to the client. – Forward view command, which forwards the view request to another Web controller, usually a JavaServer Page template. They’re targetable, but supported only on the local target. The level of indirection in commands invocation that is provided by the WebSphere Application Server command framework has the following advantages: The possibility of implementing an access control policy based on the requesting user at command level. The flexibility to execute different command implementations for different stores. The flexibility to execute different command implementations for different types of requesting devices.
4.4.3 Display design pattern According to the display design patterns, view commands are implemented as JavaServer Pages templates, that is they are developed in a JavaScript language that provides an easy mechanism to access and display data without the necessity of a particular programming skill. At runtime, JavaServer Pages templates are compiled into servlets after the first invocation. They could be implemented directly as servlets, but this way is not recommended because their implementation would require a much higher level of programming skill. Moreover, view commands should be invoked only by using their view name. As usual, this level of indirection affords the possibility to invoke at runtime the appropriate implementation. For example, different view implementations can be invoked based on the locale, the type of the requesting device, or any other property into the request context. JavaServer Pages templates use data beans, which are access bean extensions that allow them to retrieve business data in a very simple way. In fact, they can create and populate data beans by means of the data bean manager with a single line of code, such as the following: com.ibm.commerce.beans.DataBeanManager.activate(DataBean,HTTPServletRequest)
Chapter 4. Programming model
125
Note that the above line of code is automatically created by WebSphere Studio Page Designer and WebSphere Studio Application Developer whenever a new data bean is inserted in a JavaServer Page template. After activation, JavaServer Page templates can simply retrieve any property they need from the data bean, and even get the property names in all the languages supported by the WebSphere Commerce instance in case of multicultural stores. Data beans can retrieve data in two different ways: Smart data beans retrieve associated data only when they are actually requested (lazy fetch). They provide better performance but they are more complicated to develop. Command data beans rely on a command in order to retrieve all their data at once. They are easier to implement but they can have higher performance costs.
4.5 Persistent object model WebSphere Commerce implements its persistent object model with entity beans compliant with the Enterprise JavaBeans specifications, V1.1. Note: For more detailed information, refer to the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide. Enterprise JavaBeans (EJBs) are standard wrappers of business data that are provided by the EJB container with the following services: Persistency, in case of either entity EJBs or of stateful session EJBs. Distribution. They can be executed remotely by means of the Remote interface. Moreover, they can be created and discovered by network applications by means of their Home interface and their primary keys. Transaction management. Security implementation by means of access control mechanisms. The main types of EJBs are: Entity EJBs, which persist until they are explicitly removed from the container by either the client or the server. Based on the type of persistence management, they can be: – Container Managed Persistence (CMP), if they rely on the container for their persistency.
126
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
– Bean Managed Persistence (BMP), if they implement their own persistency. Session EJBs, which persist only as long as either client or server maintains a reference to them. They can be: – Stateless, when a single instance can handle requests from multiple clients, receiving all the necessary input parameters with each requests. This is the most scalable solution. – Stateful, when an EJB instance maintains a state between invocations. Note that this solution impacts the scalability of the whole system, because it requires that a client is always connected to the server that hosts the EJB that it references. For more information about Enterprise JavaBeans, refer to the following: Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide Chapter 13, “Customize a store: Price Watch example” on page 393 “EJB Tutorial”, downloadable at the following Web site: http://www.ejbtut.com
Article titled “What are Enterprise JavaBeans components?“, downloadable from the following Web site: http://www-106.ibm.com/developerworks/library/what-are-ejbs/part1/inde.html
This article describes the goals of the EJB architecture, the programming model, and how to deploy and use EJBs.
4.6 Access control The access control model of a WebSphere Commerce application has three primary concepts: users, actions and resources. Users are the people who use the system. Resources are the entities that are maintained in or by the application. For example, resources may be products, documents, or orders. User profiles that represent people are also resources. Actions are the activities that users can perform on the resources. Access control is the component of the e-commerce application that determines whether a given user can perform a given action on a given resource. In a WebSphere Commerce application, there are two main levels of access control. The first level of access control is performed by the WebSphere Application Server. In this respect, WebSphere Commerce uses WebSphere Application Server to protect enterprise beans and servlets. The second level of
Chapter 4. Programming model
127
access control is the fine-grained access control system of WebSphere Commerce. The WebSphere Commerce access control framework uses access control policies to determine if a given user is permitted to perform a given action on a given resource. This access control framework provides fine-grained access control. It works in conjunction with, but does not replace the access control provided by the WebSphere Application Server. The following WebSphere Commerce resources are protected under access control by WebSphere Application Server: Entity beans These beans model objects in an e-commerce application. They are distributed objects that can be accessed by remote clients. JSP templates WebSphere Commerce uses JSP templates for display pages. Each JSP template can contain one or more data beans that retrieve data from entity beans. Clients can request JSP pages by composing a URL request. Controller and view commands Clients can request controller and view commands by composing URL requests. In addition, one display page may contain a link to another by using the JSP file name or the view name, as registered in the VIEWREG table. For detailed information on access controls, refer to the following: Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 Security Guide, IBM WebSphere Commerce V5.5 IBM WebSphere Commerce V5.5 online documentation
4.7 Customizing application assets Each of the IBM WebSphere Commerce V5.5 editions and corresponding IBM WebSphere Commerce Studio V5.5 editions include sample stores to speed application development. This section describes the types of application assets that you may need to customize using WebSphere Commerce Studio and indicates the appropriate skill level needed for the customization.
4.7.1 Asset types to customize and development tooling In combination with the rich WebSphere Commerce framework described in 4.2, “WebSphere Commerce Server framework” on page 112 and the extremely
128
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
powerful WebSphere Commerce Studio development tooling, virtually any application customization is possible. We have categorized the application assets into the following categories: Store front assets Back office assets (business logic) Data files
Store front assets Store front asset customization (new or modified) is primarily done for the look and feel of the store pages. For example, if you started with the B2B direct sample store (ToolTech), you would most definitely change the store logo and headings on the store pages. This type of development is commonly performed by a Web developer (Web designer). Store front asset types include the following:
Static HTML pages JavaServer Pages (JSPs) Images JavaScript
Within WebSphere Commerce, these assets types are contained within the sample store archives.
Back office assets (business logic) Back office assets (new or modified) contain the business logic. Examples of back-office assets types include: Commands Data access beans Data beans Beans enable the store front JSPs (containing data beans) to interact with the instance database to allow for the storage, retrieval, and manipulation of data.
Data files The sample store archives contain many XML data files. Some of the data files are used for site and store configuration for such things are taxes and shipping. There are also many XML data files used to populate the WebSphere Commerce catalog. The sample store includes sample product catalog data that must be updated or removed for your customized store.
Chapter 4. Programming model
129
We describe this topic in more detail in Chapter 3, “Business and store models” on page 61. In addition, Chapter 12, “Create a store” on page 341 provides a working example on how to customize the XML data files for a store.
Customization information and examples There are several places that you can find customization examples: Chapter 12, “Create a store” on page 341 This chapter provides an in-depth working example, starting with the B2B Direct sample store (ToolTech), on how to create and customize a store. Some highlights include team development, source control, customizing store assets, and packaging a store archive. Chapter 13, “Customize a store: Price Watch example” on page 393 This chapter includes Java application development working examples of virtually all kinds, including database schema extension, data access bean, commands, data beans, JSPs, e-mail integration (commands, JSP templates), and use of the scheduler for batch jobs. Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide Sample Store Guide, IBM WebSphere Commerce V5.5 product guide Store Development Guide, IBM WebSphere Commerce V5.5 product guide
4.7.2 Matching skills to customization needs A commerce store can have varying levels of customization. The skills required depend on this level of customization. The level of customization affects both the development time and skills needed to develop a store. We have categorized the customization requirements into three levels: basic, intermediate, and advanced. For each level we describe the tasks involved and list the I/T specialist roles to complete the tasks.
Basic customization Basic store customization normally involves the following: Catalog creation This involves creating a catalog and dividing the catalog into logical catalog groups or categories. The store’s products are then assigned to catalog groups (categories).
130
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Web page design Web page design involves the creation of graphics, static HTML pages, and JSPs for a customized look and feel for the store using the existing WebSphere Commerce commands. The roles include site administrator and Web developer.
Intermediate customization Intermediate store customization includes the elements of a basic customization plus the following tasks: Custom command development Custom commands, which are Java classes, are used for flow control and implement business logic. They may extend existing commands or be created as new commands. WebSphere Commerce commands are developed in WebSphere Commerce Studio (WebSphere Studio Application Developer). Custom data bean development The development of data beans is required to represent dynamic content to be displayed in JSPs. The dynamic content is populated at runtime most often from the database. Data beans are developed in WebSphere Commerce Studio (WebSphere Studio Application Developer). The roles include site administrator, Web developer, and Java programmer.
Advanced customization Advanced store customization includes the elements of an intermediate customization plus the following tasks: Database customization Alteration of the existing database schema may be needed to meet the specialized needs of a business. EJB development EJBs are used as persistent Java objects to represent data in the database. For example, if you need to add a table to the database, you will need to create an EJB to query and update that table. EJBs are developed in WebSphere Commerce Studio (WebSphere Studio Application Developer). Data access bean development The data access bean is developed in Java and uses EJBs to access data from the database. Data access beans are developed in WebSphere Commerce Studio (WebSphere Studio Application Developer).
Chapter 4. Programming model
131
The roles include site administrator, Web developer, Java programmer, database schema owner and database administrator.
4.8 For more information Refer to the following for additional information on the WebSphere Commerce programming model:
132
Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 Installation Guide, IBM WebSphere Commerce Studio V5.5 Store Development Guide, IBM WebSphere Commerce V5.5 Fundamentals Guide, IBM WebSphere Commerce V5.5 WebSphere Commerce V5.5 online documentation Chapter 13, “Customize a store: Price Watch example” on page 393
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
5
Chapter 5.
Site and store administration This chapter provides an overview of the administration tools used to configure and manage a WebSphere Commerce site and store. First we provide a description of each administration tool, including WebSphere Commerce specific tools and supporting software administration tools. Next, we define the key operational areas that need to be managed. In closing, we provide a summary of the tools and tasks by user role (IT specialist and line-of-business). This chapter is organized into the following topics:
Administration tools Key operational categories to manage IT specialist roles and tools Line-of-business user roles and tools For more information
© Copyright IBM Corp. 2003. All rights reserved.
133
5.1 Administration tools WebSphere Commerce V5.5 and supporting software include many administration tools that make managing the WebSphere Commerce site and store easier for IT specialists and line-of-business (LOB) users. All of the administration tools listed in this section are included with the IBM WebSphere Commerce V5.5 product packaging (Business and Professional Edition). We have included some of the administration tools provided with supporting software that are key to the operations of the site and store. There are many other supporting software administration tools that we have not listed. The section describes the following administration tools:
WebSphere Commerce Administration Console WebSphere Commerce Administration Console WebSphere Commerce Accelerator WebSphere Commerce Organization Administration Console WebSphere Commerce Loader Package WebSphere Commerce Scheduler WebSphere Commerce Payments Console WebSphere Application Server Administration Console DB2 Control Center
5.1.1 WebSphere Commerce Configuration Manager After installing WebSphere Commerce, the WebSphere Commerce node must be configured. The WebSphere Commerce Configuration Manager is used to create, modify and delete various components of a WebSphere Commerce instance and the WebSphere Commerce Payments instance, which is new to this release of WebSphere Commerce. Some of the key tasks performed when creating a WebSphere Commerce instance include the following: Create the WebSphere Commerce application server Deploy the WebSphere Commerce enterprise application Update the WebSphere Commerce .xml file with the settings specified during instance creation Create the WebSphere Commerce instance database and populate the database with the WebSphere Commerce schema Configure the Web server configuration file with virtual hosts, aliases and directives
134
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
The Configuration Manager provides a GUI interface to the WebSphere Commerce .xml configuration file. Note: Whenever possible, components should be enabled through the Configuration Manager rather than by modifying the WebSphere Commerce .xml configuration file. The Configuration Manager consists of a Java application based server and client. The Configuration Manager Server must be started first. This is accomplished slightly differently on Windows, AIX, and Solaris platforms, as documented in Part 4, “Runtime deployment scenarios” on page 551 of this redbook. On Windows, the Configuration Manager Server started as a Windows services (IBM WC Configuration Manager). When the Configuration Manager (client) is started from the WebSphere Commerce application folder, the user is prompted for a password. By default, the user ID is webadmin, and the password is webibm. During the first logon, you will be prompted to enter a new password. After a WebSphere Commerce instance is created, you will see something like Figure 5-1 on page 136.
Chapter 5. Site and store administration
135
Figure 5-1 WebSphere Commerce Configuration Manager
Tip: New to WebSphere Commerce V5.5 is the ability to create your own user-defined site administrator ID during instance creation from the Configuration Manager. In previous releases, the site administrator was predefined as wcsadmin.
WebSphere Commerce instance properties When creating an instance, the Configuration Manager will guide you through entering the required entries for the instance properties. Once the instance is created, you can access the instance properties directly from the Configuration Manager, as seen in Figure 5-2 on page 137.
136
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Figure 5-2 WebSphere Commerce instance properties
WebSphere Commerce instance components After creating an instance, you will see a listing of instance components, as shown in Figure 5-3 on page 138.
Chapter 5. Site and store administration
137
Figure 5-3 WebSphere Commerce instance components
Each of the instance components listed in Figure 5-3 can be enabled/disabled by selecting the component and then clicking the Enable check box. In addition, the components can be further configured using the Configuration Manager. For more information on the Configuration Manager, refer to the following: IBM WebSphere Commerce V5.5 online documentation Product installation guides: – – – –
138
Installation Guide, IBM WebSphere Commerce V5.5 for Windows 2000 Installation Guide, IBM WebSphere Commerce V5.5 for UNIX Systems Installation Guide, IBM WebSphere Commerce V5.5 for OS/400 Additional Software Guide, IBM WebSphere Commerce V5.5
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Runtime deployment scenarios in this redbook for creating and updating an instance: – Chapter 16, “Windows: Migrate a single-tier to a multi-tier” on page 553 – Chapter 17, “Solaris: Three-tier environment using Oracle9i and Sun ONE Web Server” on page 599 – Chapter 18, “AIX: Three-tier using DB2 and IBM HTTP Server” on page 675 – Chapter 19, “OS/400: Two-tier remote database server” on page 755
5.1.2 WebSphere Commerce Administration Console The WebSphere Commerce Administration Console allows you to control your site or store by completing administrative operations and configuration tasks. If you are a Site Administrator, you select the store and language with which you want to work when you log on to the Administration Console. The tasks that you are authorized to perform are displayed on the Administration Console home page through various menus. These tasks are based on the user group names (roles) and authority levels. The WebSphere Commerce Administration Console is installed by default as part of the WebSphere Commerce installation, but not deployed until the WebSphere Commerce instance has been created. The WebSphere Commerce Administration Console is accessible to Web browser clients (Microsoft Internet Explorer 5.5 or higher) by entering the following: https://:8002/adminconsole
There are two things to be aware of with the Administration Console URL. First, the Administration Console is configured to use SSL and requires the HTTPS protocol. Second, the 8002 port is defined when creating the WebSphere Commerce instance. The port 8002 is added to the Web server configuration file (for example, httpd.conf) under a virtual host for this server, as well as the alias /adminconsole. After logging on to the WebSphere Commerce Administration Console as the site administrator (user-defined during instance creation), you will be prompted to select the site or store to configure. Figure 5-4 on page 140 displays the menu options available from the WebSphere Commerce Administration Console after selecting Site.
Chapter 5. Site and store administration
139
Figure 5-4 WebSphere Commerce Administration Console: site access
The WebSphere Commerce Administration Console from the site menus includes functionality for the following site level options: Security – – – –
Account Policy Password Policy Account Lockout Policy Security Checker
Configuration – – – – – – – –
Transports (e-mail, WebSphere MQ, WebSphere InterChange Server, file) Message Types Component Configuration Scheduler Registry View Unsent Message View Archived Messages Product Information
Payments – User – Merchant Settings
140
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
– Payment Settings – Cassettes Store Archives – Publish – Publish Status Note: In previous releases of the WebSphere Commerce (V5.1, 5.4), store archives were published from Store Services. The store publishing functionality has been moved to the Administration Console under the Store Archives menu option. For more detailed information on Store Publishing, refer to 3.3.8, “Publish a store” on page 97. After logging in to the Administration Console, if you selected the Store option, you will see a listing of stores that have been published. Select the desired store to manage and then click Next. You will see the menu options listed in Figure 5-5.
Figure 5-5 WebSphere Commerce Administration Console: store access
Chapter 5. Site and store administration
141
The WebSphere Commerce Administration Console from the store menus includes functionality for the following store level options: Access Management – Policies Configuration – – – – – –
Transports Message Types E-mail Activities Scheduler View Unsent Message View Archived Messages
Rules Service – Administration Payments – Users – Merchant Settings
5.1.3 WebSphere Commerce Accelerator The WebSphere Commerce Accelerator allows you to maintain online stores, hubs, and catalogs by completing various store operations, from managing the look and feel of your store to creating and maintaining orders to tracking store activities. If you are authorized to work with multiple stores, when you log on to the WebSphere Commerce Accelerator, you select the store and language with which you want to work. If you are authorized to work with a single store, the store name is preselected during logon. Additionally, if the store supports more than one language, you can select the language with which you want to work. Finally, if you are assigned a role with fulfillment duties, you can also choose the fulfillment center associated with the store when you log on. If you wish to change your store, language, or fulfillment center selection, click the icon, found in the upper-left corner to display the selection window. Tasks that you are authorized to perform in your role are displayed on the WebSphere Commerce Accelerator home page menus. These tasks are based on user roles, authority levels, and the business model and type of store. If you need to change your access level, contact your site administrator. To return to the WebSphere Commerce Accelerator home page, at any time, click Home near the top of the WebSphere Commerce Accelerator.
142
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
The WebSphere Commerce Accelerator is installed by default as part of the WebSphere Commerce installation, but not deployed until the WebSphere Commerce instance has been created. The WebSphere Commerce Accelerator is accessible to Web browser clients (Microsoft Internet Explorer 5.5 or higher) by entering the following: https://:8000/accelerator
After you log on to the WebSphere Commerce Accelerator, you will see something like Figure 5-6.
Figure 5-6 WebSphere Commerce Accelerator
The WebSphere Commerce Accelerator includes the following menu options: Store – Open/Close – Change Profile – Change Flow
Chapter 5. Site and store administration
143
– – – – – – – – – – – –
Change Shipping Change Tax Payment Settings Approval Requests Find Approval Requests Approval Submissions Find Approval Submissions Fulfill Centers Return Reasons Report Delivery Status Business Intelligence Reports Collaborative Workspaces
Sales – – – – – – – – – – – – – – – –
Accounts RFQs Personalized Attributes Find Customers Find Orders Find Returns Order Management Reports Operational Reports Auctions Customer Care Customer Care Queue Approve Payment Deposit Payment Settle Payment Find Payment Find Payment Batch
Marketing – – – – – –
Customer Profiles Campaigns Campaign Initiatives E-Marketing Spots E-mail Activities AD Copy
Products – – – – –
144
Product Management Categories Find Catalog Entries Find Categories Find Bundles or Kits
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
– – – – – – – – – – – – – – – –
Find Merchandising Association Expected Inventory Vendors Auctions Find Auctions Auction Styles Bid Rules Coupon Promotions Product Promotions Order Promotions Product Advisor Guided Sell Product Advisor Statistics Product Explorer Statistics Product Comparison Statistics Sales Assistant Statistics
Logistics – – – – – –
Returns Pick Batches Releases Ready to Ship Expected Inventory Find Inventory Inventory Reports
5.1.4 WebSphere Commerce Organization Administration Console The Organization Administration Console allows you and the buyer administrators to control the organizations that access your site or store. Tasks that you are authorized to perform in your role are displayed on the Organization Administration Console home page menus. These tasks are based on user roles and authority levels, which are defined in XML files on your WebSphere Commerce system and are assigned by the site administrator by using the Administration Console. The WebSphere Commerce Organization Administration Console is installed by default as part of the WebSphere Commerce installation, but not deployed until the WebSphere Commerce instance has been created. The WebSphere Commerce Organization Administration Console is accessible to Web browser clients (Microsoft Internet Explorer 5.5 or higher) by entering the following: https://:8004/orgadminconsole
After logging on to the WebSphere Commerce Organization Administration Console, you will see something like Figure 5-7 on page 146.
Chapter 5. Site and store administration
145
The WebSphere Commerce Organization Administration Console includes the following menu options: Access Management – – – – – – –
Users Organizations Roles Access Groups Policies Resource Groups Action Groups
Approvals – Approval Requests – Find Approval Requests
Figure 5-7 WebSphere Commerce Organization Administration Console
146
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
5.1.5 WebSphere Commerce Loader Package WebSphere Commerce V5.5 has two catalog management tools, Loader Package and the Accelerator Product Management Tool. The Accelerator Product Management Tool is GUI based and very well suited for operations when only a few product entries need to be performed. The WebSphere Commerce Loader Package is a Java-based set of utilities that can be executed via the command line or via Java API and allows for automation and is more appropriate for managing large product catalogs. Note: The Loader Package was known as Catalog Manager in WebSphere Commerce V5.4. The Loader Package provides the following functionality: Aggregate data from multiple input streams into one aggregated database. Transform data from ASCII-based CSV to an XML format. The MassExtract tool will extract data, but to an XML format. Converting from XML to CSV is not as easy as converting CSV to XML. Remap data from one XML format to another. Import data from multiple input sources in the form of ASCII-based CSV and XML files into WebSphere Commerce. The WebSphere Commerce Loader Package includes the following components: Text Transformation Tool The Loader Package Text Transformation Tool provides the ability to convert ASCII-file output such as a CSV file into an XML data format that later can be transformed and eventually loaded into the WebSphere Commerce database. XSL Editor A major benefit of using XML for data representation and structuring is that many tools exist to help with transformation of XML data from one format to another. An important method involves the use of XML style sheets, which are written in the eXtensible Stylesheet Language, or XSL. These style sheets may then be applied to XML documents by a tool that conforms to the XSL Transformation standard, or XSLT. The WebSphere Commerce Catalog Manager XSL Editor is used to develop XSL style sheets. XML Transformation Tool This Loader Package tool takes XSL style sheets, such as those created using the XSL Editor, and applies the transformation to XML files, such as those created by the Text Transformation Tool. The result is normally another
Chapter 5. Site and store administration
147
XML file, which is structured according to the input data requirements for a target application such as WebSphere Commerce. DTD Generator The DTD Generator can create a DTD and a schema to use with the Loader Package. The DTD Generator uses an input file containing database-table names, and generates either a DTD or an XML schema to describe the selected database tables. ID Resolver The ID Resolver tool takes an XML file and compares the contents to data within a specified database. Each element within the XML file is examined in turn, and if it contains attributes that require resolving, the data from other attributes within the element is used to find a match with data already within the database, or which has been previously specified within the XML file. Loader After ID resolution, the loading of the newly resolved data into the database is performed using the loader, known as the MassLoad tool. An essential prerequisite before attempting to load data into the commerce database is that it must have been successfully and completely resolved. Extractor To extract data from a database using the Extractor, you must specify the data that you want to extract from the database using an extraction-filter file. The extraction filter that you use depends on the type of data that you want to extract.
5.1.6 WebSphere Commerce Scheduler The WebSphere Commerce scheduler is a background server that schedules and launches jobs both at the site and store levels. From the Configuration menu of the Administration Console, the scheduler allows site administrators to schedule and configure jobs. The scheduler polls the SCHACTIVE table to find jobs scheduled to run. The following list describes the possible entries for the STATE column: W indicates the job is waiting to be executed if necessary. I indicates the job is currently inactive. IF indicates the job has run and failed and the instance will rerun the job. For each entry where the state is W and the preferred start time is less than or equal to the current time, the scheduler gets the job's configuration information from the SCHCONFIG table. If the INTERFACENAME field is defined, the scheduler gets the implementation of the business logic task command and if
148
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
that implementation uses the business logic interface, the scheduler runs the business logic task command. If no exceptions are thrown, the state is changed to I. When the scheduler finds entries in the SCHACTIVE table where the state is I or IF and the preferred start time is equal to or less than the current time, it executes the job. The scheduler is scalable across one or more threads, running on one or more machines. Multiple commerce servers or clones can connect to the same database. When a job is added to the SCHCONFIG table, the job can be scheduled to run on any WebSphere Commerce Server or application server cluster. Note: When using multiple clones or the same database, you must create a specific instance name in the instance_name.xml file for the support of broadcast jobs. For more information on the scheduler, refer to the following: 13.12, “Configuring the scheduler to run the batch job” on page 493 Refer to “Schedule job for store publish” on page 104 IBM WebSphere Commerce V5.5 online documentation
5.1.7 WebSphere Commerce Payments Console In WebSphere Commerce V5.5, payment administration can be performed from the WebSphere Commerce Administration Console (configuration) and the WebSphere Commerce Accelerator (operations). The WebSphere Commerce Payments Console is a legacy component of the WebSphere Commerce Payments available in previous releases. The WebSphere Commerce Payments Console is accessible to Web browser clients (Microsoft Internet Explorer 5.5 or higher) by entering the following: https://:5433/webapp/PaymentManager
Where hostname is the Web server configured for the WebSphere Commerce Payments virtual host. After logging on to the WebSphere Commerce Payments Console, you will see something like Figure 5-8 on page 150. We find the WebSphere Commerce Payments Console useful for verifying that the WebSphere Commerce Payments instance was created properly and for approving the payment of a transaction for testing purposes.
Chapter 5. Site and store administration
149
Figure 5-8 WebSphere Commerce Payments Console
5.1.8 WebSphere Application Server Administration Console When creating a WebSphere Commerce instance using the Configuration Manager for most configurations, the WebSphere Application Server is configured for the user. When implementing more advanced configurations, or if you want to know more about what is going on behind the scenes, you will need to understand the configuration of the WebSphere Commerce application server within the WebSphere Application Server. The WebSphere Application Server Administration Console is a Web browser-accessible application (enterprise application) that allows the administrator to configure the WebSphere Application Server.
150
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
To access the WebSphere Application Server Administration Console, enter the following in a Web browser: http://:9090/admin
After entering a user ID, you will see something like Figure 5-9.
Figure 5-9 WebSphere Application Server Administration Console
In this redbook, we used the WebSphere Application Server Administration Console for the following: Verifying WebSphere Commerce instance creation Adding a remote Web server (manually updating virtual host aliases, regenerating a plug-in)
Chapter 5. Site and store administration
151
Configuring WebSphere Application Server security
5.1.9 DB2 Control Center The DB2 Control Center provides a graphical tool to manage the resource of DB2 UDB and databases. We found the DB2 Control Center useful in view database tables, and sample contents within the database tables for the WebSphere Commerce instance database.
5.2 Key operational categories to manage This section provides a summary of other operational categories to be managed for a WebSphere Commerce store. The objective of providing a high-level summary of each of the following operational categories is to make sure users are aware of the functionality offered in the WebSphere Commerce V5.5 product. Note: More detailed information on each of the listed topics can be found in the Fundamentals Guide, IBM WebSphere Commerce V5.5 product guide and the WebSphere Commerce V5.5 online documentation.
Catalog management The term “content” in the context of the Internet refers to any information that is available for retrieval by a Web client, including Web pages, images, music, audio, documents, software downloads, education material, and e-commerce catalog data. The terms “catalog management” and “content management” are often interchanged. In the context of this redbook, we will distinguish content from catalog data. For a WebSphere Commerce site, content is information or editorial content displayed on the Web pages to supplement information about a product, such as a review or marketing promotion. Data or catalog data is used to define a product or item such as a SKU, price, size, and color. Catalog data displayed on the e-commerce Web page is retrieved from the WebSphere Commerce instance database. In some cases, content is used loosely to refer to catalog data. Catalog management includes the processes and tooling used to manage catalog data, including data transform, load, and management of catalog data assets before and after being loaded into the catalog of the WebSphere Commerce instance database. In this section, we define the different types of catalog assets to be managed and the tools included with WebSphere Commerce for catalog management (Accelerator and Loader Package).
152
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
The key catalog data assets to manage are as follows (described in 3.3.5, “Catalog data assets and concepts” on page 91):
Master catalog Navigational catalog Catalog group Catalog entry Product Attributes (defining and descriptive) SKUs Bundle Pre-built kit Static kit Dynamic kit
The primary catalog management tools included in WebSphere Commerce V5.5 to manage catalog data are the WebSphere Commerce Accelerator and the Loader Package.
WebSphere Commerce Accelerator - Product Management The WebSphere Commerce Accelerator Product Management tooling is new to WebSphere Commerce V5.5. Some of the functionality offered in V5.5 was released in the October 2002 Enhancement Pack for WebSphere Commerce V5.4. This Web browser-based tool provides a user-friendly GUI approach to managing the assets described in 3.3.5, “Catalog data assets and concepts” on page 91. Some of the new features offered in the Product Management tool are as follows:
Manage catalog entries such as catalog groups and products Creation and maintenance of kits (prebuilt and dynamic) and bundles Creation and maintenance of merchandising associations Improved tooling for defining attributes New tooling for descriptive attributes Improved author time search Manage merchandising associations
To access the WebSphere Commerce Accelerator Product Management tooling, enter the following to access the Accelerator: https://:8000/accelerator
Once you have logged into the Accelerator, select the Products menu option as seen in Figure 5-10 on page 154. Notice that there are many catalog management related options available in addition to Product Management, such as Categories and Find Catalog Entries.
Chapter 5. Site and store administration
153
Figure 5-10 WebSphere Commerce Accelerator: Product Management
WebSphere Commerce Loader Package The WebSphere Commerce Loader Package can also be used for catalog management. Refer to 5.1.5, “WebSphere Commerce Loader Package” on page 147 for more information. Note: For a detailed explanation and examples of using the Loader Package, refer to the WebSphere Commerce V5.4 Catalog Design and Content Management, SG24-6885 redbook. In WebSphere Commerce V5.4, the Loader Package utilities were referred to as the Catalog Manager.
154
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Merchandising The WebSphere Commerce merchandising subsystem supports merchandising associations and product advisors to enable businesses to better promote product and categories to their customers.
Marketing The WebSphere Commerce marketing subsystem facilitates marketing and personalization. The marketing subsystem includes support for discounts, e-marketing spots, customer profile creation and maintenance, marketing campaigns, and coupon promotions.
Business relationships: organizations and contracts Business accounts are the starting point for managing a store’s relationships with customer organizations. You can use business accounts to track contracts and orders for customer organizations. You can also configure how buyers from customer organizations shop in your store. Contracts enable a customer organization to purchase products from a store or a group of stores at a specified price for a specified period of time. Contracts can be created either by using the WebSphere Commerce Accelerator, or by creating XML files and importing them to populate the database.
Request for quote (RFQ) Request for Quotes (RFQ) is one of the trading mechanisms available in WebSphere Commerce. Buyers can add products to an RFQ by browsing the catalog, or by using a requisition list. Buyers can include any number of products in one RFQ, and define unique specifications for each product. They can also specify the terms and conditions for the transaction. A seller can view and respond to an RFQ when the RFQ is in the Active state. A Buyer can also change or cancel an RFQ. When sellers respond to an RFQ, they have the option of responding to each product, and to each product specification. A Seller can also modify or cancel a response. The Seller can also substitute products in the response. The Seller can evaluate RFQ responses in the Closed state to choose a winner, or multiple winners. When the RFQ response is accepted by the buyer and the seller is notified, the RFQ transaction is completed through one of the following processes: The buyer places an order that already contains the RFQ information. A contract already containing the RFQ information is created. Then the RFQ can go to the next round.
Chapter 5. Site and store administration
155
A record of the RFQ is maintained in the RFQ Request List for a predetermined period, so that they can copy an RFQ that they repeatedly use. Responses are retained for the same period to facilitate a seller’s response to similar requests from the same buyer. Sellers can enable approval flow for the RFQ response process if they want responses to be reviewed prior to transmittal to the buyer. RFQs are available in the B2B direct Supply Chain store models.
Auctions Auctions are an increasingly popular sales model for online transactions. Auctions provide a method for negotiating and dynamically establishing the price and other terms for the sale of products and services. WebSphere Commerce provides tools to help you create and manage auctions for your site. The auctions component provides an ideal environment for implementing small to moderate-scale auctions as part of your e-commerce solution.
Reporting and business intelligence WebSphere Commerce includes a reporting framework, predefined reports for operations, and business intelligence. Refer to Chapter 20, “Commerce analytics” on page 787 and the Fundamentals Guide, IBM WebSphere Commerce V5.5 product guide for more information.
Managing orders A customer service representative, or in a business-to-business site an account representative, can track and manage details about orders, including the customer, recipient, products and quantity, total cost (including tax and shipping charges), shipping specifications, payment method, and any comments. In WebSphere Commerce an order is one or more products, their prices, and the quantity specified, that a customer has selected to purchase or has purchased. A customer service representative can also place an order on behalf of a customer. In addition to products, a customer order includes a billing address, shipping address (not applicable to downloadable purchases, such as software), shipping method, carrier, and service, payment information, tax and shipping charges, and any comments or price adjustments stipulated by the person placing the order.
Managing returns If a customer is not satisfied with their purchase, they can request a refund for the amount of the original purchase, in the form of a credit to their credit card or to a line of credit. In WebSphere Commerce, a return includes a credit for the
156
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
taxes paid on the order, but not necessarily the shipping charges. To refund the customer shipping costs, you can manually add this to the total refund amount. Depending on your business, a return does not always require the customer to physically return the unwanted product. For example, if a customer wants a refund for fresh produce from a grocery store, the store would not likely require the produce to be returned to the store. When a store is created, the store defines return policies, for example, the FashionFlow store defines that all returns are automatically returned if the return is initiated within 30 days of the purchase. The FashionFlow store does not charge for returns. A Return Merchandise Authorization (RMA) is initiated when merchandise is returned to a fulfillment center. Some stores may require customers to contact the store and ask a customer service representative to initiate the RMA; other stores will initiate an RMA when returned merchandise arrives at the fulfillment center. All returns that fall within the store’s return policy are automatically approved by the system. Returns that fall outside of the store’s return policy may be approved by the customer service supervisor.
Customer Care Customer Care is a Lotus Sametime instant messaging application integrated with WebSphere Commerce stores, that provides customers and customer service representatives (CSR) with real-time support. A customer can enter a WebSphere Commerce site, and click the Customer Service link to communicate with a customer service representative. A CSR accesses the Customer Care interface through the WebSphere Commerce Accelerator. In addition, the CSR can view the store page where the customer needs assistance, and retrieve shopping cart and profile information. This interface also allows the CSR to chat with other CSRs. In this release of WebSphere Commerce, the Customer Care feature now supports queues. Key features of Customer Care queues include the following: Multiple queues and the ability for CSR to route customers waiting for assistance. The Operations Manager can create, change, delete, and assign CSRs to the queues, using the WebSphere Commerce Accelerator. Customer service representatives can select to serve any customer assigned to their queues. Customer service representatives can monitor customized customer attributes in a store.
Chapter 5. Site and store administration
157
Collaborative workspaces The collaborative workspaces feature is available with WebSphere Commerce Business Edition. Lotus QuickPlace is the self-service Web tool for team collaboration. QuickPlace enables the creation of a secure and central workspace on the Web instantly. Structured for immediate participation, teams use QuickPlace to do the following: Coordinate people, tasks, plans, and resources. Collaborate and share ideas and discussion, resolve issues, co-author documents, and exchange files. Communicate actions and decisions, key findings and lessons, and publish knowledge captured to a broader base of readership.
5.3 IT specialist roles and tools This section provides a summary of the IT specialist tasks and tools used to manage the WebSphere Commerce site and store for the following roles:
System administrator Site administrator Store administrator Database administrator
5.3.1 System administrator This section describes the role of the system administrator, tasks performed, and tools used.
Role description for system administrator The system administrator installs and initially configures all WebSphere Commerce associated software and hardware, and may be responsible for establishing several server configurations for different stages of development, such as testing, staging, and production. The system administrator needs to consider the issues related to national language support, such as operating system and application software globalization support. This system administrator responds to system warnings, alerts, and errors, knows where to find the installation and other relevant logs, and maintains them, diagnoses and resolves system integration problems, and system security problems. The system administrator has a thorough knowledge of the e-commerce solution architecture, including the hardware and software components, externally visible interfaces between them, and the relationship among them.
158
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Typical tasks for the system administrator The following are the typical tasks of a system administrator: Installs and initially configures all WebSphere Commerce associated software components, as listed: – – – – –
Web servers (IBM HTTP Server, Sun ONE Web Server) Database server (DB2, Oracle) WebSphere Application Server WebSphere Commerce WebSphere Commerce Payments
Additionally, installs and initially configures the following optional software components (may or may not be included, depending on whether you are using WebSphere Commerce Professional, Business, Business Developer edition): – – – – – – – – –
WebSphere Commerce Analyzer IBM DB2 Intelligent Miner for Data WebSphere Commerce Payment casettes IBM Directory Server DB2 Text Extenders Lotus QuickPlace Lotus Sametime Tivoli Web Site Analyzer WebSphere Commerce Studio
Additionally, installs and initially configures the following software: – WebSphere MQ – Lotus Domino Diagnoses and resolves integrated system problems Monitors the integrated system performance, and helps with the performance tuning task Performs security tasks, such as setting and changing passwords, enabling single sign-on (SSL) for production with IBM HTTP Server, and enabling SSL for IBM Directory Server (LDAP).
Tools used by the system administrator The following are typical tools used by the system administrator:
Prerequisites Checker Security Checker JDBCTestTool WebSphere Application Server Administration Console WebSphere Commerce Administration Console
Chapter 5. Site and store administration
159
5.3.2 Site administrator This section describes the role of the WebSphere Commerce site administrator, tasks performed, and tools used.
Role description for the site administrator The site administrator does the following:
Administers and maintains the site Configures and manages users and groups to control access to the site Specifies command security (access control) Configures and manages the payment system Configures and manages the messaging system Monitors performance Establishes and maintains site security Enables and disables cache Enables and disables logging Enables and disables auction
The site administrator typically uses WebSphere Commerce and associated software tools to perform these tasks. The site administrator responds to system warnings, alerts, and errors, knows where to find and review the relevant logs, sets the level of severity for the logging, enables and disables tracing of specific component(s), and diagnoses and resolves applied WebSphere Commerce related software problems, performance problems, and site security problems. The site administrator has advanced configuration skills and a thorough knowledge of the e-commerce solution architecture and the store's business procedures.
Typical tasks by the site administrator The following are the typical tasks of a site administrator: Performs the advanced configuration, and administers and maintains the site, using WebSphere Commerce and associated software tools. Creates roles and then assigns roles and access groups to the users, based on their role and position in the organization, such as the following non-inclusive list of the default access groups: – – – – – – – –
160
Business relationship roles (Business Edition only) Customer service roles Marketing roles Operational roles Organizational management roles Product management and merchandising roles Store administrator Web developer and Java programmer
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Assigns command access levels to access groups and defines who can execute commands and potentially exclude certain users from the command access. Activates and configures transports and message types for the site, by which administrators, customers, and back-end systems are notified of various events, such as customer orders or system errors, or allows the store administrator to modify these settings, particularly by performing the following tasks: – Adds transports to the site – Activates or deactivates transports for the site – Configures transports for the site (this supplies default configurations that a store administrator can override) – Assigns transports to message types for the site (these assignments can be overridden by store administrators) – Enables error notification to send e-mail messages to administrators – Enables the MQ transport to send messages to the back-end system – Enables order status notification to update customers or administrators on the status of existing orders Accesses payment processing and administration functions, and completes the setup of WebSphere Commerce Payments: – Views existing users or configures new and existing users – Views existing merchant settings or configures new and existing merchant settings – Views existing WebSphere Commerce Payment settings or configures new and existing WebSphere Commerce Payment settings – Views existing cassette settings or configures new and existing cassette settings – Enables and configures WebSphere Commerce Payments tracing Enables performance monitoring and monitors site performance. Leads the performance tuning task. Schedules jobs to be run for the site. Configures logging and component tracing for diagnostic purposes and problem resolution. Handles critical system backups. Performs security tasks, such as enhancing site security, enabling WebSphere Application Server security, and session management.
Chapter 5. Site and store administration
161
Diagnoses and resolves applied WebSphere Commerce-related software problems, performance problems, and site security problems
Tools used by the site administrator The following are the typical tools used by the site administrator:
WebSphere Application Server Administration Console WebSphere Commerce Configuration Manager WebSphere Commerce Administration Console WebSphere Commerce Accelerator WebSphere Commerce Organization Administration Console WebSphere Commerce Payment Console Performance Monitor WebSphere Commerce Scheduler
5.3.3 Store administrator This section describes the role of the WebSphere Commerce store administrator, tasks performed, and tools used.
Role description for the store administrator Store administrator manages the store archive publishing, changes to taxes, shipping and store information. This role publishes the store from the WebSphere Commerce Administration Console. The store administrator may be a lead on the store development team, and is the only role on the team (except for the site administrator) with the authority to publish a store archive. In larger IT shops, this may be a designated person on the deployment or operations team. This role also configures messaging and manages payments for the store. The store administrator responds to system warnings, alerts, and errors, knows where to find and review the store application logs, and diagnoses and resolves store application problems. This role administers the store data in the store database. The store administrator has a thorough knowledge of the store's business procedures.
Typical tasks of the store administrator The following are the typical tasks of the store administrator: Publishes the store and manages store tax, shipping, and store information. Activates and configures transports and message types for the store: – – – –
162
Adds transports to the store Activates or deactivates transports for the store Configures transports for the store Assigns transports to message types for the store
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Enables and administers Blaze Rules server, manages and maintains rules and rule services, and provides personalized marketing content consisting of advertisements and suggestive selling techniques, which can be summarized into the following two main tasks: – Enable WebSphere Commerce personalized marketing content – Deploy marketing campaigns to a production machine Accesses payment processing for the store Schedules jobs to be run for the store, and maintains store data. For example, deletes the following record types using the database cleanup utility: – Members – Guest customers – Temporary customer addresses – Old orders – Messages – User traffic log records – Records in the staging log table that have been propagated to the production database – Records in the cache log table that identify invalid or purged cache pages – Records in the catalog entry, campaign log, sales assistant statistics, and customer profile tables, Product Advisor statistics, product comparison statistics, and product explorer statistics – Closed or retracted auctions Maintains store application logs and manages diagnostic store application logging. Diagnoses and resolves store application problems.
Tools used by the store administrator The following are the typical tools used by the store administrator:
WebSphere Commerce Administration Console WebSphere Commerce Accelerator DB2 Control Center Database Cleanup utility
5.3.4 Database administrator This section describes the role of the database administrator, tasks performed, and tools used.
Chapter 5. Site and store administration
163
Role description of the database administrator The database administrator (DBA) manages and maintains the WebSphere Commerce and associated databases. The DBA has advanced administration skills for DB2 or Oracle database. The DBA responds to system warnings, alerts, and errors, knows where to find database logs and maintains them, and diagnoses and resolves database problems. The DBA typically is involved in advanced customization when database schema modifications are needed, and is involved in the performance tuning task. The DBA has thorough knowledge of the back-end architecture of the e-commerce solution.
Typical tasks of the database administrator The following are the typical tasks of the database administrator: Schedules database maintenance Generates access plans Manages and maintains the WebSphere Commerce and associated databases, by performing the following tasks: – – – –
Manages table space Reorganizes tables Monitors databases use Uses Database Cleanup utility
Maintains database logs and manages diagnostics information logging Defines disaster recovery strategy Maintains correct code level Monitors database performance and is involved in the performance tuning task and database tuning task Diagnoses and resolves database problems
Tools used by the database administrator The following are the typical tools used by the database administrator:
164
Database administration tools such as the DB2 Control Center SQL Database command line (DB2 commands, Oracle commands) CLI Trace Parser Database Cleanup utility WebSphere Commerce Configuration Manager
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
5.4 Line-of-business user roles and tools This section provides a summary of the line-of-business (LOB) user tasks and tools used to manage the WebSphere Commerce store for the following roles:
Business relationship roles Customer service roles Marketing manager role Operational roles Organizational management roles Product management and merchandising roles
The primary administration tool used by the line-of-business user roles is the WebSphere Commerce Accelerator.
5.4.1 Business relationship roles The business relationship roles are as follows and only apply to the WebSphere Commerce Business Edition: Account representative Sales manager Channel manager
Account representative The account representatives work with individual accounts to build relationships, and manage customer service issues. They may be authorized to change contract pricing, negotiate contracts, profiles, and analyze profitability by account category.
Sales manager The sales managers acquire and retain customers, meet sales forecasts, provide incentives for increased customer business, handle contract management, set pricing terms, and work with the product management team to establish inventory forecasts, and with the marketing manager for promotions. They also manage across accounts, assign accounts, and approve contracts of account representatives.
Channel manager The channel manager manages the channel store, as well as maintains the relationship between distributors and resellers, including creating and importing distributor and reseller contracts. The channel manager is also responsible for acquiring and retaining more resellers and distributors for the marketplace.
Chapter 5. Site and store administration
165
5.4.2 Customer service roles The customer service roles are as follows: Customer service representative (CSR) Customer service supervisor
Customer service representative (CSR) The customer service representative provides support for all inquires to customers via Customer Care instant messaging provided by Lotus Sametime, e-mail or phone. The CSR primarily uses the WebSphere Commerce Accelerator and Customer Care to assist customers using the consumer direct and B2B direct store models.
Customer service supervisor The customer service supervisor role has access to all customer service tasks. The customer service supervisor manages customer inquiries (such as customer registration, orders, returns, and auctions) and has authority to complete tasks that cannot be accessed by a customer service representative, such as approving system-denied returns records, and contacting customers regarding payment exceptions (such as credit card authorization failures). The customer service supervisor primarily uses the WebSphere Commerce Accelerator and Customer Care (manage CSR queues) to manage the CSRs and assist customers using the consumer direct and B2B direct store models.
5.4.3 Marketing manager role The marketing manager communicates the market strategy and brand messages to the customers. This role monitors, analyzes, and understands customer behavior. In addition, the marketing manager creates or modifies customer profiles for targeted selling, and creates and manages campaigns and promotions. The marketing manager handles e-mail campaign capability and campaign initiatives including suggestive selling and awareness advertising. Campaign event planning can be handled by a team comprising the seller, marketing manager, and merchandising and product development.
5.4.4 Operational roles The operational roles are as follows:
166
Seller Logistics manager Operations manager Receiver Returns administrator
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Pick packer
Seller The Seller supervises the overall store objectives and management, in addition to tracking store sales. The Seller is also responsible for store-wide functions such as defining shipping charges, and opening and closing the store. The Seller role is equivalent to a merchant in the consumer direct model, a manufacturer in the B2B direct model, and a distributor or other owner in the reseller hub. The seller has access to all WebSphere Commerce Accelerator capabilities to manage the consumer direct, B2B direct, hosting, Supply Chain and Demand Chain store models.
Logistics manager The logistics manager, sometimes called the shipping manager, manages and negotiates bulk freight/shipping from carriers to warehouse, and to individual customers.
Operations manager This role manages order processing, ensuring that orders are properly fulfilled, payment is received, and orders are shipped. The operations manager can search for customer orders, view details, manage order information, and create and edit returns. For the reseller and hosting models, this role is responsible for customer service, and oversees customer service in the other models.
Receiver The receiver receives inventory at the fulfillment center, tracks expected inventory records and ad hoc receipts for ordered products, and receives returned products as a result of customer returns.
Returns administrator The returns administrator manages the disposition of returned products.
Pick packer The pick packer picks products from fulfillment centers and packs the products for shipping to customers. The pick packer also manages pick tickets and packing slips that are used to confirm shipment of products during order fulfillment.
Chapter 5. Site and store administration
167
5.4.5 Organizational management roles WebSphere Commerce provides the following roles in the organizational management area:
Seller administrator Buyer administrator Buyer approver Buyer (buy-side)
Seller administrator The seller administrator manages users in the seller organization as well as manages organizations that the seller organization deals with. The seller administrator can also approve user registrations, customer orders, RFP responses, and contract summaries.
Buyer administrator The buyer administrator is similar to the seller administrator, but the only difference is that this role is for the buyer organization. So, this role manages users in the buyer organizations and manages organizations that the buyer organization deals with. Moreover, the buyer administrator can also approve customer registrations, customer orders, RFP responses, and contract summaries.
Buyer approver The buyer approver role can only approve customer registrations, customer orders, RFP responses, and contract summaries for the buyer organization.
Buyer (buy-side) The buyer in the buyer organization can only order products through the store front of seller organizations. This role has no administrator privileges.
Procurement buyer administrator The procurement buyer administrator registers users as procurement buyers. They create and administer the suborganizations within their buying organization and manage the various users, including approving users as buyers. Registers users as procurement buyers. Accesses and executes procurement system integration related commands.
Procurement buyer (buy-side) The procurement buyer is an individual who belongs to a buyer organization that uses a procurement system to connect to WebSphere Commerce. Procurement buyers are registered when a request comes from the procurement system.
168
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Procurement buyers use the account belonging to their buyer organization to make purchases from the seller. After purchasing, the procurement buyer sends their order to the procurement system for approval.
5.4.6 Product management and merchandising roles The product management and merchandising roles are as follows: Product manager Category manager Buyer (seller-side)
Product manager The product manager traces customer purchases, suggests discounts, and determines the best way to display, price, and sell products in the online store.
Category manager The category manager manages the financial success of a category of products. The category manager also manages the category hierarchy by creating, modifying, and deleting categories. The category hierarchy organizes products or services offered by the store. The category manager manages products, expected inventory records, vendor information, inventory, and return reasons.
Buyer (seller-side) The buyer buys merchandise for sale. The buyer handles relations with vendors or suppliers and negotiates to obtain the desired product with favorable terms for such things as delivery and payment options. The buyer may set prices. Inventory is managed by the buyer in order to determine the quantities to buy and ensure that stock is properly replenished.
5.5 For more information For more information on managing a WebSphere Commerce site and store, refer to the following: Fundamentals Guide, IBM WebSphere Commerce V5.5 Administration Guide, IBM WebSphere Commerce V5.5 IBM WebSphere Commerce V5.5 online documentation
Chapter 5. Site and store administration
169
170
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Part 2
Part
2
Development guidelines This part of the redbook provides IT architects and developers with design and development guidelines for an e-commerce development methodology, development environment, build cycle, and globalization.
© Copyright IBM Corp. 2003. All rights reserved.
171
172
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
6
Chapter 6.
WebSphere Commerce site development methodology In this chapter we introduce a project development methodology that was specifically adapted for the creation of e-commerce sites using the IBM WebSphere Commerce family of software products. After reading this chapter, you should have a clear understanding of the following topics relevant to the development methodology: Key development phases Actions and terms Deployment conditions Note: This chapter is based on the Best Practices and Tooling for Creating IBM WebSphere Commerce Sites, REDP3616 redpaper. We encourage you to read this redpaper for more detailed information.
© Copyright IBM Corp. 2003. All rights reserved.
173
6.1 Systematic development methodology Gone are the days when creating e-commerce sites was considered a fine art requiring highly specialized skills. e-commerce development has become a rather mature field since first introduced in the mid- to late-1990s. Experience proves that using a systematic methodology to develop software applications for e-commerce systems greatly reduces project risk and improves proper alignment of software functionality with customer business requirements, two key influencers of project profitability and customer satisfaction. The key characteristics of a systematic development methodology are: It uses a systematic software development method. The method has been validated and refined via empirical experience gained through e-commerce development. The framework of the methodology is centered around established project management principles to help define work products, deliverables, and timeline (or phases) to deliver software on time and within budget, to meet customer's business needs. The methodology to be outlined in this chapter will be flexible to support the creation or transition of both small- and large-scale e-commerce sites. Prior to introducing the methodology, this chapter will first identify and define relevant terminology that will be used through the remainder of the redbook.
6.2 Definitions The methodology documented in this redbook uses specific terminology with unique connotations. To improve your understanding of the project development methodology, this redbook begins with an overview on the terminology definitions. This section establishes a vocabulary that will: Be used through the remainder of the redbook Will enable you use this vocabulary when communicating and sharing knowledge of the methodology with others
6.2.1 Phase The development methodology consists of a set of time- or function-bound phases (for example, the design phase). From a systems view, a phase has very clear input and output work products (for example, the customer requirements document). A phase takes one or more work products and performs a set of activities or tasks to enhance existing work products or create new work
174
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
products. A phase is generally closed before starting the next one in the sequence. A phase can have zero or more subphases. In this redbook the word phase refers to both a phase and a subphase of a project. Note: Other industry methodology standards may use the term activity as a subdivision of a phase.
6.2.2 Work products Work products are tangible pieces of information or artifacts that can be created, shared, and communicated. For example, work products may be:
An education or training roadmap A macro design document Deployment code An e-commerce database with customer information
6.2.3 Deliverable A work product becomes a deliverable when it has been highlighted in a contractual document that has been signed by both the customer and a services provider, such as a Statement of Work (SOW) or a Document of Understanding (DOU).
6.2.4 Customer The customer should be viewed as one who either owns an e-commerce site or who wishes to develop an e-commerce site. In either case, the customer defines and approves the business requirements for the e-commerce site.
6.2.5 Customer IT team A team consisting of one or more members, each assigned by the customer, that is responsible for maintaining the customer e-commerce site and associated computing infrastructure such as the back-end or legacy systems.
6.2.6 Project team Owing to its responsibilities, the project team is prominently positioned with the methodology in this redbook, as the methodology seeks to emphasize the activities of this team. Since a project team may consist of subteams, such as a design team or test team, the appropriate subteam will be identified by name if a methodology task is
Chapter 6. WebSphere Commerce site development methodology
175
its responsibility. In other words, the project team will be the primary reference team used either explicitly or implicitly throughout this book unless specified otherwise. In terms of projects, a project team is sanctioned and supported by the customer during an in-house project. During a consulting engagement, the project team is controlled and supported by outside services organizations, such as ISSW, IGS or IBM Business Partners. No matter what the allegiance of the project team is, all should carefully assess project execution and control requirements whenever team members will be geographically dispersed. The assessment would typically be based upon evaluation of factors such as frequency of communication, the quantity and nature of control information supplied, and the difference between expected and observed progress in project execution. Each project manager or leader will need to understand the working relationships between team members to plan and coordinate project activities appropriately, especially when the teams reside in different locations. This topic is an import part of project management discipline, such as the PMI standard adopted by IBM. However, as further information on implications of dispersal on projects would be available from a project management specialist, we do not discuss the topic further in this redbook.
6.2.7 Project database A database of project-specific information should be established and maintained for all team members to access. This would hold background information, reports, minutes of meetings, results of discussions, and indeed any other kind of information that is relevant to the execution of the project. The project database could be implemented using any available tool, for example a Lotus Notes® database. It may be better to make use of collaborative facilities such as those provided by Lotus QuickPlace, which supports not only team information and resources sharing, but can also support controlled external access by customers using Web browsers.
6.2.8 Task A task is an activity that is performed during one or more phases of the project. A typical project phase generally involves many tasks, and each may be executed either sequentially or in parallel with one another. In addition, depending on their individual requirements, tasks may be completed by individual team members or distinct teams or subteams.
176
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
A task is likely to require input in the form of work products, and once it has been completed, it will produce one or more output work products. For example, when creating a database, you would require a data model for the target database to define and create the database schema. When complete, the target database may then be populated with customer or sample data to create the required database. In this case, the input work products necessary to create a sample database are: The data model The database schema The sample data The output work product of the database task is: A sample database ready to be used by the project team during the implementation phase The scope of a project task can be contained within a single phase or across multiple ones. An example of multi-phase task is the creation of a WebSphere Commerce design. This task can be completed by one or more team members, using most of the output work products from the Pre-sales phase. The output of the design task would normally be a set of work products that are listed as output from the Micro design phase. Ideally, tasks are completed within their parent phases. However, under some circumstances, often dependent on the task itself, it may be necessary to revisit a task during a later phase. This is particularly the case when later work uncovers an issue that must be revisited, such as modification to a database design. Such situations should be considered exceptions, and treated as such.
6.2.9 Strategy In terms of this redbook, a strategy is a method for executing a task. A project team may execute tasks in a variety of ways to produce desired output work products. Therefore, many strategies may be used to complete specific project tasks and create the associated output work products. Since a strategy is associated with a task, its scope may reside within a single phase or span multiple ones. For example, the Test Phase, which is one of the main phases of the overall methodology, may require tests be completed during each subphase. If so, then the tests would likely include functional verification, system and user-acceptance testing. On the other hand, all testing may be combined under a comprehensive test plan, such as System Verification Test and User-acceptance Testing.
Chapter 6. WebSphere Commerce site development methodology
177
Each strategy possesses factors that influence its selection by the project team as the strategy for a particular project phase or phases. Factors most likely to influence a project team's decision making process are: Resource skill level Business requirements Availability of tooling or aids to streamline tasks Before pursuing any one given strategy, you are strongly encouraged to assess and compare the advantages and disadvantages of potential candidates to select the appropriate ones given your project's requirements.
6.3 Development methodology: phase and life cycle Figure 6-1 on page 179 illustrates the six phases of a typical project development methodology. Within this redbook, we focus on four core phases, which are:
Design Implementation Site testing Deployment
Please note that the four core phases are positioned between pre- and post-project phases normally. In Figure 6-1 on page 179, the pre-project phase is called Pre-sales, while the post-project phase is defined as Site maintenance/enhancements. Note: The Best Practices and Tooling for Creating IBM WebSphere Commerce Sites, REDP3616 includes chapters for each of the phases listed.
178
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Project start (WebSphere Commerce Suite source version)
Project end (WebSphere Commerce target version)
Project duration
Pre-sales
Design
Implementation
Site testing
Deployment/ launch
Site maintenance/ enhancements
Phases Figure 6-1 A phase-based project development methodology
Once the e-commerce site has been launched, any new modifications added to the site after the project ends should be managed as functionality enhancements. During the lifetime of the e-commerce site, one or more of the methodology phases may be repeated as necessary to facilitate enhancements. Typically, repeated implementations of the methodology will be required to incorporate significant enhancements to the site, such as new versions of WebSphere Commerce software or updates, or to accommodate changing business requirements.
6.3.1 Core development phases In Figure 6-2 on page 180, each of the core development phases is positioned along with its likely subphases. Please note that the subphases tend to be iterative, and in some instances, may even overlap each other. It is important to understand that proper assessment of a project will help determine which, if any, of the subphases apply. Also note that subphase relevance and scope will vary from project to project.
Chapter 6. WebSphere Commerce site development methodology
179
Design phase: Solution outline Macro Micro Iterative design
Implementation phase: Iterative coding, unit and use-case level integration testing Sub-system level integration testing Site testing phase: FVT SIT SVT UAT Deployment/ launch phase: Deployment Site launch
Figure 6-2 The main phases of the project development methodology
Pre-sales phase The customer must consider, assess, and plan an e-commerce site carefully. Understanding site requirements, defining the nature and intricacies of the existing site for transition projects, and documenting the required features and functions of the target WebSphere Commerce site are key customer activities that should be completed during this phase. Please note that special attention
180
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
should be paid to adequately define and document business requirements as opposed to technical constraints or implementation details. A common event during this phase is for the customer to request estimates of resources required, time to develop, and other details such as the machine specification required to host the final site. The intention is to use the provided numbers for budgeting or sizing purposes. It may be possible to provide extremely rough estimates, based on similar previous projects. It would be impractical to provide more accurate figures until later in the project.
Design phase The design phase marks the beginning of the WebSphere Commerce project and consists of the following three subphases: Solution outline Macro design Micro design Taken together, these subphases represent incremental and iterative design activities that enable the project team to define the target system details.
Implementation phase During the implementation phase, the project team focuses on coding the design that resulted from design phase activities. This phase also includes continuous and incremental unit testing, and the integration of required software components.
Site testing phase The site testing phase covers several formal subphases, all of which enable the project team to test the newly developed or transitioned e-commerce site assets systematically.
Deployment/launch phase During the deployment/launch phase, the project team assists the customer IT team to bring the e-commerce site to a production-ready state, and as required by the customer, to support and help its IT team to enable the site.
Site maintenance and enhancement phase During this phase no new major design activities are undertaken, as all customer IT team activity centers on maintaining or enhancing current site functionality to satisfy new or changing business requirements. The duration of site maintenance and enhancement can range from a few months to several years, and all activity should center on maintaining and enhancing established site functionality to support new or changing business requirements.
Chapter 6. WebSphere Commerce site development methodology
181
It is possible that one or more significant site improvement projects may be initiated during the enhancement period, perhaps to reflect a new customer branding scheme. Architecturally, however, the site implementation will remain largely unchanged. The lifetime of an e-commerce site stretches beyond the time period for the WebSphere Commerce project itself, shown as the “Project Duration” in Figure 6-1 on page 179. The overall site lifetime can be viewed as a sum of project durations, including transitioned projects and the maintenance and enhancement phases. Not all site transitions are as complex as moving from WebSphere Commerce Suite V4.x or older versions to WebSphere Commerce V5.x or higher versions. For example, moving from WebSphere Commerce V5.1 to WebSphere Commerce V5.4 will require only a fraction of the effort that is required for transitioning WebSphere Commerce Suite V4.x to WebSphere Commerce V5.x. The key reason for the difference between the work efforts is the technology change in the programming models: Version 4.x is built on Net.Data® and C++, while Version 5.x uses JSP and Java/J2EE exclusively.
6.4 Using the methodology Using the methodology effectively involves certain considerations that will be elaborated below. Your understanding the implications and requirements for each of the several considerations outlined here will improve your ability to employ the methodology during any given project. Understanding these considerations is important to help you adapt the methodology presented here to meet specific requirements of the development work for a given project. For example, the methodology presented in this redbook provides guidelines for deciding between the use of all the design subphases (solution outline, macro- and micro design), or combining one or more subphases within a given e-commerce project. Understanding and carefully evaluating these guidelines, and applying the results to an e-commerce project, will increase the chance of the project manager making the best decision for the project, and so increase the probability of success.
6.4.1 Customizing and adopting the methodology It is possible to customize this methodology such that it could be applied to building all types of e-commerce sites using IBM WebSphere Commerce software. This includes different business models (B2B, B2C, hosting, Supply Chain, Demand Chain), which may be small, medium or large in size.
182
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
For each phase, this redbook describes core strategies that aid the project team to complete key tasks. Approaches for customizing the methodology are also provided to enable project teams to tailor it to specific project requirements. All the strategies identified in this redbook are grounded in best practices that ISSW derived from actual WebSphere Commerce projects and engagements.
6.4.2 New and transition sites There are two scenarios for creating a commerce site. The first is where a new site is developed, normally using WebSphere Commerce V5.5 or possibly WebSphere Commerce V5.4. The second scenario focuses on transitioning older sites, typically based on WebSphere Commerce Suite V4.1, V5.1 or V5.4, to newer versions of the product, normally WebSphere Commerce V5.5. The emphasis here will be on transition projects that are migrating e-commerce sites from WebSphere Commerce Suite V4.x or older versions to the Java/J2EE releases of WebSphere Commerce V5.x or higher versions. With regard to the terms migration and transition, each can be used interchangeably to describe the task of updating WebSphere Commerce sites or assets.
6.4.3 Project roles and skills requirements Any given project will have specific role and skill requirements. In terms of this redbook, most of the activities will be described from the perspective of either a project manager or a WebSphere Commerce architect. The purpose of this book is to enable project managers, WebSphere Commerce architects, designers and developers to define, plan and execute WebSphere Commerce projects efficiently by providing appropriate guidance, recommendations and examples. Common roles and skills needed for typical WebSphere Commerce projects are discussed in detail in the redpaper Best Practices and Tooling for Creating IBM WebSphere Commerce Sites, REDP3616.
6.4.4 Structuring information Each section detailing a phase or subphase from the development methodology begins with a table that summarizes phase requirements, inputs and outputs. This table is structured so that the reader may refer to it at any given time to review the phase's core components. Since each phase and subphase is likely to have a corresponding list of tasks requiring completion, each task may have one or more execution strategies. Some tasks and strategies will be discussed in detail, while others will only receive cursory mention. Strategy tables are provided to summarize the elements and rationale for each strategy so as to enable the reader to select an
Chapter 6. WebSphere Commerce site development methodology
183
appropriate one to complete a task. Please note that the development methodology may accommodate many strategies, so the reader is encouraged to develop strategy tables, using the templates provided, when building project plans. Also, the reader is encouraged to assess and review all strategies first, prior to selecting one to proceed with. The following recommendations will aid your developing appropriate project plans: It is very important that the main phases of the project development methodology should never be ignored or skipped when building a project plan. In principle, the subphases of this methodology can be combined, overlapped, deleted, replaced with other subphases, or supplemented by new subphases to suit project needs. The list of tasks and strategies that are specified in this redbook represent a subset of the possible tasks and strategies that could be applicable during a project. We would recommend adding new and relevant tasks and strategies when creating a project plan. Prior to customizing any subphases, fully assess the associated advantages and disadvantages of the customizations. All the tasks and strategies listed in this redbook are based upon best practices gained from direct experience.
6.4.5 Case studies While describing the various phases and tasks of the development methodology, we provide examples to aid your understanding the phase or task. Many of the examples were inspired by case studies of real projects. The examples will provide concrete scenarios for you to use and adapt during your planning efforts.
6.5 Related methodology concepts This redbook uses specific terminology to describe a WebSphere Commerce development methodology. The terms are in common use within the Toronto-based IBM Software Services commerce team, and originate from IBM Global Services terminology, subsequently adapted for WebSphere Commerce implementation projects. We consider other methodologies used within IBM or as part of engagements where IBM consultants work with customers on implementation projects. The literal terms used in this redbook are less significant than the concepts they embody, with the proviso that all consultants and developers working on a project must have an agreed and common understanding of the terms being used.
184
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Note: It is not possible to provide significant detail for the methodologies within the scope of this redbook. In deciding the methodology and terminology to be used, the starting point should be to assess: Project team and customer team familiarity with existing methods and terms The match between the conceptual model that underpins the method and the project requirements For example, a project team that has worked with the customer team on previous projects is likely to have developed their own local interpretation or ”dialect” of terms that have evolved as an optimized amalgamation of standard methods and terms. It would be unwise to discard the procedural and teaming benefits of this localization, as long as the basic rigor of the method is maintained. Similarly, a methodology that focuses on code implementation using an object-oriented model may be inappropriate to use on a project that simply requires re-configuration of standard components rather than development of code using an object-oriented language.
6.5.1 IBM Method Not surprisingly, IBM has a well-established discipline for managing development projects. Within that context, there will be development methodologies that are optimized according to the nature of the project work. For example, the process of designing and developing a system performance assessment tool may have differences when compared with the design and development of an embedded hardware component for a point-of-sale terminal. The intent is to ensure that a balance is found between a process that is insufficiently structured and so allows freedom and flexibility but is hard to measure and document, against a process which is too structured and thus constrains creativity and which may be bureaucratic or slow.
6.5.2 Rational Unified Process® (RUP®) The Rational Unified Process (RUP) is a software engineering process. Its purpose is to provide a disciplined approach to identifying and assigning tasks and responsibilities within a development project. RUP is intended to be configurable according to project circumstances. The complexity of most significant development projects make it unlikely that a simple sequential development model will succeed; rather an iterative process
Chapter 6. WebSphere Commerce site development methodology
185
must be applied where earlier steps will be revisited and refined in the light of subsequent understanding and progress on the problems and tasks. RUP supports iterative development in several ways, for example using frequent test releases of code or assets to allow customer testing, verification, and feedback. RUP identifies four development phases:
Inception Elaboration Construction Transition
Table 6-1 shows how the RUP phases correspond approximately to the phases identified within this redbook. Table 6-1 Comparison between RUP and e-commerce RUP
e-commerce methodology
Inception
Pre-sales
Elaboration
Design phase * Solution outline * Macro design * Micro design
Construction
Implementation and testing * Project implementation * Functional Verification Test * System Integration Test * System Verification Test * User Acceptance Test
Transition
Site deployment and launch
6.6 Summary In this chapter, we defined a project development methodology that can be used to develop new e-commerce sites or to transition existing sites built with earlier versions of WebSphere Commerce software. Having reviewed this chapter, you should be able to: Describe the core phases of the development methodology Define key development terms and concepts Discuss relevant deployment conditions
186
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
7
Chapter 7.
Development environment and build cycle In past releases of WebSphere Commerce, customers had the burden of inventing a development and team environment that worked best for their environment. This can be a very costly and time-consuming process and the skill and knowledge level required to architect such a framework is demanding. Previous versions of WebSphere Commerce Studio (VisualAge for Java and WebSphere Studio “classic”) did not support an integrated and well-defined team environment that was reliable and provided an efficient build environment. The environments for development, build, and team are closely related, thus we will describe them together. With the help of the team environment support in WebSphere Studio Application Developer, it is now possible for team members to do their work in their own workbenches, and merge work into a team repository. The build environment can retrieve the latest changes and produces a driver that can later be used for testing and production. This chapter includes the following sections:
WebSphere Commerce Studio overview Team development environment overview Build environment overview Deployment overview
© Copyright IBM Corp. 2003. All rights reserved.
187
7.1 WebSphere Commerce Studio overview Developing or programming is an activity in which you produce code artifacts (or components) according to various design and coding specifications. A development environment is a programming environment where an integrated development workbench tool, such as WebSphere Studio Application Developer, is used for coding, debugging, and unit testing. The development package for creating customized code to be used with WebSphere Commerce is called WebSphere Commerce Studio. This product package includes all the tools required to create customized code and perform Web development tasks. With this development environment, you can create customized code and test it within the context of the WebSphere Test Environment. There are four main components of WebSphere Commerce Studio:
WebSphere Commerce Studio workspace WebSphere Commerce Studio plug-ins Development environment WebSphere Commerce instance database File system assets
7.1.1 WebSphere Commerce Studio workspace Before getting into the design details of the WebSphere Commerce Studio workspace, let us review what a J2EE application server is. The application server collaborates with the Web server to return customized responses to client requests. Application code including servlets, JavaServer Pages (JSPs), Enterprise JavaBeans (EJB) components, and their supporting classes run in an application server. In keeping with the J2EE component architecture, servlets and JSPs run in a Web container, and enterprise beans run in an EJB container. In WebSphere Application Server, a J2EE application is represented by, and packaged in, an enterprise archive file, called an EAR. Once you have the EAR file created, then you are ready to deploy the application to a J2EE application server. The WebSphere Commerce Server is a J2EE application that has: Presentation layer: Consists of a number of Web modules, running in the Web container. Processing layer: Consists of a group of EJB modules, running in the EJB container. WebSphere Studio Application Developer has a similar EAR concept to represent a J2EE application; it is done via the concept of a workspace. Each
188
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
J2EE artifact in the EAR file can be mapped to a corresponding J2EE project in WebSphere Studio Application Developer.
Figure 7-1 WebSphere Commerce Studio EJB, Web modules
The WebSphere Commerce Studio workspace is composed of a number of EJB, WAR, and Java projects (see Figure 7-1). Each business component in WebSphere Commerce Server can be grouped into one or more sets of projects.
Chapter 7. Development environment and build cycle
189
Only for Studio
Presentation Layer
Organization Administration
Commerce Accelerator
Stores
Proxy Proxy
Trading
Proxy
Payment
Member
Merchandising
Marketing
Catalog
Order Management
Site Administration Processing Layer
Proxy
Enablement Figure 7-2 WebSphere Commerce presentation and processing layers
The idea is to have a clear separation between the presentation layer and the processing layer (see Figure 7-2):
Presentation layer that runs in the Web container JSP, HTML, static images, JavaScript Processing layer that runs in the EJB container Data objects - session and CMP entity EJBs Logic code - commands and data beans
Processing layer The WebSphere Commerce Server is composed of the following subsystems:
Catalog Marketing Merchandising Member Order Management Payment Trading Enablement
The Enablement subsystem is the foundation of the product that the other subsystems depend on. Within each subsystem, there are several business components that further partition the subsystem into many related but functionally different models. The WebSphere Commerce Studio workspace provides a logical breakdown of these business components and presents a
190
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
structure inside of WebSphere Studio Application Developer for the purpose of code customization. Each business component in WebSphere Commerce Studio can be grouped into one or more set of projects. Each of these project groups exists in pairs - for each EJB project, there should be a corresponding Java project. All EJB data objects for a particular subcomponent go into an EJB project, and for the rest of its business-related logic non-EJB codes, they go into a Java project. An EJB project and a Java project for customization have been created and configured to run with the WebSphere Commerce Server. All customization code should be placed into one of these two modules, depending on the type of Java code being put in.
Presentation layer There are four Web projects in the WebSphere Commerce Studio workspace:
Commerce Accelerator Organization Administration Site Administration Stores
There is no Java code placed inside of these Web modules; only JSPs are put in here. A special type of Web server alias proxy project is introduced to handle Web server aliases. These special Web alias proxy projects are only needed for the WebSphere Test Environment and cannot be exported along with the EAR file to the WebSphere Application Server runtime environment. The main reason for introducing this type of project is because WebSphere Studio Application Developer WebSphere Application Server lacks the ability to interact with Web servers and therefore static images, JavaScript, and HTML pages used in a Web alias cannot be resolved. A Web alias proxy project is indeed a Web project with the context root set to serve the required Web alias. Within the project is a simple file-serving servlet that is used to handle loading file assets from other Web modules. Only one Web alias can be served per Web alias proxy project.
Workspace elements The WebSphere Commerce Studio workspace is a collection of EJB, Web, and Java projects. Each of these projects consists of a mixture of both binary and source files. Source files are only shipped and packaged into the WebSphere Commerce Studio workspace if they belong to public components, which you can customize or make extensions to. Binary files on the other hand are included, but
Chapter 7. Development environment and build cycle
191
in a separate binary folder, in order to get the product to work properly and for the source code to compile successfully. The following few sections describe the structure of each WebSphere Commerce Studio project type and their contents.
EAR projects The structure of EAR projects is as follows: EAR project META-INF/ application.xml ibm-application-ext.xmi lib/ *.jar properties/ *.properties .project An Enterprise Application project contains the hierarchy of resources that are required to deploy an enterprise (J2EE) application. It can contain a combination of Web modules, EJB modules, JAR files, and application client modules. It includes a deployment descriptor and an IBM extension document as well as files that are common to all J2EE modules that are defined in the deployment descriptor. Enterprise Application projects are exported as EAR (enterprise archive) files that include all files defined in the Enterprise Application project as well as the appropriate module archive file for each J2EE module project defined in the deployment descriptor, such as Web archive (WAR) files and EJB JAR files. The following two files are created in the EAR project: application.xml Deployment descriptor for the enterprise application, as defined in J2EE 1.3. This file is responsible for associating Web and EJB projects to a specific EAR file. An editor is also provided for this file that is launched either by double-clicking the file in the navigator, or selecting the EAR file in the J2EE view and choosing the Open in Editor item from the context menu. ibm-application-ext.xml IBM-specific extensions to the enterprise application. Similar to those defined in ibm-web-ext.xml Web module extension file, but with scope across the whole application.
192
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
As the name of the project already indicates, only application level resources can be found here. What goes into the lib directory is the third-party JARs, the application level utility JARs and properties files.
Web project The Web project structure is as follows: Web project Java Source/ *.properties Web Content/ META-INF/ MANIFEST.MF WEB-INF/ classes/ *.properties lib/ ibm-web-bnd.xmi ibm-web-ext.xmi web.xml images/ *.jpg *.jsp *.html .classpath .project A WAR file has a specific hierarchical directory structure. The top-level directory is the document root of the application. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored. The document root contains a subdirectory called WEB-INF, that contains the web.xml deployment descriptor, tag library descriptor files, classes, and lib directories. The Web project uses a J2EE directory structure in organizing the following folders and files: Java Source The source folder contains the project Java source code for properties files. When resources are added to a Web project, they are automatically compiled and the generated files are added to the Web Content/WEB-INF/classes directory. Contents of the source directory are not packaged in WAR files. Web Content The webApplication folder contains the contents of the WAR file that will be deployed to the server. It contains all the Web resources, including HTML
Chapter 7. Development environment and build cycle
193
files, JSP files, and graphics needed for the application. Any files not under Web Content are considered development resources, such as .java and .sql files, and will not be deployed when the project is unit tested or published. Web Content/WEB-INF The Web Content/WEB-INF folder contains the supporting Web resources for a Web application, including the web.xml deployment descriptor file and the classes and lib directories. – Web Content/WEB-INF/classes The Web Content/WEB-INF/classes folder contains the Java compiler output directory. The classes in this directory are used by the application class loader to load the classes. Folders in this directory will map package and class names. The .class files are automatically placed in this directory when the Java compiler compiles the source files from the source directory. Any files placed directly in this directory will be deleted by the Java compiler when it runs. – Web Content/WEB-INF/lib The Web Content/WEB-INF/lib folder supports .jar files that your Web application references. Any classes contained in these .jar files will be available for your Web application. The default directory structure in the Web project adheres to the J2EE specification. This specification defines a project directory structure that specifies the location of Web content files, class files, class paths, deployment descriptors, and supporting metadata. The Web project hierarchy mirrors that of the Web application created from a project. The Web Content folder contains all of your Web resources, including HTML, JSP, graphic files, cascading style sheet, web.xml (deployment descriptor), classes, and lib folders (not served directly to a client). For Web application development, the key files managed in a Web project are: web.xml Deployment descriptor for the Web module, as defined in J2EE 1.3. This file contains general information about the Web application, including servlet mappings, security information, and the welcome page. ibm-web-bnd.xml WebSphere bindings for the Web application. This file contains bindings to references used at the Web module level as defined by IBM. J2EE provides a mechanism to use local names for external resource objects. However, the J2EE specification does not define how these objects are referenced at runtime. This implementation is left to vendors to implement in their own way, and this file is IBM's implementation.
194
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
ibm-web-ext.xml IBM-specific extensions to the Web module. This file is used by WebSphere to support additional options beyond the J2EE specification such as reloading intervals, the default error page and if file serving is allowed and servlet invoking are enabled in the Web module. .classpath Application Developer uses this file to store metadata about the build path for the project when compiling Java classes and executing Java applications.
EJB project The core components of an EJB projects are source and binary folders, XML-based deployment descriptors, and industry standard files as seen in Example 7-1. Example 7-1 EJB project deployment descriptor EJB project ejbModule/ com/ibm/commerce/...../objects/EJBNameHome.java com/ibm/commerce/...../objects/EJBNameHome.class com/ibm/commerce/...../objects/EJBNameRemote.java com/ibm/commerce/...../objects/EJBNameRemote.class com/ibm/commerce/...../objects/EJBNameBean.java com/ibm/commerce/...../objects/EJBNameBean.class com/ibm/commerce/...../objects/EJBNameKey.java com/ibm/commerce/...../objects/EJBNameKey.class com/ibm/commerce/...../objects/EJBNameAccessBean.java com/ibm/commerce/...../objects/EJBNameAccessBean.class com/ibm/commerce/...../objects/EJBNameAccessBeanData.java com/ibm/commerce/...../objects/EJBNameAccessBeanData.class META-INF/ schema/ *.schxmi *.tblxmi ejb-jar.xml ibm-ejb-access-bean.xmi ibm-ejb-jar.bnd.xmi ibm-ejb-ext.xmi map.mapxmi MANIFEST.MF .imported_classes.jar .imported_sources.jar .classpath .project
Chapter 7. Development environment and build cycle
195
EJB projects allow you to organize your enterprise beans logically. As you develop EJB applications in the workbench, by default your source and output files will be kept in the ejbModule folder of the EJB project. As you make changes and generate deployment code, the Java classes are compiled into the ejbModule folder. .classpath Is the WebSphere Studio Application Developer internally used build time classpath for the EJB project. .imported_classes.jar Is the binary JAR for the production version of byte code within the EJB project. No source files will be found inside of it. On an EJB JAR export, the contents of the .imported_classes.jar are merged into the resulting EJB JAR. That is, the exported JAR file will be a single archive that contains the merged contents of the Java output folder of the EJB project and the .imported_classes.jar. Here, in the case of name collisions, the project contents take precedence over files inside of the .imported_classes.jar. The following four classes are used to compose a single entity EJB: EJBNameHome The home interface. This is a factory which is used to create and find instances of the EJB. EJBNameRemote The remote interface. This class determines which methods can be remotely invoked. EJBNameBean The bean class. This is where the logic is defined for the methods in the EJB. EJBNameKey The key class. Optional. When performing top-down persistence with simple keys, this is used to represent the unique key for the entity. Three additional classes are used for the above implementations. However, these files are placed in a separate Java package and will only be shipped as binary format without source code: EJBNameHomeBase The implementation of the home interface. EJBNameRemoteBase The implementation of the remote interface.
196
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
EJBNameBeanBase The implementation of the bean class. Each of these classes appear in the Navigator view as .java files in the package folder defined in the mapping wizard. Generated EJB metadata also shows that three additional XMI files are generated by the mapping wizard in our EJB project. These are as follows: ejb-jar.xml The deployment descriptor for this EJB module ibm-ejb-jar-bnd.xmi WebSphere bindings for the EJB module ibm-ejb-jar-ext.xmi WebSphere extensions for the EJB module map.mapxmi The mapping between the EJB and the database schema
EJB project - multiple database back-end support Before you can successfully run your enterprise beans on either a test or production server, you need to generate deploy code for the enterprise beans. The EJB Deploy tool provides an interface that you can use to generate enterprise bean deploy code. The tool employs a command-line environment that also allows you to run a build process overnight and have the deployment tool automatically invoked to generate your deploy code in batch mode. The EJB Deploy tool supports meet-in-the-middle mapping and EJB single and multiple table inheritance. However, mapping to multiple database back-end is only supported in EJB 2.0. For currently EJB 1.1 implementations, a metadata conversion tool is needed to switch from one database vendor to another. EJB 1.1 project metadata can contain only one vendor schema definition. See the Programmer's Guide for instructions on using this EJB metadata conversion tool.
Java project The Java project structure is as follows: Java project src/*.java META-INF/ MANIFEST.MF .imported_classes.jar .imported_sources.jar .classpath .project
Chapter 7. Development environment and build cycle
197
Utility JARs in the enterprise application are packaged as binary Java projects in the workspace. Because binary projects only exist in the workspace for reference during compilation and build, using binary projects can optimize your WebSphere Commerce Studio development environment. The following rules define a binary project: Java build path has no source container Project has exactly one JAR in the project, on the build path, and exported.
Server project A server project stores information about test and deployment servers and their configurations. The application testing and publishing tools feature of WebSphere Studio uses servers and configurations to test your projects. Servers identify where you can test your projects. Server configurations contain setup information. A server project has the following directory structure: The templates folder contains the source for server templates and configuration templates. Templates contain settings that may be used as a starting point when creating new servers or new configurations. WebSphere server configurations are created in folders that contain the settings for each particular server configuration.
7.1.2 WebSphere Commerce Studio plug-ins In addition to the WebSphere Commerce workspace that is provided, WebSphere Commerce Studio provides additional tools and plug-ins. The following plug-ins are provided: WebSphere Commerce Studio Configuration Manager plug-in WebSphere Commerce Studio online help plug-in WebSphere Commerce API reference information plug-in
WebSphere Commerce Studio Configuration Manager plug-in The Configuration Manager plug-in that assists with managing your WebSphere Commerce (and WebSphere Commerce Payments) instances (see Figure 7-3 on page 199).
198
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Figure 7-3 WebSphere Commerce Studio Configuration Manager plug-in
WebSphere Commerce Studio online help plug-in The WebSphere Commerce Studio online help plug-in allows you to access the WebSphere Commerce online help from within WebSphere Studio Application Developer. Additionally, with this plug-in, the WebSphere Commerce context-sensitive online help can be launched by pressing F1 when WebSphere Commerce tools (for example, the Administration Console) are running (see Figure 7-4 on page 200).
Chapter 7. Development environment and build cycle
199
Figure 7-4 WebSphere Commerce Studio online help plug-in
WebSphere Commerce API reference information plug-in The WebSphere Commerce API reference information plug-in allows you to access the WebSphere Commerce API reference information from within WebSphere Studio Application Developer (see Figure 7-5 on page 201).
200
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Figure 7-5 WebSphere Commerce API reference information plug-in
7.1.3 Custom code packaging and incremental deployment After you have created customized code in WebSphere Commerce Studio and have tested it within the WebSphere Test Environment, you must deploy it to a WebSphere Commerce instance running outside of the WebSphere Test Environment. This WebSphere Commerce instance can run locally on your development machine, or it can be on another machine (using the same or a different operating system). To help alleviate some of the pain in custom code deployment, a new method of deployment, called incremental deployment, has been introduced.
Custom code packaging Before beginning the deployment topic, you need to understand how WebSphere Commerce has changed its packaging structure to implant the hooks for incremental deployment. An EJB project and a Java project for customization have been created and configured to run with the WebSphere Commerce Server. All customization code should be placed into one of these two modules, depending on the type of Java code being put in.
Chapter 7. Development environment and build cycle
201
Incremental deployment In an incremental deployment, you must already have a WebSphere Commerce enterprise application installed on the target WebSphere Commerce Server. Then in the deployment process, you only deploy those assets (commands, data beans, enterprise beans and more) to the existing enterprise application. The benefits of incremental deployment are as follows: Fast A small migration window implies less downtime in the target server. Reliable Since you are only adding new code to the placeholder of the WebSphere Commerce instance, less configuration increases the chances of success of each deployment. Traceable The isolation between your assets and WebSphere Commerce allows you to keep a change history of your incremental deployment. This helps you to track down specific issues that you have encountered during deployment or runtime and therefore is more service friendly.
7.2 Team development environment overview Application development teams are becoming even more distributed, more diverse, and under more pressure to deliver solutions quickly. It is critical to have a development environment that can support these needs while also addressing personalized requirements. The team development environment for WebSphere Studio Application Developer includes pluggable repositories instead of a proprietary repository, and is able to support an optimistic concurrency team model. The move away from a proprietary repository to a file-based system offers the following improvements: Easier integration of favorite tools since you can work directly in the file system More flexibility in source management and team development No duplication of data in the file system and the workbench Team developers do all of their work in their individual workbenches, isolated from others, and then periodically submit changes to a team stream. This model allows individual developers to work on a team project, share their work with others as changes are made, and access the work of other developers as the
202
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
project evolves. At any time, developers can update their workbenches by retrieving the changes that have been made to the team stream or by submitting changes to the team stream.
7.2.1 Optimistic team model An optimistic model is one where any member of the team can make changes to any resource that one has access to. Because two team members can release the stream changes to the same resource, conflicts can occur (see Figure 7-6) and must be dealt with. In WebSphere Studio Application Developer, conflicting incoming and outgoing changes are detected automatically. This model is termed optimistic because it is assumed that conflicts are rare.
Optimistic Model - Ideal Initial Development
Change #2
Developer 1 Release
Catch-up
Release
Stream Catch-up
Catch-up
Release
Developer 2 Time
Change #1
Optimistic Model - Conflict (Rare) Change #3
Developer 1 Catch-up V1.3
Release V1.4
Stream Merge V1.4 and Release V1.5
Developer 2 Change #4
Time
Figure 7-6 Optimistic team model
Chapter 7. Development environment and build cycle
203
One of the key features in the team environment of WebSphere Studio Application Developer is the synchronization process. In an optimistic team mode, conflicts are assumed to be at the lowest level. Resource owners have to follow a certain set of guidelines to make sure that this assumption holds. For instance, drastic changes such as changing resource names or removing resources should only be done at a certain time of a week and need to be coordinated. When you make changes in the workbench, resources are saved locally. Eventually you will want to release your changes to the stream so others can have access to them. Meanwhile, others may have released changes to the stream. You will want to catch up these resources in the workbench. It is preferable to catch up before releasing changes, in case there is a conflict with the resources in your workbench and the resources currently in the stream. This model supports groups of highly collaborative developers who work on a common base of files and who frequently share their changes with each other. It also supports developers who work offline for long periods, connecting to their repository only occasionally to synchronize with the stream.
7.2.2 Ideal work flow No resource is an island. Usually resources do not exist in isolation; they typically contain implicit or explicit dependencies on other resources. As resources are released to the stream, these dependencies can be affected. Ensuring the integrity of the dependencies is important because the stream represents the current project state: at any point a team member could take the stream contents as a basis for new work. The ideal workflow therefore is one in which the stream integrity is preserved. Of course, under certain conditions you may be confident that the incoming changes do not affect you and choose to release without catching up. However, in general team members should make an effort to follow a flow similar to the following in order to ensure that the stream integrity is not accidentally compromised.
Start fresh Before starting work, get caught up with the current stream state. If you are sure that you have no local work that you care about, the fastest way to get caught up is to select the projects you are interested in from the stream or code server. This will blanket overwrite your local resources with those from the stream.
Make changes Work locally in your workbench, creating new resources, modifying existing ones, saving locally as you go.
204
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Synchronize When you are ready to release your work, synchronize with the stream. There are two distinct processes involved in synchronizing resources, catch up and release. When you make changes in the workbench, resources are saved locally. Eventually you will want to release your changes to the stream so others can have access to them. Meanwhile, others may have released changes to the steam. You will want to catch up these resources in the workbench. It is preferable to catch up before releasing changes, in case there is a conflict with the resources in your workbench and the resources currently in the stream.
Conflicts Conflicts arise when you have locally modified a resource for which a more recent version is available in the stream. In this situation you can choose to do one of three things: Catch up the resource from the stream. Release your version of the resource to the stream. Merge your work and the stream resource. Typically you will want to merge, because the other two options will result in loss of work.
Catch up Examine incoming changes and add them to your local workbench. This allows you to determine if there are changes that might affect the integrity of what you are about to release. Resolve conflicts, retest, and run integrity checkers to ensure your code compiles and executes properly.
Release Now that you are confident that your changes are well integrated with the latest stream contents, release your changes to the stream. To be prudent, you may need to redo the synchronize process if there are again new incoming changes.
7.2.3 Source control management Source Control Management (SCM) is the process of managing the source code for your applications. It is the method whereby you: Securely and safely store the source for your applications Manage changes to this source code Promote changes to the source code through the various stages of application development
Chapter 7. Development environment and build cycle
205
Control the version, release and modification level of the source code Manage the build/compile step of creating executable applications from the source code Typically when we think of Source Control Management, we think of the tools that provide this sort of function - the basic synchronization check in-check out library control systems that prevent the changes of one developer from overwriting the changes created by another developer. In many IT environments, SCM tooling is pervasive. If you have source code and you modify applications, it is assumed that you are using SCM tooling to manage your development process. Version control systems provide two important features required for working in a team: A history of the work submitted by the team A way to coordinate and integrate this work Maintaining history is important so that one can compare the current work against previous efforts or revert to older work that is better. Coordinating the work is critical so that there exists one definition of the current project state, containing the integrated work of the team. This coordination is provided through the stream model.
Concurrent Version System (CVS) Concurrent Version System (CVS) is a version control system that can be used to record the history of your source files. WebSphere Studio Application Developer is shipped with a built-in client for the Concurrent Version System. With this client you can access CVS repositories. You could of course save every version of every file you have ever created. This would, however, waste an enormous amount of disk space. CVS stores all the versions of a file in a single file in a clever way that only stores the differences between versions. CVS also helps you if you are part of a group of people working on the same project. It is all too easy to overwrite each other's changes unless you are extremely careful. Some editors try to make sure that two people never modify the same file at the same time. Unfortunately, if someone is using another editor, that safeguard will not work. CVS solves this problem by insulating the different developers from each other. Every developer works in his/her own directory, and CVS merges the work when each developer is done.
Resources Resources is a collective term for projects, packages, folders, and files that exist in the workbench. The Navigator view provides a hierarchical view of resources
206
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
and allows you to open them for editing. Other tools may display and handle these resources differently. There are three basic types of resources that exist in the workbench: Files Comparable to files as you see them in the file system. Folders Comparable to directories on a file system. In the workbench, folders are contained in projects or other folders. Folders can contain files and other folders. Projects Contain folders and files. Projects are used for builds, version management, sharing, and resource organization. Like folders, projects map to directories in the file system.
Branches In CVS, teams share and integrate their ongoing work in branches. Think of a branch as a shared work area that can be updated at any time by team members. In this way, individuals can work on a team project, share their work with others on the team, and access the work of others during all stages of the project. The branch effectively represents the current shared state of the project. Resources can be changed in the workbench without affecting the branch. Individuals must explicitly provide their changed resources to the branch.
Versions Resources are versioned in order to capture a snapshot of the current state of the resources at one specific point in time. Resources in CVS are versioned by tagging them with a version label. When a resource is versioned, it means that a non-modifiable copy of it can be retrieved from the repository.
Updating While you are working on a project in the workbench, other members of your team may be committing changes to the copy of the project in the repository. To get these changes, you may update your workbench to match the state of the branch. The changes you will see will be specific to the branch that your workbench project is configured to share. You control when you choose to update.
Chapter 7. Development environment and build cycle
207
Committing You can commit workbench resources that you have modified to the repository so that other team members can see your work. Only those changes committed on that branch will be visible to others working on that branch.
Resolving conflicts When updating or committing you may encounter conflicts. A conflict occurs when you have locally modified a resource for which a more recent revision is available in the branch in the repository. Specifically, the branch will contain a revision newer than the base revision of your resource. In this situation, you can choose to do one of the following: You can take the change from the branch, discarding your local work. This could occur if you have made unintended changes locally, or if you realize that the revision in the repository is better than yours. Overwriting your local changes should be done with caution since you are in essence throwing work out. You can commit your change, including the revision in the repository. This should be done with great caution since you are in essence throwing away someone else's work. In particular, the change you are overwriting may have other dependencies in the branch (for example there may be other incoming changes which depend on the conflict). You can merge your work and the repository resource, saving the merged resource locally. You may then later choose to commit this merged result. Typically, you will want to take the third option, that is to merge, because of the loss of work issues with the other two choices.
7.2.4 Defect tracking Untracked defects can get lost for a while and then come out to bite you. Nobody likes bad surprises so it is wise to keep everyone informed. Tracked defects are a great measure of quality; it helps to manage resources by focusing on the most important problems. Defect tracking is a process to record and track problems that are found in software development, to ensure that problems get fixed. It is an important part of the overall software quality practices and it aids in measuring quality and minimizing number and cost of defects. The point of creating a defect report is to get defects fixed. There are mainly eight components in an effective defect tracking system: 1. Defect repository
208
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
2. 3. 4. 5. 6. 7. 8.
Defects described Defects prioritized Structured resolution (tracking status) Communications Continuous defect resolution Defect evaluation and analysis Defect reporting
The following are fields that your tracking database should contain: Identifier or unique number Short description Date and time stamp Severity Priority Classification Status/state of the defect - open, working, closed, returned, or cancelled Originator name and department of person recording the defect Detailed description of the problem, how the test was conducted, and how to reproduce the problem History of defect life cycle
7.3 Build environment overview If you want to create a simple computer program consisting of only one file, you merely need to compile and link that one file. On a typical team project involving dozens, hundreds, or even thousands of files, however, the process of creating an executable program becomes more complicated and time consuming. You must build the program from its various components. A common practice is the daily build and smoke test process. Every file is compiled, linked, and combined into an executable program every day, and the program is then put through a smoke test, a relatively simple check to see whether the product smokes when it runs.
7.3.1 Benefits of daily build and smoke tests There are many benefits of daily build and smoke tests: Minimize integration risk
Chapter 7. Development environment and build cycle
209
One of the greatest risks that a team project faces when the different team members combine or integrate the code they have been working on separately is that the resulting composite code does not work well. Depending on how late in the project the incompatibility is discovered, debugging might take longer than it would have if integration had occurred earlier. Program interfaces might have to be changed, or major parts of the system might have to be redesigned and re-implemented. In extreme cases, integration errors have caused projects to be cancelled. A daily build and smoke test process keeps integration errors small and manageable, and it prevents runaway integration problems. Reduce the risk of low quality Related to the risk of unsuccessful or problematic integration is the risk of low quality. By minimally smoke testing all the code daily, quality problems are prevented from taking control of the project. You bring the system to a known, good state, and then you keep it there. You simply don't allow it to deteriorate to the point where time-consuming quality problems can occur. Support for easier defect diagnosis When the product is built and tested every day, it's easy to pinpoint why the product is broken on any given day. If the product worked on Day 17 and is broken on Day 18, something that happened between the two builds broke the product. Improve morale Seeing a product work provides an incredible boost to morale. It almost doesn't matter what the product does. Developers can be excited just to see it display a rectangle! With daily builds, a bit more of the product works every day, and that keeps morale high.
7.3.2 Concepts of daily build and smoke tests The idea behind this process is simply to build the product and test it every day. The following is a list of key concepts of this idea: Build daily The most fundamental part of the daily build is the daily part. Treat the daily build as the heartbeat of the project. If there's no heartbeat, the project is dead. Different developers' code can be allowed to get a little out of sync between these pulses, but every time there is a sync pulse, the code has to come back into alignment. When you insist on keeping the pulses close together, you prevent developers from getting out of sync entirely. Some organizations build every week, rather than every day. The problem with this is that if the build is broken one week, you might go for several weeks
210
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
before the next good build. When that happens, you lose virtually all of the benefit of frequent builds. Smoke test daily The smoke test should exercise the entire system from end to end. It does not have to be exhaustive, but it should be capable of exposing major problems. The smoke test should be thorough enough that if the build passes, you can assume that it is stable enough to be tested more thoroughly. The daily build has little value without the smoke test. The smoke test is the sentry that guards against deteriorating product quality and creeping integration problems. Without it, the daily build becomes just a time-wasting exercise in ensuring that you have a clean compile every day. Establish a build group On most projects, tending the daily build and keeping the smoke test up to date becomes a big enough task to be an explicit part of someone's job. Check for broken builds For the daily build process to work, the software that is built has to work. If the software is not usable, the build is considered to be broken and fixing it becomes top priority. Each project sets its own standard for what constitutes breaking the build. The standard needs to set a quality level that is strict enough to keep show-stopper defects out but lenient enough to disregard trivial defects. Undue attention could paralyze progress. Here is a list of minimum criteria of a good build: Good builds should compile all files, libraries, and other components successfully. Good builds should not contain any show-stopper bugs that prevent the program from being launched or that make it hazardous to operate. Good builds should pass the smoke test. Create a penalty for breaking the build. Most groups that use daily builds create a penalty for breaking the build. Make it clear from the beginning that keeping the build healthy is the project's top priority. A broken build should be the exception, not the rule. Insist that developers who have broken the build stop all other work until they have fixed it. If the build is broken too often, it is hard to take seriously the job of not breaking the build.
Chapter 7. Development environment and build cycle
211
7.3.3 Build automation for daily builds and smoke tests If there is to be engineering in construction, the process must be consistent and repeatable. Without consistency, it is hard, if not impossible, to know how to build, test, or ship someone else's software. Without repeatability, it is hard to guarantee the results of a build or a test. The simple answer is discipline. The process of constructing software must be disciplined if it is to succeed. But people do not seem to come that way; in general, people find discipline hard to take, and even harder to maintain. Fortunately, there is a pragmatic solution: automate everything you can, so that the development environment itself provides the kind of disciplined repeatability and consistency needed to make the process run smoothly and reliably. This approach leaves developers free to work on the more creative side of software construction, which makes the programmers happier. At the same time, it makes the accountants happier by creating a development organization that is more efficient and less prone to costly human-induced errors and omissions. If you do nothing else, make sure that every developer on a project compiles their software the same way, using the same tools, and against the same set of dependencies. Make sure this compilation process is automated. This may seem obvious, but it is surprising how often it is ignored. We know teams where some developers compile using the automatic dependencies calculated by their IDE, others use a second IDE, and still others use command-line build tools. The result will be hours wasted every week tracking down problems that are not really problems, as each developer tests against subtly different executables generated by their own personal compilation system. Most automated build processes are performed on the computers of the build engineer or one of the developers. This approach is inherently flawed due to the lack of control over this environment. Here are some common problems that can occur with this approach: A virus on the build machine could be inadvertently included in a software build. Installation of new software or software updates on the build machine could change resources that are included in the software build. Uncontrolled access to the build machine could result in unauthorized changes to the software build, including potential malicious changes that could be difficult to detect. While an automated build process is an important step towards higher quality software, the only way to achieve complete control over the build quality is for the software to be built in a clean build environment.
212
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
We have barely scratched the surface of automation. Automation does not need to be restricted to the build, or even to just development. Perhaps your project has strict reporting requirements, review and approval processes, or other onerous secretarial chores. Where possible, try to automate these repetitive tasks as well. There is more to constructing software than just constructing software, and we can leverage automation throughout the process.
7.4 Deployment overview The complete application development life cycle includes many different processes, such as the actual coding of the solution, the management of source control in a team development environment, the build process, the test process, the final packaging and staging, the deployment process, and often the upgrade of applications after they are installed in the production environment. A successful deployment relies on more than development of the application and the final packaging process. For example, solutions of any substantial complexity need to be tested in a controlled environment, and the deployment process often benefits from the use of staging servers. You need to manage the deployment of your solutions between these environments, as well as to the final production environment. The following sections briefly describe the characteristics of each environment, and explain how to use them to ensure a successful deployment of your solution.
7.4.1 Development environment A successful deployment relies on more than development of the application and the final packaging process. For example, solutions of any substantial complexity need to be tested in a controlled environment, and the deployment process often benefits from the use of staging servers. You need to manage the deployment of your solutions between these environments, as well as to the final production environment. The following list briefly describes the characteristics of each environment, and explains how to use them to ensure a successful deployment of your solution: Software dependencies Dependencies required by your solution are present on the developer computers, but they may not be included or installed successfully in other environments. Some of these dependencies are present on your development computers simply because they are provided by the development tools, so you need to be aware of exactly what needs to be deployed to ensure successful installation into other environments.
Chapter 7. Development environment and build cycle
213
Repeatable deployment in different environments Application resources are created on developer workstations and servers, but they might not be successfully recreated or configured as part of the deployment to other environments. You need to thoroughly understand your application's architecture and any external resources that it uses if you are to deploy your solution successfully. Application configuration updates Applications are configured to use resources while they are being developed. When they are deployed to another environment, these configuration settings need to be updated so that they use the resources appropriate for that particular environment. Because many of these settings are stored in configuration files within the new framework, you need to manage the process of updating or replacing these configuration files as you deploy your solution from one environment to another.
7.4.2 Test environment This environment should be used to test the actual deployment process. You (or your test team) need to verify that application files and resources are installed to the correct locations, and that all configuration requirements are met before testing the solution's functionality. After you are satisfied that the application installs correctly, you (or your test team) can then perform tests that verify the solution functions as expected. To be certain that your tests have meaningful implications for how your solution will install and function in the live production environment, you should ensure that test computers resemble your production computers as closely as possible. They should not have the development tools installed that you used to produce the solution because that could mask potential problems that will only become apparent when you roll out your solution to the end users.
7.4.3 Staging environment This environment should be used to house your solution after it has been fully tested in the test environment. It provides a convenient location from which to deploy to the final production environment. Because the staging environment is often used to perform final tests and checks on application functionality, it should resemble the production environment as closely as possible. For example, the staging environment should not only have the same operating systems and applications installed as the production computers, but it should also have a similar network topology (which your testing environment might not have). Usually, the staging network mimics the production environment in all respects
214
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
except that it is a scaled-down version (for example, it may have fewer cluster members or fewer processors than your server computers).
7.4.4 Production environment This is the live environment where your solutions are put to work to provide benefits and functionality for the enterprise that uses them. This environment is undoubtedly the most complex, usually with many installed productivity, line-of-business and decision support systems used by different users in the organization. Consequently, it is the most difficult to manage and control; therefore, teams of administrators and information technology professionals are employed to ensure that users can take advantage of your applications along with solutions from other vendors.
7.4.5 Practice deployment and create backup plan Some of the biggest problems during the life cycle of a distributed application occur when your solution is rolled out to the production environment. The lack of rehearsal and planning for this event often leads to all of the involved parties attempting to breathe air into a lifeless application that does not work in the environment for which it was designed. Before going live, you need to rehearse the deployment in a clean environment with all of the participants present. You should take this opportunity to work out the little problems in a controlled environment without the added pressure of impacting production users. You can avoid the turmoil and embarrassment of a failed deployment by planning and documenting the production installation process and the contingency plans. You should create an environment on a clean system. It should not know about your application and test deployment. Starting from a well-known configuration, begin to clearly document every step involved in the installation of the distributed application. Note the location of the application files and the installation points. Pretend that you and your developers will not be there to troubleshoot during this process. Ensure that you have included small test scenarios that the installers can use as checkpoints to verify that the installation is going well. Lastly, document how to uninstall your application.
7.4.6 Production debug vs development debugging Every developer or support engineer debugs applications at some stage of their career, yet debugging is often viewed as an arcane and difficult topic. While it is often difficult to determine why an application is hanging, leaking memory, or crashing, there are techniques you can apply to make the debugging process more productive and efficient.
Chapter 7. Development environment and build cycle
215
The primary goal of debugging a system is to isolate and determine the root cause of a performance, configuration, or abnormal error condition that impedes normal system operation. Generally speaking, this goal holds true whether you are debugging in a development environment or in a production environment. However, there are crucial differences between the two environments. When debugging in a production environment, determining the root cause may be less important than simply getting the system into an operational state. Time constraints and business cases also differ between development and production environments. Debugging within a production environment is usually done within much tighter time constraints, given that the end user or customer may be losing revenue as a consequence of a non-operational system. In a production environment, the system experiences live operational loads and timing situations, which may be difficult or impossible to reproduce in a development environment. In addition, scenarios can arise that have not been anticipated during system design. Timing-sensitive or load-sensitive scenarios that lead to abnormal behavior can be difficult to reproduce or debug successfully, even during live operation in a production environment. Because physical access to a production system is often restricted, offline or remote-access techniques are required. In a development environment, you usually have access to an integrated development environment (IDE), source code, and debug versions of libraries and symbols. In a production environment, the IDE and source code are often not present, and you may only have access to release versions of libraries and symbols. Note that release versions of symbols are an invaluable resource, but are often not built during a normal product development life cycle. In a development environment, you often have the luxury of using a full range of techniques to debug the system. That is not the case in a production environment, where it is essential to keep the system functioning while performing debugging. A production environment requires the following low-risk actions: Using non-intrusive debugging techniques, such as capturing performance information, and saving hang or crash dumps. Restricting the use of code changes, except in the case of critical problems. This means that you can't normally experiment using code modification to isolate root causes in production environments. Adjusting the testing level to the user's comfort level. This may mean passing a system through a full battery of tests in a development environment, or simply ascertaining if the system is still running.
216
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Debugging a problem typically involves two phases. The initial discovery phase is used to gather information about the problem. This leads to a debugging phase, when you attempt to determine the cause of the problem. Discovery phase Most developers are familiar with the debugging phase, yet the discovery phase is equally important to production-level debugging. The goal is usually to capture the state of the server and then allow the server to continue functioning. Debug phase The debug phase may involve live or post-mortem debugging. Live debugging involves stepping through the code as it executes and looking for bugs or defects. Post-mortem debugging involves the analysis of data or program dumps produced by tools. One advantage of post-mortem debugging is that it uses data gathered from a real problem occurrence, instead of relying on a dedicated programmer to interactively step through the code and try to reproduce the problem. Choosing the right debugger depends on the environment and whether you're dealing with native or managed code.
Chapter 7. Development environment and build cycle
217
218
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
8
Chapter 8.
Globalization guidelines This chapter provides in-depth coverage of the globalization capabilities in WebSphere Commerce, and highlights the tools and techniques necessary to create global e-commerce sites. The chapter includes the following topics:
Introduction to globalization Globalization in WebSphere Commerce Cultural considerations WebSphere Commerce application model Globalized catalog content Globalized store design Globalized tools framework Globalization in the messaging system Globalization tips
© Copyright IBM Corp. 2003. All rights reserved.
219
8.1 Introduction to globalization This section provides an introduction to what globalization is and why it is important to businesses that need to operate in a global environment.
What is globalization Globalization (G11N) is the proper design and execution of systems, software, services, and procedures so that one instance of software, executing on a single server or end-user machine, can process multilingual data and present data culturally correctly in a multicultural environment such as the Internet. At its core, globalization can be defined as follows: Globalization = Internationalization + Localization + Multilingual Support Internationalization (I18N) The process of producing a product (design and code) that is totally free of any dependency on the language, script, culture, and coded character set. Strictly speaking, an internationalized product is not usable in any region of the world unless it is localized to that specific region. Localization (L10N) The process of adapting an internationalized product to a specific language, script, cultural, and coded character set environment. In localization, the same semantics are preserved while the syntax may be changed. Multilingual support The process of supporting multiple languages, either concurrently or one language at any given time. A multilingual program strives to handle data in a way that is not dependent on a particular language or writing system. Multilingual documents combine text that is written in different languages. Multilingual may refer to many languages that all use the same script, (such as English, French, and German), or to many languages that use distinct scripts (such as German, Hebrew, and Korean). The latter case is also referred to as multiscript. Note: G11N or g11n is a commonly used abbreviation for globalization in the field of software development. The word starts with G and ends with N with 11 letters in between. It reads G eleven N. Similarly, I18N and L10N are abbreviations for internationalization and localization respectively.
Why globalization is important With the overwhelming acceptance and popularity of the Internet and its accompanying technologies, traditional business constraints, such as distance,
220
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
have disappeared. Companies and individuals can now do business with each other from almost any part of the world. With the help of the Internet, separate marketplaces are now being transformed into a single global marketplace. It is important that companies that want and need to operate globally create e-business software that meets new challenges, such as the following: Working with global information Data displayed to customers must meet customer expectations for content and language. This implies that data from different languages must be stored, retrieved, and manipulated without loss of meaning. Anticipating cultural norms It is important to provide information in the correct format to customers. Sellers that fail to address cultural norms run the risk of offending customers and losing sales. Applying logic to worldwide business issues Business issues such as the use of various currencies and taxation rules need to be addressed. Establishing and maintaining a cost-effective operation Deploying an e-commerce Web site for every region, may avoid some problems, but is prohibitively difficult to implement and maintain. A vast number of issues must be addressed when you enable software products for a global customer base. It is certainly not a simple matter of translation or format. Globalization is, therefore, necessary whether the product is translated or not. To take full advantage of the available opportunities that a single global marketplace has created, companies must tailor their e-commerce sites to their new consumers in a wide range of regions. This means that developers of e-commerce sites must consider language, cultural differences, divergent business practices, and data storage methods so that the e-commerce site has the greatest possibility to maximize its potential.
8.2 Globalization in WebSphere Commerce The WebSphere Commerce product architecture has been designed with globalization in mind. Globalization permeates all components within WebSphere Commerce, as every level within an e-commerce application model is affected by globalization. Beneath translation and simple formatting, globalization touches much deeper levels of the user experience.
Chapter 8. Globalization guidelines
221
Before describing the rich set of globalization-capable features in WebSphere Commerce, it is worthwhile to list some of the common challenges that impede the development and deployment of a globalized e-commerce Web site: Storing data from different languages in a single database. For example, how do you store Korean, Japanese and German data in a single database? The availability of a single set of integrated cultural formatting functions. Lack of tooling to manage data in different languages and problems with organizing different national language data in a single database. Maintenance of multilingual assets (HTML, GIF, JSP, etc). Globalizing business logic. For example, taxation and shipping rules, marketing campaigns, etc. Cultural customization for page look and feel. Recognizing the challenges, WebSphere Commerce needed to provide out-of-the-box globalization capabilities that include cultural norms, data, business logic, and maintenance.
Data An immediate advantage provided by WebSphere Commerce at the most basic stage of globalization is that data is stored in Unicode, thus enabling developers to store, retrieve, and display data from different languages simultaneously on the Web site. Also, language-sensitive data is fully separated from nonsensitive common data within the database design.
Cultural norms Leveraging the inherent globalization functionality of Java technology, WebSphere Commerce provides a suite of functions to accommodate cultural differences. The WebSphere Commerce Server software is fully enabled for multiple cultures so that sellers can ensure data is retrieved and presented in the cultural contexts anticipated by their customers. Also, the recommended JavaServer Pages (JSP) model of using culturally neutral master JSP templates provides tremendous advantages to customization and maintenance. The custom currency formatting capabilities provided by WebSphere Commerce currency manager allow sellers to customize formatting on a per-currency, per-store, per-country basis and/or display more than one currency simultaneously.
222
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Business logic WebSphere Commerce provides its customers with many of the tools needed to set up and easily deploy a global online business, by supporting a set of business logic features. Taxation and shipping editors available from the WebSphere Commerce Accelerator allow sellers to define proper tax and shipping calculation rules based on a customer’s physical location. Other tools include wizards to create and maintain global fulfillment centers to model real-life fulfillment systems, and product management tools that help to rapidly set up store catalogs for global store fronts.
Maintenance With the use of Unicode, WebSphere Commerce removes the traditional data management restrictions that in the past prevented the combination of data from different languages from being stored in a single database. Also, WebSphere Commerce provides a complete set of culturally neutral database management and content management tools to properly manage multilingual data. Those tools eliminate the need to procure separate tools for different geographies. Figure 8-1 on page 224 displays a summary of the features, functions, and benefits provided by WebSphere Commerce.
Chapter 8. Globalization guidelines
223
Maintenance
Database population and management tools Content management tools Seller-level tools JSP templates and store models
Easy maintenance of multilingual database data, static HTML or store information Reduced JSP maintenance Rapid site development for new languages
Business logic
Taxation wizard Shipping wizard Fulfillment Centers Campaigns and discounts
Realistic taxation and shipping charges based on customer jurisdiction Accurate modeling of real-life fulfillment systems Multilingual marketing initiatives
Cultural norms
Multiculturally enabled commands, beans and rules templates Inherited functions provided by Java components for data formatting Currency formatting functions Language and currency selected independently Single JSP design model
Automatic multilingual data manipulation and retrieval Automatic data formatting Dual currency display and customized currency formatting Easy language and cultural customizations for page look and feel
Data
Unicode database (UTF-8) Language and cultural data separation within database design Automatic code page conversion for multilingual data entry, storage and retrieval
Ability to store and manage data in different languages in a single database (Korean, German, Chinese) Database design for easy storage of multicultural data Accurate management of multilingual data to ensure no corruption
Most Difficult
Least Difficult
Figure 8-1 Globalization features in WebSphere Commerce
8.3 Cultural considerations In software development, cultural formatting refers to the selectibility of culturally sensitive information such as a country's numeric format, monetary format, date and time formats, and calendar format. Such information varies from one region to another, and thus the software application cannot mandate any cultural formats.
224
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
We discuss the following cultural considerations in this section: Date and time formatting Currency and number formatting Name and address formatting Both the WebSphere Commerce Server runtime infrastructure and tools framework provide an extensible and customizable set of globalized user interface (UI) functions that allows programmers to quickly implement a full-featured UI with a culturally sensitive look and feel. By using existing elements, a programmer's efforts are greatly reduced. In the following two subsections we describe some of those elements.
8.3.1 Date and time formatting This section includes date and time formatting information.
Date format The date format presents the day, month, and year of a particular calendar system. Even when one specific calendar system is considered, there is no single world wide standard for the presentation of date information. Table 8-1 lists the date formats of the locales of the 10 languages to which WebSphere Commerce is translated. Note: The Gregorian calendar is very common and used throughout the world, but there are other calendar systems used widely in some parts of the world, such as the Hijri and Thai calendars. Table 8-1 Sample date formats Locale
Common Format
Long Format
Short Format
United States English
04/10/98
April 10, 1998
04/10/98
Brazilian Portuguese
10/04/1998
10 de Abril de 1998
10/04/98
Simplified Chinese
1998Year4Month10Day
1998Year4Month10Day
98-4-10
French
10/04/1998
10 avril 1998
10/04/98
German
10.4.1998
10. April 1998
10.04.98
Italian
10/04/1998
10 aprile 1998
10/04/98
Japanese
1998year 4month 10day
1998year 4month 10day
1998year 4month 10day
Chapter 8. Globalization guidelines
225
Locale
Common Format
Long Format
Short Format
Korean
1998/04/10
1998year 4month 10day
98/04/10
Spanish
10/04/1998
10 de abril de 1998
10/04/98
Traditional Chinese
1998Year4Month10Day
1998Year4Month10Day
98.4.10
Note: The underlined text in Table 8-1 is in the native language. For example, 1998year 4month 10day implies that year, month, and day are in the native language and not English. Table 8-2 lists the elements of the date format that make the date format unique in different regions of the world. Table 8-2 Date format elements used for presentation Element
Description
Date delimeter
Delimiters in date representation differ around the world. The following are some examples of delimiters used in dates Space Hyphen Forward slash Period (full stop)
Order of date components
The order of the day, month, and year differs around the world.
Day format
A zero may fill in the day if it is a single-digit day.
Month format
The month may be numeric, abbreviated, or fully spelled out.
Year format
The year format may have 2 digits or 4 digits.
In WebSphere Commerce, either the long format or short format is usually used. Using the WebSphere Commerce Tools Framework Calendar UI element, developers can display a calendar to the user and allow them to graphically or manually enter a date. This date is then returned to the calling window and placed in the correct field. The user's input is presented in text boxes. Because those text boxes have labels attached to them, there is no ambiguity in identifying which numbers are the year, month, and day respectively. Thus, cultural formatting is not required. Figure 8-2 on page 227 displays an example of an embedded calendar in WebSphere Commerce.
226
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Figure 8-2 Example of an embedded calendar in WebSphere Commerce
Time format The formats used for time differ around the world. Even though a software product may manipulate time information using a Timestamp, it should display time information to, and accept time information from, the user in the correct cultural context. Table 8-3 lists the time formats for the locales of the 10 languages to which the WebSphere Commerce product is translated. Table 8-3 Time formats Locale
Common format
Full format
Short format
United States English
2:45:16 PM
2:45:16 PM EST
2:45 PM
Brazilian Portuguese
14:45:16
14:45:16
14:45
Simplified Chinese
14:45:16
14hour45min16sec
14:45
French
14:45:16
14:45:16
14:45
German
14:45:16
14:45:16
14:45
Italian
14:45:16
14:45:16
14:45
Japanese
pm2hour45min16sec
pm2hour45min16sec
pm2hour45min16sec
Korean
2:45:16 PM or PM 2:45:16
2:45:16 PM KST or PM 2:45:16 KST
2:45 PM or PM 2:45
Spanish
14:45:16
14:45:16
14:45
Traditional Chinese
PM 2:45:16
pm2hour45min16sec
2:45 PM
Table 8-2 on page 226 lists the elements of the time format that make the time format unique in different regions of the world.
Chapter 8. Globalization guidelines
227
Table 8-4 Time format elements used for presentation Element
Description
Delimiters
Colon or period (full stop)
Format
Some countries display the leading zero in hours.
24-hour clock
Some countries use the 24-hour clock, while others such as the USA use the 12-hour clock with indicators AM/PM.
Note: The order of hours, minutes, and seconds does not change; the order is HH MM SS (with the appropriate delimiters). In the WebSphere Commerce Tools Framework, the functions used to validate dates are included in the web/JavaScript/tools/common/DateUtil.js JavaScript file. This file should be included in your JSPs. Always give the user the option to launch a calendar UI element. In case they enter the date manually, use the validDate (date) inside the DateUtil.js JavaScript file. The validTime() function is in Util.js. In WebSphere Commerce, the TimestampHelper class provides time and date formatting functions that are required by WebSphere Commerce tools and store development. The TimestampHelper() class is available in both com.ibm.commerce.utils (for tools framework) and com.ibm.commerce.ejb.helpers (for server runtime) packages to help perform the conversions described in Table 8-5. Table 8-5 Sample fconversions From
To
Timestamp
Date in yyyy-mm-dd
Timestamp
Time in hh:mm
Date and time
Timestamp
For example, TimestampHelper.getDateFromTimestamp(Timestamp t,Locale locale) will extract the date portion from the timestamp. The date will be returned in a locale-specific manner. Most of the WebSphere Commerce databeans are enabled to implicitly use the date/time formatting functionality of the TimestampHelper. One such data bean is described in Example 8-1 on page 229.
228
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Example 8-1 WebSphere Commerce DataBeans and usage of TimstampHelper
... ... ... ...
... ... ... // Get locale for formatting the date appropriately Locale jLocale = cmdcontext.getLocale(); // get the estimated ship date. Timestamp latestOrderAvailDate = orderBean.getFormattedEstimatedShipDate(); ....... .......
In the above example, the culturally formatted estimated ship date is retrieved by calling: Timestamp latestOrderAvailDate = orderBean.getFormattedEstimatedShipDate();
The above call is equivalent to: Timestamp latestOrderAvailDate = orderBean.getEstimatedShipDate(); String latestAvailableDate = TimestampHelper.getDateFromTimestamp(latestOrderAvailDate, jLocale);
8.3.2 Currency and number formatting The display of monetary amounts is often different from one country to another. Monetary values are usually accompanied by a currency symbol, which can exist in either the local currency symbols (for example,. $, , R$), or ISO 4217 international currency codes (for example, USD, EUR, BRL). Currency symbols may be placed before, within, or after the radix character of the monetary amount, and there may or may not be a space between the symbol and the
Chapter 8. Globalization guidelines
229
amount. Although, most countries use the comma or period as the decimal separator in currency, some countries, such as Japan, do not have a currency decimal separator. The rules for formatting numeric fields are not necessarily the same as the rules for formatting monetary amounts. Cultural formatting of numeric fields differs by country, since different countries use different positive and negative numeric representations for the same amount. The following list shows several ways to display the same numeric values: 1,234.56 .123 1,234,560,123 1.234,56 Negative number representation does not have a universal form. Some countries use a leading hyphen to denote negative non-monetary numbers. Some place the hyphen after the number, and some use another symbol altogether. The following list shows several ways to display the number negative fifteen:
¯15 -15 15(15) [15]
Note: Both the radix character and the commonly used term decimal separator have the same meaning. The radix character is more accurate since many countries do not use the dot symbol as the decimal separator.
There is much evidence that language and currency are orthogonal (not in sync) concepts. Canada is a prime example where there is a single currency, Canadian dollar, but two official languages, English and French. It is complex for businesses to operate in multiple currencies. Adding a language element increases this complexity and makes pricing and other currency-related tasks almost unmanageable in the WebSphere Commerce administration tools such as the Accelerator. A single default currency, which may be used as the basis for conversions or explicit pricing in other currencies, makes these operational tasks clearer and better matches business practices. Linking a store's default currency to its default language has no valid business relationship and thus it is not a valid currency defaulting method. For example, if you change the language it should not have to mean that you want the currency
230
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
changed. For this reason, the selection of language and currency are two separate tasks in WebSphere Commerce V5.5, as depicted in Figure 8-3.
Figure 8-3 Orthogonal concept of currency and language selection in FashionFlow store model
There is no way to define a one-to-one or one-to-many relationship between language and currency. Any given currency may be related to many languages (for example, Canadian dollar is related to both French and English), and any given language can be related to many currencies (for example, English is related to the US dollar, Canadian dollar, British Pound, etc.). In WebSphere Commerce, the shopping currency is the currency in which the shopper sees all prices. To determine the shopping currency of a shopper, the
Chapter 8. Globalization guidelines
231
following algorithm is performed by the currency engine named the Currency Manager: If the shopper's preferred_currency is specified and supported by the store, then shopping_currency = preferred_currency. If the shopper's preferred_currency is specified (and not supported) and it is the counter value for another_supported_currency, then shopping_currency = another_supported_currency. If ( shopping_currency == null) then shopping_currency = store's default currency (from STOREENT table - column SETCCURR which is nullable) is not language dependent. If( shopping_currency == null) then shopping_currency = default currency for the language (The SETCURR column of the STORELANG table) is language dependent. There are a few important points to highlight about the above algorithm performed by the Currency Manager: The use of the SETCCURR column of the STORELANG table is strongly discouraged, since it may be deprecated in a future release; the column is therefore backwardly compatibility only. Your store models should not set the SETCCURR column of the STORELANG table (set it to null). Migration from WebSphere Commerce Suite V5.1 to WebSphere Commerce V5.5, Business Edition will be accomplished by not setting the store's default currency in the STOREENT table (this will ensure the last step in the above algorithm is executed as in WebSphere Commerce Suite V5.1). Migrated stores can easily achieve the new behavior by setting the store default via the STOREENT table. The STORELANG table does not have to be changed. This allows some migrated stores to get the new behavior and some other migrated stores to keep the old behavior if they so desire. Either the SETCCURR column of the store object or the storeGroup object should be set via the STOREENT table. For migrated stores, this will not be the case initially. Any new stores should set the store/storeGroup default currency. Setting the store default currency will ensure that the last step of the algorithm above will not be executed. Currency formatting in WebSphere Commerce is dependent upon two items: the currency (ISO three-letter code) and the language ID, which we describe in a later section. Only by knowing both of these items can a currency be validated or formatted. Number formatting is dependent only upon the language ID. The Currency Manager makes all of the formatting information for numbers and currency values available in the WebSphere Commerce instance database. When the WebSphere Commerce instance application server is started, this
232
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
information is turned into JavaScript and becomes available for use as part of the WebSphere Commerce Tools Framework. These JavaScript functions are available by importing the web/tools/common/NumberFormat.jsp into your JSP. The functions perform the following tasks:
Validate a currency value Convert from currency value to numeric Convert from numeric to currency value Validate a number value Convert from number value to a numeric value Convert from a numeric value to a number value Note: You need to Include the Util.js file in your JSP when you include NumberFormat.jsp.
Table 8-6 lists some of the key JavaScript currency and formatting functions. Table 8-6 Currency and number formatting JavaScript functions Task
Integer
Number
Currency
Validate User Input (anything)
isValidInteger()
isValidNumber()
isValidCurrency()
Save (convert to JavaScript number)
strToNumber()
strToNumber()
currencyToNumber()
Display (format a JavaScript number for a given language)
numberToStr()
numberToStr()
numberToCurrency()
Note: If you are using the notebook, wizard, or dialog UI elements, the NumberFormat is already included in the parent frame. Example 8-2 shows a typical JavaScript currency entry form in a tools JSP. Example 8-2 Sample JavaScript currency entry found in tools JSP // requirement :: provide a user input currency entry ... //prefilling it with the previous value ... function initializeState() { document.myForm.myInput.value = parent.numberToCurrency(currAmount, fCurr, ""); } function validatePanelData() { if ( !parent.isValidCurrency(document.myForm.myInput.value), fCurr, "")) { alert("not valid"); return false; } return true;
Chapter 8. Globalization guidelines
233
} function savePanelData() { MyCurr=parent.currencyToNumber(document.myForm.myInput.Value, fCurr, ""); parent.put("myCurrLbl",myCurr); }
A sample validation and format page is available in \commerce\web\tools\sample\, and can be executed by launching http://hostname/commerce/tools/sample/validationTest.jsp. Important: We highly recommend that you avoid using FormatNumber, FormatCurrency, and FormatInteger. Those functions are included in the WebSphere Commerce Tools Framework only for backward compatibility. FormatNumber and FormatCurrency do the validation first based on the language ID. If you get a primitive numeric format (1000.23) from the WebSphere Commerce Server, those functions return a Not a Number (NaN) value. Furthermore, FormatInteger only accepts primitive numeric integers. Therefore, if you have an integer such as 1,000 in the US English language ID, it returns a NaN.
8.3.3 Name and address formatting Globalizing Web-based software applications mandates support for country-specific name and address formats. Different countries and shipping regions have different address and name formats. This implies the need for different input fields during registration and also a different order when the address is displayed. Address and name formatting is country-specific rather than a language-specific item. For example, both French and English-speaking people in Canada use the same Canadian address format. In most object-oriented programming languages, cultural information such as date/time format, currency format, number format, collation rules, and text boundary rules, can be obtained from locale-sensitive classes. The locale-sensitive classes are smart classes that magically change the behavior to best meet current language and country environment (change the behavior based on the locale). Address and name formatting is much more complicated than other cultural formatting and does not have any locale-sensitive classes that software developers can use while globalizing (localizing) their software application (for example, address forms, address information, etc.). Therefore,
234
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
software developers are responsible for implementing their own address and name formatting scheme. Address and name formats can be accepted and stored in the WebSphere Commerce instance database in multiple formats and languages. Figure 8-4 displays an example of an address form, formatted differently for two different countries, Canada and the People’s Republic of China.
Figure 8-4 Address format example
Store pages and registration samples Address and name formatting in the store pages and the user registration samples is accomplished through the use of two separate properties files: one non-translatable local specific file, and a second properties file containing translatable text. The non-translatable locale-specific file is used to store the following address/name format control information: Image files: The location of culturally sensitive image files. Required fields: Different fields are required or optional for different cultures. Displayed fields: Different fields are hidden or displayed for different cultures. Cultural differences that affect the order in which fields should be displayed are not demonstrated. Examples of the non-translatable locale-specific address format properties files are: \runtime\properties\UserRegistration_xx_XX.properties \runtime\properties\UserRegistrationB2B_xx_XX.properties
Chapter 8. Globalization guidelines
235
Where xx_XX represents a locale. Those properties hold the address format control information used by the UserRegistration sample shipped with WebSphere Commerce. The translatable properties file stores the following translatable elements: Page titles: The title of the page is translated into each language. Labels: Form field and button labels are translated into each language. List items: The display of list items is translated for each language. Examples of the translatable locale address format properties files are: \runtime\properties\UserRegistrationText_xx_XX.properties \runtime\properties\UserRegistrationB2BText_xx_XX.properties Where xx_XX represents a locale. Those properties files hold the translatable text needed by the UserRegistration sample shipped with WebSphere Commerce.
Address and name formating in the tools Address and name formatting in the WebSphere Commerce tools is accomplished through the use of XML files to encapsulate the address/name format control information. The XML files hold address/name control information such as what fields are required, the number of lines that constitute an address/name format, the sequence and nature of address/name attributes that should be displayed on one line, etc. The following is a high-level description of the address/name format approach followed by the WebSphere Commerce tools: 1. Create an XML file to hold your address format information. For example:
Refer to \xml\tools\order\addressFormats.xml for sample implementation. 2. Use the tools framework XMLUtil.get(Hashtable tree, String path) to parse your XML file. This method is one of the utility classes to read and write XML files and strings contained in the tools framework. When reading XML files and strings, these parsers turn the XML data into a hashtable.
236
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
3. Use the address format control information stored in the hashtable created in the previous step to display the formatted address attributes to the end user. This following is an example: \wc.ear\CommerceAccelerator.war\tools\order\OrderBillingAddressPag e.jsp
8.4 WebSphere Commerce application model As discussed in the introduction, there are a number of characteristics that can be associated with a globalized site. Some of these characteristics are associated with display preferences, while other characteristics more closely resemble business logic. In order for a merchant to correctly model a globalized site, it is necessary for them to be able to model linguistic and cultural display preferences, business logic, and business processes in easy-to-manage pieces. Table 8-7 lists a high-level representation of the WebSphere Commerce application model. Table 8-7 WebSphere Commerce application model Layer
Features
Models
Tools with built-in support to manage multilingual data
Tools that are browser based and fully multilingual enabled
Multilingual store samples and documentation models
Pricing and promotions
Dynamic includes for dynamic look and feel
Built-in, correctly formatted data presentation
Built-in currency conversion and currency formatting
Dynamic language fallback
A single JSP component to handle all languages
Tax rules
Shipping logic
Pricing and promotions
Contain all data pulled by entity objects
Run in Unicode
Database in Unicode
Separated language and cultural items
Business processes Controls and Views
Business components
Business objects
Database
Chapter 8. Globalization guidelines
237
8.4.1 Language table A number of parameters are used within WebSphere Commerce to identify business qualifiers, such as the following:
Language preference of the shopper Cultural formatting preferences for the shopper Store location the shopper is shopping from Where the shopper is located
Without this information, it would be very difficult to offer the correct product set to the shopper at the correct prices and currencies. It is also not possible to display product description information in the correct language or formatting. WebSphere Commerce has introduced a formatting parameter that utilizes the Java Locale to identify the language, encoding and cultural formatting preference of the user. This parameter is called language_id. The language_id parameter is used as a key within most of the descriptive tables within the WebSphere Commerce instance database schema. The exact formatting that each language format represents is defined within the LANGUAGE table, which is qualified by a Java locale. Therefore, when the users select their preferred language, they select a number of display preferences to view the site. Formatting includes items such as how dates are represented and how numbers are formatted. The advantage of using the language_id parameter instead of directly using a locale is that it allows a merchant to define a number of distinct languages that can share the same formatting locale or a number of similar languages that have different formatting. For example, it is possible for a merchant to define English spoken in Singapore and have it formatted with the en_US locale, but at the same time allowing the merchant to enter a different description for it instead of being forced to use the American English description. This also allows a merchant to provide a number of different descriptions for a product in many different languages, all of which can share the same formatting locale. For example, a merchant would be able to create a language format that defines language as American English using the ISO-8859-1 encoding with the US formatting scheme. Table 8-8 on page 239 describes how the column names and types are modeled within the LANGUAGE table of the WebSphere Commerce instance database schema.
238
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Table 8-8 WebSphere Commerce LANGUAGE table Column name
Column type
Column description
Country
CHARACTER(5) NULL
Country or region component of the locale.
Encoding
VARCHAR(32) NIULL
The Character encoding value that the browser should use to display the page for this language.
Language
CHARACTER(5) NULL
Language component of the locale.
Language_ID
Integer Not NULL
A unique key for the language, used as part of the foreign key in tables that contain language-dependent information.
Localename
CHARACTER(16) Not NULL
A Java locale used to represent a political, geographical, or cultural region that has a distinct language and custom for formatting.
MIMECHARSET
VARCHAR(32) NULL
The MIME character encoding that the notification system uses to encode a message for this language.
VARIANT
CHARACTER(10) NULL
Variant component of the locale. Used to specify the locale character set or to further segregate a distinct formatting for a political, geographical, or cultural region.
Note: The term locale in software development is borrowed from the field of geography. The geographical term locality refers to a particular place, location or situation. A locale represents a specific geographical, political, or cultural region. Locale in the Java world is an object that consists of three parts: language, region, and variant. The language and region are normally the two-character ISO language and country codes. The region code often but not always represents a country. The variant is an arbitrary string used when there are multiple locales for the same language and region. Each row of Table 8-8 represents a language. Out of the box, WebSphere Commerce includes support for 10 languages/locales, which are populated by default (see Table 8-9 on page 240). Users can add other supported languages/locales by using the predefined ISO codes.
Chapter 8. Globalization guidelines
239
Table 8-9 WebSphere Commerce supported locales Locale
Language and Territory
langId
en_US
English US
-1
fr_FR
French France
-2
de_DE
German Germany
-3
it_IT
Italian Italy
-4
es_ES
Spanish Spain
-5
pt_BR
Portugese Brazil
-6
zh_CN
Simplified Chinese China
-7
zh_TW
Traditional Chinese Taiwan
-8
ko_KR
Korean Korea
-9
ja_JP
Japanese Japan
-10
There is another table added to complement the LANGUAGE table, which allows merchants to set a fallback language format. This table is called LANGPAIR. The LANGPAIR table allows a merchant to map one or more fallback formats to try if the description of the initial format is not found. When the fallback language format is set, merchants will be able to ensure that they will always have a description for a product or catalog, even if they don't have a fully translated catalog. For example, a merchant creates two language formats: format A for US English, and format B for Canadian English. In this case, the catalog and product descriptions are very similar in Canada and the US, with only a small set of descriptions being different between the two. The merchant can therefore create a complete catalog in US English, and a partial catalog in Canadian English to address the differences by seting the fallback language format to be US English format. A merchant can also set more than one default for a language format so that if the initial fallback is not found, the fallback language format with the next highest priority sequence number is used instead. Table 8-10 on page 241 describes the columns and types for the LANGPAIR table found within the WebSphere Commerce instance database schema.
240
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Table 8-10 WebSphere Commerce LANGPAIR table Column name
Column type
Column description
LANGUAGE_ID
INTEGER Not NULL
The requested language. Foreign key to the LANGUAGE table.
LANGUAGE_ID_ALT
INTEGER Not NULL
The alternative language.
SEQUENCE
DOUBLE Not NULL Default 0
When the requested language is supported by the store but information is not available in that language, each alternative language is tried in ascending order of SEQUENCE.
STOREENT_ID
INTEGER Not NULL
The StoreEntity that this relationship is part of.
If no description is found for the initial language or any of the fallback formats, then the description will be retrieved according to the default store format. Before we move on to the next section, it is worth mentioning the order of determining the user’s requested (active) language: Highest: The language defined in the command (language_id parameter of the URL). Current session language (result from the last/previous operation). The language defined in the user profile (user-preferred language). Store default language.
8.4.2 Introduction to encoding Computers deal with numbers only. They store and process characters by assigning a number for each one. There are hundreds of different systems for assigning these numbers. These systems are called encoding systems or encoding schemes. Character encoding has always been one of the least understood subjects in the science of software internationalization and localization. Some common questions are as follows:
What is Unicode? Is Unicode an encoding or a character set? What is the difference between UCS-2 and UTF-8? Is a character the same thing as a glyph?
When working with developers, we found that very few developers were able to clearly differentiate between character encoding, encoding scheme, code page,
Chapter 8. Globalization guidelines
241
character set, and coded character set. The reason behind this confusion is that one can rarely find two books, two papers or two journals that agree on the definition of those terms. Since understanding encoding and encoding-related topics is essential for comprehending the WebSphere Commerce data model, we will spend some time in this section breaking the byte barrier and discussing encoding and character representation concepts in more details. The following is a list of some easy-to-understand definitions on encoding and related topics: Character The smallest symbol in a written language that represents information (for example, letters, ideograph, digits, punctuation marks, etc.). Abstract Character Set A group of abstract characters that form one alphabet. The individual character in a character set are not mapped to a numerical value (for example, Greek alphabet, Arabic alphabet, Latin alphabet. etc.). Coded Character Set A coded character set is a character set in which each character is mapped to a code point (numerical value or position in a table). US-ASCII and JIS (East Asian) are examples of very common coded character sets. Character Encoding Form The mapping of code points to a series of fixed-length bit patterns (7-bit, 8-bit, 16-bit, 32-bit) called code units. Encoding (Encoding Scheme or Encoding System) The process by which each code point in a coded character set is mapped (serialized) to a given sequence of bytes (that is, converted into a digital representation so it can be stored in a file or a database). Important: The term glyph is commonly confused with the term character. A glyph is a concrete visual representation of a character or part of a character. A glyph is one of many possible shapes of a given character. A character could be represented by a single glyph, or by different glyphs positioned (compounded or connected) appropriately. In bidirectional languages such as Arabic, glyphs are required to change their shape and widths depending on the position of the character they represent in the word and grammar.
242
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Note: In IBM the term code page refers to a coded character set. However, the generic use of code page is to refer to character encoding schemes. Some encoding schemes, such as the UTF-8, are used to serialize several character sets. Others are unique to a given character, such as the Big5 encoding of the Traditional Chinese character set. In some cases the encoding is just a direct mapping of the numerical values and there is no distinction between the coded character set, encoding form and the encoding. In other cases, when dealing with languages that need more than one byte to cover the inventory of their characters, such as Chinese, both Traditional and Simplified, Japanese, and Korean, known as CJK, the encoding is more complex. It involves multiple code units (multiple bytes). The distinction between encoding and a coded character set: Windows Cp1252: In the ASCII coded character set, the character Ä is assigned the numerical value 196. The Character is encoded as byte 0xC4 in the Windows Cp1252 encoding. There is no distinction between the encoding and the coded character set. Furthermore, the character encoding form mapping is null. UTF-8: In the Unicode coded character set, the character Ä is also assigned the scalar value 196(U+00C4). However, the same Character is encoded as two bytes: 0xC3+0x84 in the UTF-8 encoding (The character is mapped to two code units each of 8-bit length). DBCS is the abbreviation for Double Byte Character Set. Most written Asian languages (Chinese, Korean, Japanese, etc.) are based on ideographic symbols rather than an alphabet. Those languages have thousands of characters beyond the limit of one byte representation (that is, beyond 256 characters). When using two bytes, one can represent up to 65536 characters (256 x 256), enough to represent the coded character sets of any of the Asian languages needing double-byte support. Confusion can arise when using the phrase double-byte, as this phrase is usually thought of as the number of bytes needed to store one character as opposed to the way in which the DBCS characters are typed (using two English characters).
Chapter 8. Globalization guidelines
243
8.4.3 Unicode Unicode is essentially one giant coded character set that contains the characters of all the world's major languages. When using Unicode, it is possible to display multiple languages simultaneously, since all the characters in all the languages are defined within it. Before Unicode was created, hundreds of different encoding systems had been used, each in conflict with one another. That is to say, no two encodings could use the same number for two different characters, or use different numbers for the same character. Unicode allows data to be transported through many different systems without corruption, because it provided a unique number for every character. Unicode can be used as a medium of communication for the application server and database, so that the user's data can always be stored without corruption, no matter what the original encoding. Another benefit of using this unified standard for encoding is its ability to present sorted results based on locale-specific, multilevel collation rules. For more detailed information on the Unicode standard and consortium, as well as code charts, refer to the following Web site: http://www.unicode.org/
UTF-16 vs UTF-8 In 1992, the International Organization for Standards (ISO), and the International Electrotechnical Commission (IEC) formed the ISO/IEC 10646 standard, with the objective of being compatible with existing coded character sets, such as ASCII and ISO Latin 1. Parallel to the development of the ISO/IEC 10646 standard, Unicode was being developed by the non-profit Unicode consortium. Unicode was designed to embrace the following principals: Universal: Code points to cover all of the world’s major languages. Unique: Characters to have exactly one mapping to a given sequence of bytes. Uniform: Fixed-width characters encoded in the same number of bits. To avoid having two competing 16-bit standards, the two development organizations compromised to define a common coded character set (Universal Character Set), known as both Unicode and Basic Multilingual Plane (BMP), encoded using two different standards.
244
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Note: UCS is the abbreviation for Universal Multiple-Octet Coded Character Set, which received its name from the ISO/IEC 10646 standard for the Universal Character Set. UCS-2 is the 2-Octet BMP form. It can represent all characters in BMP in 2-octet. UTF is the abbreviation for Unicode Transformation Format or Universal Character Set, and it defines a set of different transformations of UCS as different representations for data transfer. The most common transformation formats (UTF) are UTF-16 and UTF-8. Both encoding schemes encode the same character repertoire, such as Unicode 1.1, Unicode 2.0, Unicode 3.0, Unicode 3.1, etc. We will examine the UTF-16 and UTF-8 encoding schemes in more detail.
UTF-16 UTF-16 is the Unicode Transformation Format that serializes a Unicode code point as a sequence of two bytes, in either big-endian (bytes read left to right) or little-endian format (bytes read right to left). Because it is grouped by code units of 16-bit length (2 bytes), it is called UTF-16. Each Unicode code point up to U+FFFF is encoded as a single 16-bit value. Code points above U+FFFF are represented as a pair of 16-bit high and low surrogate. In this encoding, even the 7-bit US-ASCII characters are represented by a 16-bit code.
UTF-8 UTF-8 is a multibyte 8-bit flavor of UTF that each Unicode code point is a mapped to a sequence of one to four bytes. Because it varies from 8 bits (1 byte), it is so called UTF-8. UTF-8 is compatible with US-ASCII if no extended characters (for example, characters that require the 8th bit to be represented) are present. Table 8-11 lists the number of bytes required to represent every Unicode code point using UTF-8. Table 8-11 Code point range in UTF-8 Code point range
Number of bytes
0x00..0x7F
1 byte
0x80..0x7FF
2 bytes
0x800..0xD7FF, 0xE000..0xFFFF
3 bytes
Chapter 8. Globalization guidelines
245
Code point range
Number of bytes
0x10000 .. 0x10FFFF
4 bytes
The last point to cover before we move to the next section is, what flavor of UTF is preferred? For example, should one use UTF-8 or UTF-16? The answer is simple. It depends on the nature of the data being saved. If the majority of the data being saved in the database and/or the file system is basic Latin characters (Latin-1 characters), then it would take twice as much space to store the data in UTF-16 than in UTF-8 and thus UTF-8 is preferred. For this reason, WebSphere Commerce uses UTF-8. On the other hand, If the majority of the data being saved is non-Latin extended characters (the 3 bytes range), UTF-8 takes more space. What is a surrogate? Two bytes are not enough to accommodate all the world’s common languages. Thus, Unicode was expanded to comprise 17 planes: Plane 0, the Basic Multilingual Plane (BMP), covers code points U+0000 through U+FFFF Planes 1 through 16 have been reserved to cover code points U+10000 through U+10FFFF. One way to reference the code points in the supplementary planes is to make use of surrogate pairs of 16-bit code points. The code points U+D800 through U+DBFF are reserved as high surrogates, and the code points U+DC00 through U+DFFF are reserved as low surrogates. Each code point in a supplementary plane maps to a pair of 16-bit code points comprising a high surrogate followed by a low surrogate.
What is the difference between UCS-2 and UTF-16? UTF-16 without support for surrogates is just like UCS-2. The difference lies in the surrogate planes. UCS-2 can represent only BMP characters. Surrogate-plane characters cannot be represented in UCS-2. In other words, UTF-16 is UCS-2 plus the surrogate mechanism. Since there are no characters currently defined in the surrogate planes, the difference between UCS-2 and UTF-16 is really negligible.
Use of Unicode in WebSphere Commerce WebSphere Commerce uses Unicode databases for both DB2 and Oracle, and the database charset is UTF-8. While it is possible to convert data originally encoded using many different encodings into Unicode and to store this information safely within a database, it is a much greater challenge to display this
246
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
information via a Web page. The key decision is under what encoding should the pages displayed in. Typically, the general rule is that any data that is being sent out to the client should be converted into the client's browser's default encoding. This ensures that their browser will be able to display at least some of the data. However, in order to display multiple languages, it will be necessary for the client's browser to support Unicode.
Encoding store pages We recommend that developers use native encoding instead of UTF-8 for store pages that shoppers will browse. The primary reason for this recommendation is that merchants will likely not know with certainty what browser levels or browser configurations a shopper would be using to access their site. If the data is not converted to the client's default browser encoding and the shopper's browser does not support Unicode, garbled characters would appear in the shopper's browser. This is not desirable since there is a strong likelihood that the merchant would lose the business of that customer. Therefore the information will always be converted into the native encoding of the shopper’s browser.
Encoding tools pages There is a requirement for WebSphere Commerce tools to be able to maintain information in multiple languages. Also, only one browser, Microsoft Internet Explorer V6 is officially supported by WebSphere Commerce tools. Therefore, Unicode is uses to encode all out-of-the-box tools pages. This allows a merchant to maintain data that is in multiple languages.
8.4.4 WebSphere Commerce data model: input WebSphere Commerce is designed such that a single store can work with any language. A single store can display pages in multiple languages, even when the languages use different character sets. To accomplish this, the WebSphere Commerce instance database is configured at creation time to store data in UTF-8 encoding. A UTF-8 database supports multiple language storage in a single database and the database has the correct character mappings to handle all single-byte, double-byte, and bi-directional characters. When data is requested by a JSP page from the UTF-8 encoded database, the data is converted into an appropriate character set. The JDBC drivers load data from the database and convert text data from UTF-8 to Java's native 16-bit Unicode encoding. Developers need to understand the multilingual programming model to take advantage of this feature.
Chapter 8. Globalization guidelines
247
To better understand how data is transferred from the Web browser to the Database, refer to Figure 8-5 on page 248 and the following text: 1. Data is entered into the Web browser. Multilingual data can be entered using an input method editor. 2. WebSphere Commerce converts the data coming in from the Web browser into Java 16-bit encoding using the setCharacterEncoding() method. Each LANGUAGE_ID in the LANGUAGE table is mapped to an encoding value using the ENCODING column. This value is used to interpret the data coming from the Web browser 3. The data is sent to the database, where the JDBC driver converts it from Java 16-bit to UTF-8 encoding, which is how it is stored in the database. Note: Input Method Editors (IMEs) were created so that language scripts with large character inventories such as CJK (Chinese, Japanese and Korean) can enter all of the available characters from a limited number of keys on the keyboard.
Conversion by WAS to UTF-16 (using the Encoding Value in the Language Table)
Conversion by JDBC Driver to UTF-8
DB UTF-8
JDBC Driver
Java Code Unicode UTF-16
JSP
WC Servlet API
Browser Encoding XXX
Unicode UTF-16
Figure 8-5 Data transfer from Web browser and database
Another data input vehicle in WebSphere Commerce is the mass import tool MassLoader. The MassLoader supports the import of such features as catalog data, payment data, taxation data, shipping data, access control data, etc., in XML format. The XML data is turned into SQL statements and populated in the database using JDBC. The tool supports the import of Unicode and non-Unicode data. Any non-Unicode data gets converted into Unicode before reaching the UTF-8 database.
248
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
It is essential that developers understand the different data conversions that take place between the XML input file and the database as described below: 1. Parse the XML document encoded in any encoding. The XML Parser converts the data in the original encoding to Java String objects encoded in UTF-16. 2. Compose the SQL statement. 3. Execute the SQL query through JDBC. Java String Object. Values are in UTF-16. 4. Either: – DB2/CLI receives the query and converts the encoding of the incoming data into the database destination character encoding (UTF-8). or – Oracle/OCI receives the query and converts the encoding of the incoming data into the database destination character encoding (UTF-8). Figure 8-6 on page 249 depicts the data conversion of XML data using the MassLoader with a DB2 database.
MASSLOADER
XML File
€ in any character encoding
XML Parser Characters in Unicode (codepoint 0u20AC)
DB2
JDBC Driver Characters in Unicode (codepoint 0u20AC)
DB2 CLI
DB
Characters in Unicode (codepoint 0u20AC)
Characters in UTF-8 (codepoint 0xE282AC)
Figure 8-6 Data conversion for XML data round trip using the MassLoader on DB2
Figure 8-7 depicts the data conversion of XML data using the MassLoader with an Oracle database.
Chapter 8. Globalization guidelines
249
MASSLOADER
XML File
€ in any character encoding
XML Parser Characters in Unicode (codepoint 0u20AC)
DB2
ORACLE OCI
DB
Characters in Unicode (codepoint 0u20AC)
Characters in UTF-8 (codepoint 0xE282AC)
JDBC Driver Characters in Unicode (codepoint 0u20AC)
Figure 8-7 Data conversion for XML data round trip using the MassLoader on Oracle
Important: The MassLoader tool uses the Oracle OCI JDBC driver, thus setting the NLS_LANG environment variable to UTF8 is required on the client side before MassLoading to avoid data corruption You could set the variable in the command window, but preferably set it as a system environment variable. The format for the NLS_LANG variable is as follows: NLS_LANGUAGE_NLS_TERRITORY.NLS_CHARACTERSET For example, Japanese_Japan.UTF8
8.4.5 WebSphere Commerce data model: output In this section we discuss the second part of the data round trip between the Web browser and the database (browserWebSphere Commerce Serverdatabase). The following steps outline how data travels from the database to the Web browser: 1. Data is stored in the database using UTF-8 encoding. The WebSphere Commerce Configuration Manager configures the WebSphere Commerce instance database at creation time to store data in UTF-8. 2. JDBC drivers load data from the database and store textual data in java.lang.String. To do this, the drivers convert text data from UTF-8 to Java's native 16-bit Unicode encoding. 3. Strings are handled inside the Java code as Unicode 16-bit encoding. 4. JSP output strings using Unicode 16-bit encoding, because JSP is 100% Java code.
250
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
5. JSP authors can specify the encoding to be used to send the HTTP response to the Web browser. For example: )
6. The WebSphere Application Server will convert JSP output text from 16-bit Unicode to the target encoding as specified in the JSP (for example, Shift-JIS). The converted data will be sent back to the Web browser. The WebSphere Application Server will also specify the encoding used in the HTTP reply (for example, Content-type: text/html; charset=Shift-JIS). 7. The Web browser will interpret the HTTP reply based on the encoding specified in the header. Since not all Web browsers can understand all encoding schemes, it's better to specify only the most well-known encoding schemes in the JSP (for example, UTF-8 and Shift-JIS). Figure 8-8 on page 251 depicts the WebSphere Commerce output data model, where data is transferred from the database to the Web browser.
Conversion by WAS to encoding XXX (specified by ContentType statement)
Conversion by JDBC Driver to UTF-16
DB UTF-8
JDBC Driver
Java Code Unicode UTF-16
JSP
WC Servlet API
Browser Encoding XXX
Unicode UTF-16
Figure 8-8 Data transfer from database to the Web browser
8.5 Globalized catalog content The WebSphere Commerce catalog subsystem is designed to facilitate the creation and processing of globalized catalogs. All catalog descriptive tables are qualified by a language format column (language_id). In addition to this, the attribute tables are also qualified by the same language format column. At runtime, the command context is sent through a data bean to determine which translation to retrieve from the database and display on the page.
Chapter 8. Globalization guidelines
251
The globalized catalog design in WebSphere Commerce provides the following features: Product descriptions and attributes can be culturally specific. The merchant has the ability to create a catalog that allows product descriptions and attributes to be culturally specific. This master catalog contains all of the products that the merchant offers in all the language formats that the merchant supports. Not all products need to be available in all the supported languages formats and all types of formatting. Multiple descriptions or attributes for same product and language. Ability to provide multiple descriptions or attributes for the same product in the same language. This allows stores that share products to offer different descriptions for the same product in the same language. Depending on the locales that the store supports, different features of the same products may need to be highlighted in different locales. Different images may be appropriate for different locales. Prices may be varied and can be expressed in different currencies. For more detailed information, refer to the WebSphere Commerce V5.5 online documentation, and the WebSphere Commerce JavaDocs associated with the catalog subsystem.
8.6 Globalized store design A store typically contains several types of pages. A globalized store is a store in which all pages are enabled for globalization. In WebSphere Commerce, globalization enablement of store pages is accomplished through the use of language-independent and culturally sensitive templates. A template is a skeleton or pattern that defines how information in the WebSphere Commerce instance database will be displayed on a Web page. The template determines the location and type of text and images on the page, as well as other page attributes, such as a background color. These elements are defined in templates created with JavaServer Pages (JSP) technology using HTML tags or beans that are linked to the WebSphere Commerce instance database. To manage static pages and dynamic templates in a globalized environment, it is necessary to store files in a directory structure that allows for the quick and easy identification of the files and which locale they belong to. The file directory path is constructed based on the WebSphere Commerce instance, the store path contained within the store profile, and also the registered file path.
252
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
In WebSphere Commerce, the management and storage of templates in a globalized environment is referred to as template management. There are three models for template management: One template for all stores and languages One template per language One template per store Note: Details about each of the above models can be found in the IBM WebSphere Commerce V5.5 online documentation. To manage static pages and dynamic templates in a globalized environment, it is necessary to store files in a directory structure that allows for the quick and easy identification of the files and which locale they belong to. In WebSphere Commerce, the file directory path is constructed based on the Commerce instance, the store path contained within the store profile, and also the registered file path. When you create a globalized site, you create multiple stores, each one having a list of supported languages. Since the template files influence the look-and-feel of a site, the template files are stored under locale-specific directories so that they can be selected similar to the manner in which resource bundles are selected, using a locale value. When the system selects a template to use for a particular language format, the locale is used to determine the language format that will be used to determine the directory from which the file is retrieved. The sample stores provided with WebSphere Commerce follow the one template for all stores and languages model. If you are creating store pages to work with existing sample store pages, they should also follow this model. Also, the use of one template per store model is discouraged, since it provides the lowest levels of maintainability and scalability in a globalized environment.
8.6.1 Globalized page framework: one template for stores/languages While there are various options from which to choose when creating a globalized store, the one that offers the most globalized approach is that of a single, culturally neutral template that calls or includes culturally sensitive content at runtime. This model makes maintenance simple, since changes to the design of a page only need to be made once. It also makes adding or removing languages or cultures simple, since the culturally sensitive content is kept separate from other features of the page.
Chapter 8. Globalization guidelines
253
Figure 8-9 on page 254 depicts the one template for all stores and languages programming model. This globalized programming model offers a powerful way to design and organize your e-commerce site. Each page consists of a single JSP template, containing a basic page layout and culturally neutral data and images. This template is combined at runtime with culturally sensitive components, based on the display format selected by the customer. With this model, each supported language has its own property file. Within the property file, a number of page elements are translated:
Text: Textual page content. Labels: Form field labels. Messages: Error, status, and confirmation messages. Alternate text: For images, Java applets, and other embedded objects.
The encoding of the text is also indicated in the property file under the ENCODESTATEMENT property. This indicates the encoding in which the text is displayed in a Web browser. Because it is specified within the property file, the encoding can be different for each language. The value is retrieved from the property file, and the character-encoding of the generated JSP is set using the following statement in the JSP template:
en_US JSP templates
Displayed JSP files
Message files (resource bundles/ property files)
fr_CA de_DE fr_FR
image/ text
Included page components (such as header, footer, or navigation bar)
Image files (culturally neutral)
en_GB
Image files (culturally specific)
Figure 8-9 Globalized page framework: one template for all stores and languages
254
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Resource bundles Resource bundles allow you to maintain collections of Java objects that are locale-specific for your JavaServer Pages. When the page needs a locale-specific resource, such as a form field label, a graphical user interface message, or a value for a drop-down menu, the page can load it from the resource bundle or property file that is appropriate for the selected locale, allowing the customer to view the page in their own language. In this way, you can create language-independent core application while leaving the chance to create as many translated versions as translation is done. Such modules can be created in Java through the use of ResourceBundle class. The ResourceBundle class is included in Java.util package. Practically, for ease of use, you may want to use its subclasses: PropertyResourceBundle (properties files) ListResourceBundle Although ListResourceBundles and properties files perform similar functions, there are some differences in the manner in which they are processed. Table 8-12 shows some of the more important differences between ListResourceBundles and properties files. Table 8-12 Comparison between ListResourceBundles and properties files Class name
Objects Stored
Format of resource file
Performance
PropertyResourceBundle
String only
Flat text file. Editable. (Properties file)
Slightly slower
ListResourceBundle
Any kind of objects
Byte code. Needs compilation after editing
Faster
In WebSphere Commerce, using PropertiesResourceBundles to separate translatable text as the format of the ListResourceBundles (properties file) is much easier to translate and maintain than the Java files associated with ListResourceBundles. Unless the performance of your application is severely degraded or there is a need to use non-string type, we recommend the use of PropertiesResourceBundles. The search order used by which properties files are retrieved in Java (ResourceBundle.getBundle) is as follows: 1. basename_language_region_variant 2. basename_language_region 3. basename_language If we take Japanese as an example, the Japanese property file should be named either AddressText_ja.properties or AddressText_ja_JP.properties. For the
Chapter 8. Globalization guidelines
255
Chinese languages, the locale name for the S-Chinese is zh_CN, and for the T-Chinese is zh_TW. Therefore, you must include the country name to distinguish property files for these two countries.
Native2ascii tool The Java compiler and other Java tools can only process files that contain Latin-1 and/or Unicode-encoded (\udddd notation) characters. This is because Java uses Unicode as its internal encoding. However, most operating system, editors, and other tools still use regional code pages to represent text. In most cases, this means that you will create your .java files in a regional encoding, not Unicode. Of course, the Java compiler must compensate for the difference by converting your native code page into Unicode. The native2ascii tool converts files that contain other character encodings into files containing Latin-1 and/or Unicode-encoded characters. ISO-8859_1 characters are represented as they are, while characters other than ISO8859_1 are represented in the Unicode escape sequence, which is preceded by \u. For example, the phrase DDEmad, where DD represents a DBCS character, is converted to \u3053Emad. The properties files of languages other than Latin-1 languages (ISO-8859_1) must be converted to the Unicode-encoded characters format using the native2ascii tool such as the following: The native2ascii tool is run as follows: native2ascii [options] [inputfile [outputfile]] Example: conversion from the Japanese Shift-JIS encoding: native2ascii -encoding Shift_JIS GreetingResource_ja_JP.temp GreetingResource_ja_JP.properties
Also there are some cases where you want to convert from the Unicode-encoded format to the original character encoding. You can use the reverse option to do so, as follows: native2ascii -reverse -encoding Shift_JIS GreetingResource_ja_JP.properties GreetingResource_ja_JP.temp
Note: The native2ascii tool is included in both the SUN Java2 SDK and IBM JDK. The JRE, which is the runtime environment only, does not include native2ascii.
256
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Tip: The Java compiler automatically assumes that your resource files are written in the default code page of your operating system. Therefore, if you are using a U.S. English version of Solaris, the compiler will probably assume your character set is Cp1252(ISO_8859-1). Although 8859-1 supports many languages, it doesn't represent everything. So, if you need to compile a Japanese resource bundle, you would get incorrect results. As an alternative to using the native2ascii tool, the Java compiler allows a command-line directive that specifies the encoding of the source file. Using the appropriate converter, you can direct the compiler to accurately convert the .java source into Unicode. The following example shows the command line directive you would use to compile a Japanese resource bundle that's written in Shift_JIS, the popular Japanese encoding: javac -encoding Shift_JIS GreetingResource_ja_JP.java
Use of resource bundles in the store pages The store pages use JSP templates that are largely independent of the customer's locale. At runtime, each requested JSP includes the file EnvironmentSetup.jsp. Within this file, the command context is retrieved, and from that, the locale is retrieved as follows: CommandContext cmdcontext = (CommandContext) request.getAttribute(ECConstants.EC_COMMANDCONTEXT); Locale locale = cmdcontext.getLocale();
The locale is used to retrieve appropriate locale-specific ResourceBundle (properties file) through a call to the StoreDataBean.getResourceBundle as seen in Example 8-3. Example 8-3 Sample of StoreDataBean.getResourceBundle from JSP
....... JSPResourceBundle infashiontext = (JSPResourceBundle) request.getAttribute("ResourceText"); JSPResourceBundle infashionDynamictext = (JSPResourceBundle) request.getAttribute("ResourceDynamicText");
Chapter 8. Globalization guidelines
257
JSPResourceBundle auctionSampletext = (JSPResourceBundle) request.getAttribute("AuctionSampleText"); if (infashiontext == null) { infashiontext = new JSPResourceBundle(sdb.getResourceBundle("infashiontext")); request.setAttribute("ResourceText", infashiontext); } if (infashionDynamictext == null) { infashionDynamictext = new JSPResourceBundle(sdb.getResourceBundle("infashiontext_dynamic")); request.setAttribute("ResourceDynamicText", infashionDynamictext); } if (auctionSampletext == null) { auctionSampletext = new JSPResourceBundle(sdb.getResourceBundle("AuctionSample")); request.setAttribute("AuctionSampleText", auctionSampletext); }
The template then has access to each of the properties as needed, through the use of the getProperty() method of the properties object. Dynamic data is retrieved at runtime using various server bean methods and is performed in the context of the current language. Example 8-4 shows the request for the language-specific store display name. The returned value for the language parameter (language_ID) will determine the language in which the store name will display, having been retrieved by the getDisplayName method of the StoreDataBean. Example 8-4 Request for language-specific store display name // Name of the store String storeName;
258
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
try { storeName = sdb.getDescription(cmdcontext.getLanguageId()).getDisplayName(); } catch (Exception e) { // store name is not defined storeName = " ";
}
The locale and language are retrieved at runtime to determine the correct folder in which to look for the image file. For example, the template might look for the file FashionFlow/xx_XX/images/go_button.gif , where xx_XX is the language_Country part of the locale retrieved from the command context. For example, the resulting page will display the image: FashionFlow/en_US/images/go_button.gif FashionFlow/ja_JP/images/go_button.gif
8.6.2 Support for bi-directional languages Languages such as Arabic, Hebrew, Farsi, Urdu, and Yiddish have their text written from right to left. Numeric and embedded segments of Western language text are written from left to right. Because of this possible mixture of text segments in two directions, as displayed in Figure 8-10, those languages are called bi-directional or BiDi for short.
Figure 8-10 Example of the mixture of text segments
Mirroring of graphic user interface elements If the global orientation is right to left, as is the case for BiDi languages, then most of the GUI elements in the window body should appear mirrored from the left-to-right window. For example, in a right-to-left window, the position of the vertical scroll bar appears to the left of the scroll box, and radio buttons are to the right of their labels. Other elements, such as the title bar icon, the title bar, and the minimize and maximize buttons, remain the same as in the left-to-right window to ensure consistency in usability. Figure 8-10 displays an example of a mirrored vertical scroll bar.
Chapter 8. Globalization guidelines
259
The HTML specifications provides BiDi support through the use of a number of language information and text direction attributes/elements. The main such attribute is the dir attribute. The dir attribute specifies the base directionality of the following: Portions of document’s text Entire document (at the declaration level) Table structure The possible values of the dir attribute are either RTL (read as right-to-left) for BiDi languages or LTR (read as left-to-right - the default value) for non-BiDi languages.
Figure 8-11 Mirroring of a GUI element
One of the challenges that face store developers in WebSphere Commerce is specifying the direction of text when using the recommended single page template for all languages model to develop multilingual store pages that include both BiDi languages and non-BiDi languages (left-to-right languages). The directionality attribute dir has to be set properly in the single JSP template depending on the nature of the language selected by the shopper/buyer (for example, if the shopper selects a BiDi language, the dir attribute should be set to RTL and set to LTR otherwise). Figure 8-12 on page 261 shows how Arabic characters are wrongly aligned to the left of the GUI objects when the dir attribute is set wrongly to LTR.
260
WebSphere Commerce V5.5 Handbook Customization and Deployment Guide
Figure 8-12 Arabic characters misaligned because of wrong dir attribute setting
WebSphere Commerce provides two ways to dynamically set the dir attribute, and other HTML BiDi specifications, to the correct value in the JSP template: 1. Encapsulating of the directional HTML elements, as shown in Example 8-5. Example 8-5 Encapsulating of directional HTML elements
Chapter 8. Globalization guidelines
261
The is the language_id of the BiDi language that // needs the dir attribute to be set to “RTL”. For example:
Note: As discussed in the encoding section of this chapter, there is a requirement for WebSphere Commerce tools to be encoded in UTF-8. All tools pages (JSPs) include a common file called common.jsp to set some servlet response parameters, among which is: response.setContentType("text/html;charset=UTF-8"); One frequently implemented task in store-related tooling in WebSphere Commerce is the creation of a language selection drop-down list. A selection determines the language, encoding and cultural formatting preference of the user. Figure 8-13 on page 277 shows an example of a language selection drop-down list in the Administration Console. 276 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 8-13 Language selection drop-down list To create a store language selection drop-down list, follow these steps: 1. Include a bean declaration to the StoreLanguageBean by adding the following statement to your JSP: 2. Make a call to the StoreLanguageBean.getStoreJS(storeName,out): The getStoresJS method creates a JavaScript array with all information entitled to the user according to the access control policy. The information includes the stores that the user is entitled to access, the fullfilment centers of those stores, and the languages supported by each of the stores. The following is an example of a JavaScript array created by a call to the getStoresJS method: stores[0] = new Object(); stores[0].storeId = '10001' stores[0].languages = new Array(); Chapter 8. Globalization guidelines 277 stores[0].languages[0] = new Object(); stores[0].languages[0].langId = '-1'; stores[0].languages[0].langDesc = 'United States English'; stores[0].languages[1] = new Object(); stores[0].languages[1].langId = '-3'; stores[0].languages[1].langDesc = 'German'; stores[0].languages[2] = new Object(); stores[0].languages[2].langId = '-5'; stores[0].languages[2].langDesc = 'Spanish'; stores[0].languages[3] = new Object(); stores[0].languages[3].langId = '-2'; stores[0].languages[3].langDesc = 'French'; stores[0].languages[4] = new Object(); stores[0].languages[4].langId = '-4'; stores[0].languages[4].langDesc = 'Italian'; stores[0].languages[5] = new Object(); stores[0].languages[5].langId = '-10'; stores[0].languages[5].langDesc = 'Japanese'; stores[0].languages[6] = new Object(); stores[0].languages[6].langId = '-9'; stores[0].languages[6].langDesc = 'Korean'; stores[0].languages[7] = new Object(); stores[0].languages[7].langId = '-6'; stores[0].languages[7].langDesc = 'Brazilian Portuguese'; stores[0].languages[8] = new Object(); stores[0].languages[8].langId = '-7'; stores[0].languages[8].langDesc = 'Simplified Chinese'; stores[0].languages[9] = new Object(); stores[0].languages[9].langId = '-8'; stores[0].languages[9].langDesc = 'Traditional Chinese'; 3. Use the language data contained in the JavaScript array retrieved by the StoreLanguageBean.getStoreJS(storeName,out) to construct the drop-down list: function getLanguageList() { var selectObj = document.all['langlb']; selectObj.innerHTML = ''; firstTime = false; if (selectedStore == '') { selectedStore = document.f1.storelb.selectedIndex; firstTime = true; } if (stores.length > 0) { for (var x=0; x Customer (Information) Any content that the user requests to see or that is needed to complete the customer request. Relatively large amount of information including graphical content. 24x7 ITSO Site -> Production Unit (Control) Request for product, category and article information. N/A 24x7 Production Unit -> ITSO Site (Information) Product, category and article information. Relatively large amount of data including images 24x7 ITSO Site -> Fulfilment Center (Control) Request for order, status, stock information and previous order information. N/A 24x7 Fulfillment Services-> ITSO Site (Information) Order status, stock information, previous order information. Relatively small amount of data 24x7 Flow (type) Information or Control Customer -> ITSO Site (Control) WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Volume information Availability* Request to check customer creditability or charge customer credit card. N/A 24x7 Credit information (yes/no). Small amount of data 24x7 Flow (type) Information or Control ITSO Site -> Payment Services (Control) Payment Services -> ITSO Site (Information) * For the purpose of this book we assume the availability of 24x7, but we are not providing an exact solution needed to achieve this requirement. 9.2.4 Use case model This section describes the functional requirements of the ITSO site represented by the use case model. The use case model actors are displayed in Figure 9-3 on page 302 in graphical form to show the use with the system. The descriptions of the use cases are from the actor’s point of view; they do not describe how the system works internally or tis internal structure or mechanisms. We have categorized the use cases for the ITSO site by shopper and administrator (site administrator, line-of-business user). Actors defined The actors are people or systems outside of the WebSphere Commerce server that interact with the system (ITSO site). This section identifies the primary and secondary actors. A primary actor is one that initiate a use case and a secondary actor is one that is involved in one or more of the steps in the use case but does not initiate it. Figure 9-3 on page 302 depicts actors modeled for ITSO site. Chapter 9. Requirements analysis and solution design 301 Payment ITSO Production Fulfillment Service Service Unit Actors Customer Site Administrator Customer Service Representative Product Data Manager Developer Line-of-business user Retail Business Business Customer Customer Resellers Customer Figure 9-3 ITSO site actors Primary actors The primary actors for the ITSO site are as follows: Customer Site Administrator Customer Service Representative (CSR) Product Data Manager Developer Line-of-business user Secondary actors The secondary actors for the ITSO site are as follows: ITSO Production Unit Fulfilment Services Payment Services Customer Site administrator Line-of-business user Use cases summary This section lists the use cases, describes the goal of the use case, and shows the primary actors. 302 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide A summary of the shopper/system use cases can be found in Table 9-3. Table 9-3 Shopper/system use case summary Use case ID Use case name Primary actor Requirement UC-PW01 Display price watch list Customer REQ02 UC-PW02 Add items to price watch list Customer REQ02 UC-PW03 Delete item from price watch list Customer REQ02 UC-PW04 Delete all items from price watch list Customer REQ02 UC-PW05 Schedule job checks price watch list and e-mail customers System (scheduler) REQ02 A summary of the administration use cases can be found in Table 9-4. Table 9-4 Administration use case summary Use case ID Use case name Primary actor UC-A01 Create a contract for a business site administrator line-of-business user Requiremen t REQ01 UC-A03 Add a category Product data manager REQ03 UC-A04 Add a product Product data manager REQ03 UC-A05 Generate commerce analytics reports Line-of-business user REQ04 UC-A06 Register customers from external system via MQ. System REQ05 UC-A07 Notify customer via e-mail of an event. System (scheduler) REQ06 Use cases detail This section provides detail for each of the use cases defined for the shopper/system and administration. Chapter 9. Requirements analysis and solution design 303 Table 9-5 UC-PW01: Display the price watch list Use Case ID: name UC-PW01 Description Customer wishes to view a list of items that he currently has a price watch on. Precondition Customer is a registered user. Customer has logged on to the site. Primary actor Customer Secondary actor N/A Main Scenario 1. Customer clicks the price watch option from the header menu on the site. 2. The price watch list page is displayed to the customer. The price watch items are shown in a table containing the following column headings: – – – – Item SKU Item description Item price Price watch price Alternatives (Alternative Step 2): If the customer has no items in his price watch list, a message informing him of this is displayed. Solution chapter Chapter 13, “Customize a store: Price Watch example” on page 393 Table 9-6 UC-PW02: Add an item to the price watch list Use Case ID: name UC-PW02 Description Customer wishes to add a price watch for a specific item. Precondition Customer has navigated to the item display page of the item he wishes to create a price watch for. Primary actor Customer Secondary actor N/A Main Scenario 1. Customer enters the desired price into the price watch text box. 2. Customer clicks the Add Price Watch button. 3. A new price watch is created for the item with the specified price. 4. The price watch list page is displayed to the customer. 304 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Use Case ID: name UC-PW02 Alternatives (Alternative Step 3): If a price watch already exists for the item, the price watch price value is overwritten with the new value specified. Solution chapter Chapter 13, “Customize a store: Price Watch example” on page 393 Table 9-7 UC-PW03: Delete an item from the price watch list Use Case ID: name UC-PW03 Description Customer wishes to delete a price watch for a specific item. Precondition Customer has navigated to the price watch list page; see Table 9-5 on page 304. User has added at least one item to his price watch list; see Table 9-6 on page 304 Primary actor Customer Secondary actor N/A Main Scenario 1. Customer clicks the Delete option next to the price watch item in the table. 2. The item is deleted and the price watch list page is displayed to the customer. Alternatives N/A Solution chapter Chapter 13, “Customize a store: Price Watch example” on page 393 Table 9-8 UC-PW04: Delete all items from the price watch list Use Case ID: name UC-PW04 Description Customer wishes to delete all items in his price watch list. Precondition Customer has navigated to the price watch list page; see Table 9-5 on page 304. User has added at least one item to his price watch list; see Table 9-6 on page 304 Primary actor Customer Secondary actor N/A Main Scenario 1. Customer clicks the Delete All option. 2. All items are deleted and the price watch list page is displayed to the customer with the message that there are no price watch items in the list. Chapter 9. Requirements analysis and solution design 305 Use Case ID: name UC-PW04 Alternatives N/A Solution chapter Chapter 13, “Customize a store: Price Watch example” on page 393 Table 9-9 UC-PW05: Scheduled job checks price watch list and e-mails customers Use Case ID: name UC-PW05 Description Price watch list is checked for any new items that are within the price watch price and e-mails the customer to inform them. Precondition Scheduler is configured to execute the job and is active. Primary actor WebSphere Commerce Scheduler Secondary actor Customer Main Scenario 1. Items in the Store’s price watch list are evaluated in turn. 2. A notification e-mail is sent to the associated customer for an item that has a price watch price greater than or equal too the item’s actual price. 3. The price watch item is removed from the list if an e-mail was sent. Alternatives (Alternative Step 2): If there are no items in the price watch list, do nothing. Solution chapter Chapter 13, “Customize a store: Price Watch example” on page 393 Table 9-10 UC-A01: Create a contract for a business 306 Use Case ID: name UC-A01 Description Create a contract that defines specific items, prices and terms between a business direct customer and the ITSO store. Precondition ITSO store is deployed Primary actor Line-of-business user Secondary actor Customer WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Use Case ID: name UC-A01 Main Scenario 1. The line-of-business and customer negotiate a contract for specific items and terms with Seller administrator. 2. Create organizations. 3. Create business accounts 4. Create contract. Alternatives The Loader Package can be used via the command line to load the contract.xml or include the file within the store archive and republish the store archive. Solution chapter Chapter 15, “Manage the ITSO store” on page 527 Table 9-11 UC-A02: Add a category Use Case ID: name UC-A02 Description Add a new category to the catalog using the Accelerator Product Management tool GUI. Precondition ITSO store is deployed. Primary actor Product data manager Secondary actor Site administrator Main Scenario The product data manager will use the Accelerator Product Management tooling to add a new product. 1. Log on to the Accelerator 2. Add a new product using the product management tooling. Alternatives Add product using the Loader Package defined in a WebSphere Commerce XML data file. Solution chapter Chapter 15, “Manage the ITSO store” on page 527 Table 9-12 UC-A03: Add a product Use Case ID: name UC-A03 Description Add a new product to the catalog using the Accelerator Product Management tool GUI. Precondition ITSO store is deployed. Primary actor Product data manager Secondary actor Site administrator Chapter 9. Requirements analysis and solution design 307 Use Case ID: name UC-A03 Main Scenario The product data manager will use the Accelerator Product Management tooling to add a new product. 1. Log on to the Accelerator 2. Add a new product using the product management tooling. Alternatives Add product using the Loader Package defined in a WebSphere Commerce XML data file. Solution chapter 15.1.2, “Add a product” on page 528 Table 9-13 UC-A04: Generate commerce analytics reports Use Case ID: name UC-A04 Description Generate commerce analytics reports to show trends in shopping transactions. The customized report will list users who have placed the most orders on the site. Precondition ITSO store is deployed WebSphere Commerce Analyzer is deployed as described in Chapter 20, “Commerce analytics” on page 787. Primary actor Line-of-business user Secondary actor N/A Main Scenario 1. Log on to the Accelerator 2. Access the predefined or customized business intelligence reports. Alternatives N/A Solution chapter Chapter 20, “Commerce analytics” on page 787 Table 9-14 UC-A05: Register customers from external system using MQ 308 Use Case ID: name UC-A05 Description Register a customer from an external system using MQ by sending an inbound XML message containing the customer information and executing the UserRegistrationAdd controller command. WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Use Case ID: name UC-A05 Precondition ITSO store is deployed. WebSphere Commerce and WebSphere MQ have been configured as described in Chapter 21, “Messaging integration with MQ and e-mail” on page 883. Primary actor System Site administrator Secondary actor Customer Main Scenario 1. First the inbound message is sent from an external system to the WebSphere MQ inbound serial queue (wc_inbound_ser). 2. The WebSphere Commerce MQ listener is listening for messages in the queues via the JMS objects. The MQ listener sends the message to the adapter manager. 3. The adapter manager analyzes the contents of the message to determine the appropriate adapter to send the request. In the case of MQ, the message is sent to the program adapter. 4. When an inbound message is received by the program adapter, the program adapter invokes the XML parser. The XML parser parses the XML message using the sys_template.xml or user_template.xml, to identify the controller command to be called and the mapping of message elements to command parameters. If the message is not found, an error is generated and returned to the MQ listener. The MQ listener puts the error in the WebSphere MQ wc_error queue via the JMSErrorQueue object. 5. Once the message has been parsed and mapped and the proper command and parameters are available to be executed, the program adapter passes the command name and command parameters to the Web controller. 6. The Web controller starts the transaction and executes the command. The controller command will execute business logic by invoking various tasks commands and business logic which update the instance database. 7. If successful, the Web controller commits the transaction and returns. 8. Customer is registered and can now log on. Chapter 9. Requirements analysis and solution design 309 Use Case ID: name UC-A05 Alternatives Register a customer using the online registration available from the store, or by a CSR using the Organization Administration Console. Solution chapter 21.6, “Scenario: add new inbound message for MQ” on page 936 Table 9-15 UC-A06: Notify users via e-mail that an event has occurred Use Case ID: name UC-A06 Description Notify users via e-mail that an event has occurred within WebSphere Commerce such as a password reset or order approved confirmation. Precondition Primary actor Customer Secondary actor System Main Scenario Upon an event such as a password reset, an e-mail is sent to the user or administrator alerting them of the event. Alternatives N/A Solution chapter 21.7, “Scenario: e-mail notification” on page 950 ITSO store is deployed e-mail messaging is enabled and message type is defined. Refer to 21.7, “Scenario: e-mail notification” on page 950 for details. 9.3 Solution design This section provides an overview of the technical solution and its benefits for the ITSO site scenario, and includes the following: Systems architecture Component model ITSO store navigation ITSO store catalog hierarchy ITSO store organizational hierarchy 9.3.1 Systems architecture The architecture overview diagram represents the governing ideas and candidate building blocks of an ITSO site system. It provides an overview of the 310 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide main conceptual elements and relationships in an architecture, including nodes, connections, data stores, users, and external systems. The main purpose of the architecture overview diagram is to explain the target IT system by providing a conceptual view of the components and operational environment as seen in Figure 9-4. DMZ Outside world Internal network WebSphere Commerce 5.5 BE + Fixpack 2 WebSphere Commerce Payments 5.5 WebSphere Application Server V5 + Fixpack 2 DB2 8.1 UDB Client + Fixpack 2 WebSphere MQ 5.3.1 (bindings mode) JavaMail 1.2 Windows 2000 Server + SP4 User I N T E R N E T 80/443 80/443 Web Server Web node Server (webwin1) IBM HTTP Server 1.3.26 WebSphere V5 plugin + Fixes Windows 2000 Server + SP4 Domain Firewall Domain Name Server Protocol Firewall Public Key Infrastructure WebSphere Commerce node (wcwin1) WebSphere Commerce Analyzer node WebSphere Commerce Analyzer 5.5 DB2 Intelligent Miner for Data 8.1.1 DB2 UDB 8.1 Enterprise Server Edition + Fixpack 1 + Fixes Windows 2000 Server + SP4 DB2 UDB 8.1 Enterprise Server Edition + Fixpack 2 Windows 2000 Server + SP4 DB2 Server node (db2win1) WC instance database WC Payments database Back-end Systems James 2.1.3 (e-mail) Procurement Fullfilment Payment External System(s) Figure 9-4 ITSO site system diagram System architecture implementation The implementation procedures for the ITSO site system architecture depicted in Figure 9-4 can be found in several chapters in this redbook. The ITSO sample store can be deployed on any supported platform and topology. To illustrate a production-like environment, we chose the configuration seen in Figure 9-4 on the Windows platform. For testing purposes, all nodes and components can be installed on the same node, with the exception of the WebSphere Commerce Analyzer. Chapter 9. Requirements analysis and solution design 311 For details on how to implement the system architecture for the ITSO working example, refer to the following: Web Server node For details on the Windows platform, refer to 16.4, “Add remote Web Server node” on page 587. WebSphere Commerce node For details on the Windows platform, refer to 16.2, “Single-tier implementation” on page 559. DB2 Server node For details on the Windows platform, refer to 16.3, “Add a remote Database Server node” on page 582. WebSphere Commerce Analyzer node For details on the Windows platform, refer to Chapter 20, “Commerce analytics” on page 787. Integrating WebSphere MQ with WebSphere Commerce For details on the Windows platform, refer to Chapter 21, “Messaging integration with MQ and e-mail” on page 883. Integrating e-mail with WebSphere Commerce For details on the Windows platform, refer to Chapter 21.7, “Scenario: e-mail notification” on page 950. 9.3.2 Component model The component model describes the ITSO site's entire hierarchy of components and briefly defines their responsibilities. Note: A component is a relatively independent part of an information technology (IT) system. It is characterized by its responsibilities and eventually by the interface(s) it offers. Components can be decomposed into smaller components or composed into larger components. Most components are software, although some may be hardware. Some components may already exist within the IT system, but it may be necessary to build or buy others. Component relationship diagram Figure 9-5 on page 313 outlines the component model for ITSO site in four layers: 1. The channel control layer contains channel-specific components responsible for a certain view of the system and certain protocols. 312 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 2. The presentation control layer contains components responsible for controlling a specific use case. A presentation component acts as a controller in executing a use case. This means that the presentation component will keep track of the use case flow (step logic), keep track of the current state, and present adequate views to interact with the user. To perform business operations, the component will call upon components in the business services layer. 3. Business services are responsible for all ITSO business logic provided by different WebSphere Commerce subsystems. 4. The back-end integration layer contains components that act as wrappers to ITSO back-end systems. The technical components layer provides functionality that is required but it is not a part of the core business processes, for example, database or content management. Channel Control Presentation Control Back-end Integration Login HTTP Request Servlet Web Controller Business Services Register/Update User Information Browse ITSO Site Shop MQ Listener Member Services Catalog Services Product Import Order Services Order Fulfillment Get Order Status Technical components Content Mgmt. Payment Database Figure 9-5 ITSO site components Component descriptions The component descriptions are as follows: 1. HTTP request servlet The HTTP request servlet handles incoming HTTP requests passed on from the servlet engine. 2. MQ listener The MQ listener is a protocol listener that listens for messages from the JMS objects (queues) defined for WebSphere MQ, and then dispatches the requests to the program adapter. The program adapter uses the XML parser Chapter 9. Requirements analysis and solution design 313 and template mapping files to parse the message elements, map the elements to command parameters, and pass them with the identified command to the Web controller. 3. Web controller The Web controller provides the presentation component with services such as session management, transaction control, access control, and authentication. The controller is also responsible for dispatching the appropriate presentation components depending on the request. 4. Login This component is responsible for the login presentation logic. It can cover the presentation of use cases such as login, forgotten password or post-login page customization. 5. Registration/customer information update This component handles the registration and customer information update presentation logic. It can cover the presentation of use cases such as registering new customers or updating customer profiles. 6. Browse ITSO site This component is responsible for the ITSO site catalog presentation logic. 7. Shop This is the core commerce component that allows all customers to buy items from the ITSO catalog. This component can be responsible for the use cases of adding an item to a shopping basket, placing an order, canceling an order, etc. 8. Get Order Status This component allows customers to retrieve the status of placed orders. 9. Member Services Member Services cover all business logic for login, registration, customer user profile updates, and logoff. 10.Catalog Services This component provides the online catalog navigation, merchandising features, interest lists, and search capabilities. 11.Order Services Order Services provide shopping carts, order processing, and order management function support. 314 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 12.Product Import This ITSO site component is the main focus of this book. The Product import component is responsible for: a. Importing product data from a back-end system. b. Transformation of data using the Loader Package Transformation Tool. c. Loading data to the staging server using the Loader Package MassLoad tool. d. Propagating data to the production server using WebSphere Commerce Staging Server utilities. 13.Order fulfillment Order fulfillment does a routing of all orders placed to the ITSO fulfillment services. 14.Payment Payment is an interface to the ITSO payment services. 15.Content management This component is responsible for managing all content for the ITSO site that is not dynamically generated from data stored in the WebSphere Commerce database. The content management component can be divided into several internal subcomponents that only interact within the content management component. These subcomponents are: – – – – – – – Workflow Data Capture Templating Presentation Templating Deployment Virtualization Navigation/Site Mapping Link Tool 16.Database The database contains all data that the ITSO site needs for operation. This includes the complete set of products and categories as well as user profile information. 9.3.3 ITSO store navigation Figure 9-6 on page 316 displays the ITSO store navigation. The site navigation is virtually the same as the Business Direct (ToolTech) sample we used to create the ITSO store. In Chapter 12, “Create a store” on page 341, we modify the store front assets for look and feel. In Chapter 13, “Customize a store: Price Watch example” on page 393, we add a page for price watch. Chapter 9. Requirements analysis and solution design 315 Logon page Forgot password Forgot password page Login Register Login Registration Page Home page Collaborative Home workspaces* Catalog Account Collaborative workspaces page* Main category display page Account page View members Select a sub-category Collaborative workspaces members page Requisition list page Select a requisition list Your order page Order status Order status page Log off Logon page Create a requisition list Edit requisition list page Sub-category page Select a product Requisition list Current order Update quantity Product display page RFQ list Advanced search Advanced search page Quick order Enter more items Search results Quick order page Product display page Your order page Place order Your order page Select an item Item display page Add to RFQ Add to order Add to requisition list New Existing New Create RFQ page Add to RFQ list page New requisition list page Existing Add to requisition list page Legend These pages can be accessed from any page in the site. * The collaborative workspaces link can only be seen if the feature is enabled. Figure 9-6 IITSO store navigation 316 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 9.3.4 ITSO store catalog hierarchy The ITSO sells two product types, software and books. The ITSO has decided that they would like the catalog hierarchy organized by brand. Figure 9-7 depicts the ITSO catalog hierarchy for categories and products. Category Sub category Product ITSO Master Catalog Item Software Redbooks WebSphere WebSphere Redbook products PDF item DB2 Tivoli DB2 Redbook products Tivoli Redbook products Hardcopy PDF item item Hardcopy PDF item item Lotus Lotus Redbook products Hardcopy PDF item item Hardcopy item WebSphere DB2 Tivoli Lotus WebSphere software products DB2 software products Tivoli software products Lotus software products Zip item Zip item Zip item Zip item CD item CD item CD item CD item Figure 9-7 ITSO store catalog hierarchy for categories and products by brand 9.3.5 ITSO store organizational hierarchy Figure 9-8 on page 318 displays the ITSO store organizational structure. For more detailed information refer to Chapter 15, “Manage the ITSO store” on page 527. Chapter 9. Requirements analysis and solution design 317 Root Organization Site Administrators Default Organization Seller Organization Seller Seller Administrators Adm inistrators Buyer A Organization Buyer B Organization Buyer Buyer Administrators Administrators B 2B Organization Buyer Organization BigCo Buyer Organization EduCo B uyer Organization Figure 9-8 ITSO organizational structure 318 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 10 Chapter 10. ITSO sample code This chapter provides a description of the ITSO sample code developed for the ITSO B2B working example. In addition, we explain where to download the ITSO sample code zip file and how to configure the scripts provided. © Copyright IBM Corp. 2003. All rights reserved. 319 10.1 Description of sample code The sample code and configuration files developed for the ITSO B2B working example and other chapters can be found in the 6969code.zip file. The ITSO sample code 6969code.zip can be downloaded at: ftp://www.redbooks.ibm.com/redbooks/SG246969 Unzip the contents of the Web material zip file. For example, after unzipping the 6969code.zip, you will have the c:\6969code directory. Table 0-1 Redbook sample code contents File name or directory Description c:\6969code Root directory of redbook samples. c:\6969code\build\SARFile * Contains build.xml Ant script used to package the SAR with store front and data assets. * For details refer to Chapter 12, “Create a store” on page 341. c:\6969code\build\DeployTool * The DeployTool is used to build Java application assets (commands and EJBs), package them to a JAR file, and deploy the JAR file to the WebSphere Commerce runtime environment. * For details refer to Chapter 12, “Create a store” on page 341. c:\6969code\pricewatch * Price watch customization sample Java source code files. * For details refer to Chapter 13, “Customize a store: Price Watch example” on page 393. c:\6969code\sar * ITSO.sar (full working SAR for ITSO sample) * For details refer to Chapter 12, “Create a store” on page 341. c:\6969code\catdata * Development test catalog data for ITSO sample * Pruned catalog data * For details refer to Chapter 12, “Create a store” on page 341. c:\6969code\storexml * Contains ITSO modified XML files found in ITSO.sar. c:\6969code\scripts Scripts used to automate tasks such as server startup, JSP pre-compile, etc. c:\6969code\wca * WebSphere Commerce Analyzer custom report sample. * For details refer to Chapter 20, “Commerce analytics” on page 787. c:\6969code\mq * MQ messaging sample message customization files. * For details refer to Chapter 21, “Messaging integration with MQ and e-mail” on page 883. 320 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 10.2 Prepare DeployTool files After downloading and unpacking the ITSO sample code zip file (6969code.zip), you will need to manually copy some files from the WebSphere Commerce and WebSphere Application Server runtime and WebSphere Commerce Studio to the DeployTool directory for the DeployTool to work properly. The DeployTool is used in Chapter 14, “Build and deployment” on page 505. Note: DeployTool The DeployTool is used to build Java application assets (commands and EJBs) and package them to a JAR, and is used to deploy the JAR file to the WebSphere Commerce runtime environment. The DeployTool included in the ITSO sample code zip file was supplied by the IBM Electronic Commerce development organization. New versions of the DeployTool will be made available in the future via the IBM WebSphere Commerce Support page. 10.2.1 Copy WebSphere Commerce files Copy the following files from the \installedApps\\WC_.ear of a WebSphere Commerce instance (WebSphere Commerce node) to the c:\6969code\build\DeployTool\buildjars directory: Catalog-ProductManagementData.jar Catalog-ProductManagementLogic.jar Enablement-BaseComponentsData.jar Enablement-BaseComponentsLogic.jar Enablement-IntegrationData.jar Enablement-IntegrationLogic.jar Enablement-RelationshipManagementData.jar Enablement-RelationshipManagementLogic.jar Marketing-CampaignsAndScenarioMarketingData.jar Marketing-CampaignsAndScenarioMarketingLogic.jar Marketing-CustomerProfilingAndSegmentationData.jar Marketing-CustomerProfilingAndSegmentationLogic.jar Member-MemberManagementData.jar Member-MemberManagementLogic.jar Merchandising-PromotionsAndDiscountsData.jar Merchandising-PromotionsAndDiscountsLogic.jar Order-OrderCaptureData.jar Order-OrderCaptureLogic.jar Chapter 10. ITSO sample code 321 Order-OrderManagementData.jar Order-OrderManagementLogic.jar Trading-AuctionsAndRFQsData.jar Trading-AuctionsAndRFQsLogic.jar 10.2.2 Copy WebSphere Application Server files Copy the following files from the \lib directory to the c:\6969\code\build\DeployTool\wasjars directory: appprofile.jar distexcep.jar dynacache.jar ecutils.jar ejbcontainer.jar ejbportable.jar ivjejb35.jar j2ee.jar ras.jar runtime.jar runtimefw.jar vaprt.jar wsexception.jar 10.2.3 Copy WebSphere Commerce Studio files Copy the following file from the \Commerce\lib directory to the c:\6969\code\build\DeployTool\tools directory: Utilities.jar Copy the following files from and to the following directories: as400.mapping oracle.mapping From: \Commerce\properties\com\ibm\commerce\metadata\conv ersion To: c:\6969\code\build\DeployTool\tools 322 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 11 Chapter 11. Implement a team development environment When developing software in teams, it is especially important to have a proper system for software configuration management (SCM) and a controlled build environment. This chapter describes how to implement the solution components of the Build and SCM node, Development node, and Development Integration Test node within ITSO team development environment. The chapter is organized into the following sections: Team development environment scenario Build and SCM node implementation Development node implementation Development Integration Test node implementation © Copyright IBM Corp. 2003. All rights reserved. 323 11.1 Team development environment scenario To create the development artifacts for the ITSO working example, we set up a controlled build environment that included software configuration management (SCM). The ITSO team development environment consisted of three primary node types: Build and SCM node, Development node, and Development node (1-to-n), as seen in Figure 11-1. There are several alternatives that are not depicted in Figure 11-1, such as a shared database server, shared WebSphere Commerce instance database, and shared remote WebSphere Commerce Payments node. WebSphere Commerce 5.5.0.2 BE WebSphere Commerce Payments 5.5 WebSphere Application Server 5.0.1 IBM HTTP Server 1.3.26.2 DB2 UDB V8.1 ESE + Fixpack 3 Microsoft Internet Explorer 6 + SP1 Windows 2000 Server + SP4 VMWare Workstation 4 Development Integration Test node (wc55be) Development node Deploy Concurrent Versions System for NT 2.0.4 Server WebSphere Commerce Studio 5.5 BDE + FP2 WebSphere Studio Application Developer 5.0.1 DB2 UDB V8.1 + Fixpack 3 WebSphere Commerce build scripts Microsoft Internet Explorer 6 + SP1 Windows 2000 Server + SP4 Build and SCM node (wcbuild) Development node WebSphere Commerce Studio 5.5.0.2 BDE WebSphere Studio Application Developer 5.0.1 Concurrent Versions System client plugin for WSAD DB2 UDB V8.1 ESE + Fixpack 3 Microsoft Internet Explorer 6 + SP1 Windows 2000 Server + SP4 Development node Figure 11-1 ITSO team development environment Build and SCM node The Build and SCM node includes the Concurrent Version System (CVS) Server, WebSphere Commerce Studio, and the build scripts. It has two primary functions: CVS Server and repository for ITSO development assets, and a build server to extract source code from CVS and execute a headless WebSphere Commerce build (WebSphere Commerce Studio workbench not required). The 324 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Build and SCM node is managed by the development lead or on very large projects, a designated build person or team. It is desirable to have WebSphere Commerce Studio on the Build and SCM node for several reasons. First, the Java tools and required classes will be present to compile the Java assets developed. Second, WebSphere Studio Application Developer offers a source level debug test facility within the WebSphere Test Environment. Third, although we will demonstrate how to perform a headless build, it is beneficial to have a common method of extracting CVS as on the Development node if a manual procedure is needed. Finally, on smaller teams, the Build and SCM node may be the lead developer’s system where the CVS environment is seeded with the development assets. Table 11-1 lists the software and versions used on the Build and SCM node within the ITSO team development environment. Table 11-1 Build and SCM node software components Software Version Microsoft Windows 2000 Server Service Pack 4 Microsoft Internet Explorer 6.0 + Service Pack 1 Concurrent Versions System for NT (CVSNT) Note: Works on Windows NT® and Windows 2000 2.0.4 WebSphere Commerce Studio, Business Developers Edition 5.5.0.2 (5.5 + Fix Pack 2) WebSphere Studio Application Developer 5.0.1 (5.0 + PTF 1) IBM DB2 UDB Enterprise Server Edition 8.1.3.132 (8.1 + Fix Pack 3) WebSphere Commerce build scripts Note: Supplied with ITSO sample code N/A Development node The Development node includes WebSphere Commerce Studio, and a CVS client plug-in for WebSphere Studio Application Developer. Developers will interact with the CVS Server via the CVS client to manage source code (commit, update, etc.). Table 11-2 on page 326 lists the software and versions used on the Development node within the ITSO team development environment. Chapter 11. Implement a team development environment 325 Table 11-2 Development node software components Software Version Microsoft Windows 2000 Server Service Pack 4 Microsoft Internet Explorer 6.0 + Service Pack 1 WebSphere Commerce Studio, Business Developer Edition 5.5.0.2 (5.5 + Fix Pack 2) WebSphere Studio Application Developer 5.0.1 (5.0 + PTF 1) Concurrent Versions System for Windows Client plug-in for WebSphere Studio Application Developer N/A IBM DB2 UDB Enterprise Server Edition 8.1.3.132 (8.1 + Fix Pack 3) Development Integration Test node The Development Integration Test node is a fully working WebSphere Commerce V5.5 runtime environment, including IBM HTTP Server, DB2, WebSphere Application Server, WebSphere Commerce, and WebSphere Commerce Payments. The Development Integration Test node is used by the ITSO development team to verify the integration of code from multiple developers. 326 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Note: On large development projects, there are often several types of tests performed on a build. The type of testing we focused on while developing the ITSO store is limited to the development unit test and integration test. For example: Unit Test: Each developer will unit test the code being developed within his or her own WebSphere Commerce Studio workspace. Development Integration Test: This involves integrating and testing code from multiple developers on a common team development test node. Build Verification Test (BVT): After the build has compiled and packaged, a basic suite of tests are run to verify that the application is working properly. This is done to establish a basic quality level of the build prior to more extensive testing is done. Function Verification Test (FVT): This type of testing is performed to verify specific functionality within the newly developed code. This type of testing is done typically early in the testing cycle in preparation for system testing or integration testing. System Verification Test (SVT): This type of testing includes integration and full testing of the application. Customer Acceptance Test (CAT): After the application has been approved for deployment by the SVT team, the application is now ready to be tested and eventually approved by the customer before going live. When constructing a Development Integration Test node, there are several things to consider. First, you may have daily builds and will need an environment that can be reset to a known state before deploying the new build. Second, the Development Integration Test node should be consistent from one build to the next. Finally, the setup of the Development Integration Test node should be quick and easy. For the reasons stated, we recommend using a product such as Ghost or VMware to quickly reload a clean WebSphere Commerce runtime environment to verify new builds. For the ITSO team development environment, VMware V4 Workstation Edition offered an ideal solution for the Development Integration Test node. We constructed a VMware image with Windows 2000 Server, IBM WebSphere Commerce V5.5, Business Edition + Fix Pack 2, WebSphere Application Server V5 + Fix Pack 1 + Fixes, DB2 UDB V8.1 + Fix Pack 3, and a newly created WebSphere Commerce instance, and WebSphere Commerce Payments database. We refer to this as the perfect image of WebSphere Commerce. After we created the perfect VMware WebSphere Commerce image, we created a backup of the VMware image (zip file), and used the backup of the image as a starting point to verify the new builds. Chapter 11. Implement a team development environment 327 Table 11-3 lists the software and versions used on the Development Integration Test node within the ITSO team development environment. Table 11-3 Development Integration Test node software components Software Version VMware Workstation for Windows 4 Microsoft Windows 2000 Server Service Pack 4 Microsoft Internet Explorer 6.0 + Service Pack 1 IBM HTTP Server 1.3.26.2 (1.3.26 + WAS 5 FP1) IBM WebSphere Application Server 5.0.1 (5.0 + FP1 + Fixes) IBM DB2 UDB Enterprise Edition 8.1.3.132 (8.1 + Fix Pack 3) IBM WebSphere Commerce Business Edition * includes IBM WebSphere Commerce Payments 5.5.0.2 (5.5 + Fix Pack 2) 11.2 Build and SCM node implementation This section describes how to implement the Build and SCM node used within the ITSO team development environment. This section is organized as follows: CVS overview CVSNT Server implementation WebSphere Commerce Studio installation Publish store archive within WebSphere Test Environment CVS client configuration The primary development environment component of WebSphere Commerce Studio is WebSphere Studio Application Developer. WebSphere Studio Application Developer is a file-based integrated development environment (IDE). In most cases, developers do not work alone, but rather as part of a team. The open architecture of WebSphere Studio Application Developer V5 allows software configuration management (SCM) systems to be integrated through the use of a plug-in. WebSphere Studio Application Developer includes SCM plug-ins for Concurrent Version System (CVS) and Rational ClearCase® LT. Both SCM plug-ins are installed with the default WebSphere Studio Application Developer installation. The SCM server products are not installed by WebSphere 328 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Studio Application Developer. The built-in CVS client support includes CVS Team Provider Core 2.0.0, CVS SSH Core 2.0.0 and CVS Team Provider UI 2.0.1 plug-ins. Rational ClearCase LT is the bundled SCM server included with WebSphere Studio Application Developer. The CVS Server is available for download on several platforms, including AIX, Linux and Windows. Within IBM, there is also an SCM plug-in for CMVC, which is an IBM internal SCM tool used by the IBM software development community. CMVC is a very powerful SCM tool, but is no longer available as a product for sale outside of IBM. In the remainder of this section, we will focus our attention on CVS. 11.2.1 CVS overview Concurrent Version System (CVS) is a simple open-source software configuration management (SCM) system. CVS offers version control for parallel development, but does not offer many of the advanced features included with a product, such as Rational ClearCase. We selected CVS for the ITSO example for several reasons. First, we wanted to use a SCM tool that people could easily download for free. Second, we wanted to keep the software configuration management within this redbook at a basic level so that it would not detract too much from the core WebSphere Commerce development. Finally, CVS is relatively easy to use and many people are already familiar with how to install, configure and use it. Some of the main features of CVS are as follows: Multiple client/server protocols over TCP/IP that let developers access the latest code from a wide variety of clients from virtually any location with an Internet connection. Note: WebSphere Studio Application Developer supports two communication protocols: pserver (password server) and ssh. The default is pserver. The other protocol has to be manually configured by selecting Window -> Preferences -> Team -> CVS -> Ext Connection Method. It stores all the versions of a file in a single file using forward-delta versioning, keeping only the most current version and differences from earlier versions. It insulates the different developers from each other. Every developer works in his own directory, and CVS merges the work in the repository when each developer is done. Conflicts should be resolved in the process. Chapter 11. Implement a team development environment 329 Important: CVS and WebSphere Studio Application Developer have a different understanding of what a conflict is. For CVS, a conflict arises when two changes to the same base file are close enough to be noticed by the merge command. For WebSphere Studio Application Developer, a conflict is when the base revision of a modified file is different from the revision stored in the repository. Its unreserved checkout approach to version control helps avoid artificial conflicts common when using an exclusive checkout model. It keeps your shared projects’ data in repositories. Each repository has a root directory on the file system. CVS maintains a history of the source code revisions. Each change is stamped with the time it was made and the user name of the person who made it. It is recommended that developers also provide a description of the change. Given that information, CVS can help you find who made the change and when it was made and why. For more information on CVS, refer to the following URLs: Concurrent Versions System home page: http://www.cvshome.org Concurrent Versions System for NT (CVSNT) home page: http://www.cvsnt.org 11.2.2 CVSNT Server implementation In the ITSO team development environment, we decided to install the CVS server on the same node as the build server. WebSphere Commerce Studio is only available on Windows, so we needed to use CVS for NT (CVSNT), and we wanted to run CVS on the same node (Build and SCM node). The CVSNT Server implementation is organized as follows: CVS Server installation CVS Server repository configuration Create CVS users 330 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: CVSNT is not officially supported by the Eclipse platform, which WebSphere Studio Application Developer is based on. Eclipse does officially support CVS on AIX and Linux. Depending on the version, different bugs may occur. In our case, we used CVSNT 2.0.4 without any problems. An important note about CVSNT support can be found at: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-vcm-home /docs/online/cvs_features2.0/cvs-faq.html CVSNT was ideal for our environment because we could install the CVS Server on the same node as WebSphere Commerce Studio, and it is easy to use. We did not experience any significant problems using the CVSNT version. CVS Server installation To install CVS on the Windows platform, do the following: 1. Before installing CVSNT, we recommend reading the installation tips found at: http://www.cvsnt.org/wiki/InstallationTips 2. Download the CVSNT V2.0.4 Server (cvsnt-2.0.4.exe) from the following URL to a temporary directory (for example, c:\temp) on the Build and SCM node: http://www.cvsnt.org 3. Execute the CVSNT installer by double-clicking the self-extracting cvsnt-2.0.4.exe file from the temporary directory. 4. Unless noted, we accepted the default options: – We selected Typical installation. – We installed to the c:\cvsnt directory. – Under protocol, we selected Named Pipe (:ntserver) Protocol 5. When the installation is complete, restart your system even if the installer does not prompt you to do so. This step will guarantee that the environment variables are set up properly. CVS Server repository configuration After you have installed the CVS Server and restarted your system (Build and SCM node), do the following to create and configure the CVS Server repository: 1. Stop the CVS services in order to create the repository, by clicking Start -> Programs -> CVSNT -> Service Control Panel. Chapter 11. Implement a team development environment 331 2. When the CVSNT control panel window appears, stop the services CVS service and CVS Lock service by clicking Stop (see Figure 11-2). Figure 11-2 CVSNT service configuration (Service Status page) 3. Click the Repositories tab, and check Repository Prefix. We want our repositories to be under a common root directory. This is purely an organizational feature and is optional. 4. You have to manually create the common root directory. For example, we created the c:\rep directory. 5. Click the Browse button. Select the path you want to be the repository prefix. For example, we selected the c:\rep directory. 6. Click Add to create the new itso repository (c:/rep prefix should be displayed). We choose to call the repository /itso, as seen in Figure 11-3 on page 333 and then clicked OK. 332 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 11-3 ITSO repository path 7. When prompted with the message “c:/rep/itso does not exist, Create it?”, click Yes to create it. When done, the Repository page should look like Figure 11-4. Figure 11-4 CVSNT service configuration (Repository page) 8. Select the Advanced tab. Do the following and then click Apply (see Figure 11-5 on page 334): – Check Server side support for ntserver protocol – Check Impersonation enabled – Check Use local users for pserver authentication instead of domain users Chapter 11. Implement a team development environment 333 CVSNT uses either the domain or the local server directory for user authentication under the pserver protocol. You have to choose the correct value for your environment. This setting only applies if your machine is connected to a Windows domain. Figure 11-5 CVS service configuration (Advanced page) 9. Select the Services Status tab. Click Start for the CVS service and CVS Lock service. The status should change to Running. Create CVS users When setting up CVS users, you have two options: creating separate Windows users for each CVS user (good for high security and auditing needs), or sharing one Windows user for all CVS users (good for ease of configuration and less stringent security needs). Note: As mentioned when configuring the CVS repository, you can choose between local accounts or domain accounts (we used local accounts). Within our example we are not focused on security. In a production environment, we recommend that you refer to the CVS documentation to secure your environment for your needs. 334 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide For the ITSO team development environment, we shared one Windows user for all CVS users as follows: 1. To add the Windows users for developers using CVS, do the following: a. Add desired CVS users to Windows on the Build and SCM node by clicking Start -> Setting -> Control Panel -> Administrative Tools -> Computer Management. b. Select Local Users and Groups -> Users. c. From the menu bar, click Action -> New User. d. We created a user called CVSuser. e. Add CVSuser to the group Power Users. 2. To add CVS users to the CVS repository, do the following: a. Open a Windows command prompt. b. Set the cvsroot as follows: set cvsroot=:ntserver:wcbuild:/itso Where wcbuild is the host name of the Build and SCM node, and itso is the repository created for the ITSO (no prefix). Note: The host name must be specified. For example, specifying localhost will not work. c. Enter the following CVS commands to add users: cvs passwd -a -r CVSuser jganci Where CVSuser is the Windows user created that will be shared by all CVS users, and jganci is the CVS user added to the CVS passwd file found in the c:\rep\itso\CVSROOT. You will be prompted for the desired password of the user being created. We do not recommend that you modify the passwd file directly. Repeat this step for each developer needing CVS access. 3. Next, provide the development users their CVS account information, host name and connection type to the CVS server so that they can establish a connection from WebSphere Studio Application Developer in a later configuration step on the Development node. For example: – Account info: developer CVS user created (for example, jganci) – Host name: CVS Server host name (for example, wcbuild) – Connection type: pserver Chapter 11. Implement a team development environment 335 11.2.3 WebSphere Commerce Studio installation Refer to Appendix E, “WebSphere Commerce Studio implementation” on page 1005 for details. The appendix includes updated procedures for installing and configuring WebSphere Commerce Studio V5.5 with fix packs for WebSphere Studio Application Developer V5.0.1, WebSphere Test Environment V5.0.1, IBM DB2 UDB V8.1 Fix Pack 3, and the WebSphere Commerce Studio Toolkit V5.5.0.2 Fix Pack. 11.2.4 Publish store archive within WebSphere Test Environment After installing and configuring WebSphere Commerce Studio, we will prepare the workspace for development by backing up the WebSphere Commerce instance database and publishing the store archive. Back up databases Before publishing a store within the WebSphere Studio Application Developer WebSphere Test Environment, we recommend that you back up the WebSphere Commerce development instance database (for example, wc1dev) and the WebSphere Commerce Payments database (wpm). For details on how to back up a DB2 database, refer to, “DB2 backup and restore” on page 988. Publish a store archive (SAR) In our example, we used the modified store archive customized by the lead developer to publish into the development environment. For details on the customized store, refer to Chapter 12, “Create a store” on page 341. You can publish any store to this environment. You have the option of restoring the clean WebSphere Commerce instance database at a later time if needed. For details on how to publish a store archive refer to 14.3.1, “Publish the store archive (SAR)” on page 520. You will need to copy the store archive that has been customized to the appropriate location within the WebSphere Commerce Studio environment. 11.2.5 CVS client configuration This section describes CVS client configurations to be made for use with WebSphere Studio Application Developer. 336 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Set CVS DTD file extension to ASCII We discovered when adding DTD files to the CVS repository that by default the file would be added as a binary file. This is not the desired or expected behavior. To address this issue, we did the following: 1. From within WebSphere Commerce Studio Workspace, select Window -> Preferences. 2. Select and expand Team -> File Content. 3. Click Add, and enter dtd in the file extension text box, then click OK. When done, you should see dtd file extension listed as ASCII content type. Label decorations for CVS When working with CVS within WebSphere Studio Application Developer, we recommend adding some visual clues to the environment: 1. Select Window->Preferences in WebSphere Studio Application Developer 2. Expand the Workbench node and click Label Decorations. Note: Workbench is listed first, even though all other options are listed alphabetically. 3. Ensure the CVS check box is checked. 4. Click OK. This will make sure that the icons of any resource that is under source control will get a small cylinder icon, the release number appended to the resource name, the file type (ASCII/Binary) and a greater-than sign in front of the resource name if the file is locally modified and therefore not in synchronization with the repository. If the resource is not under source control, it will have a small question-mark added to its icon, signifying that the file is unknown to CVS. 11.3 Development node implementation This section describes how to implement the Development node used within the ITSO team development environment. The primary software component of WebSphere Commerce Studio used on the Development node is WebSphere Studio Application Developer V5.0.1. Once the WebSphere Commerce Studio is installed, we explain how to configure the CVS client within WebSphere Studio Application Developer. Chapter 11. Implement a team development environment 337 11.3.1 WebSphere Commerce Studio installation Refer to Appendix E, “WebSphere Commerce Studio implementation” on page 1005 for details. The appendix includes updated procedures for installing and configuring WebSphere Commerce Studio V5.5 with fix packs for WebSphere Studio Application Developer V5.0.1, WebSphere Test Environment V5.0.1, IBM DB2 UDB V8.1 Fix Pack 3, and the WebSphere Commerce Studio Toolkit V5.5.0.2 Fix Pack. 11.3.2 CVS client configuration For details on configuring the CVS client within WebSphere Studio Application Developer, refer to 11.2.5, “CVS client configuration” on page 336. 11.4 Development Integration Test node implementation While developing the implementation procedure, we found it very useful to use VMware 4.0 and Ghost 6.5 to take a snapshot of the IBM WebSphere Commerce V5.5, Business Edition runtime environment by creating an image of the system. There are other utilities like this on the market. Each utility has advantages. For details on implementing the Development Integration Test node, refer to the following: 16.2, “Single-tier implementation” on page 559 Installation Guide, IBM WebSphere Commerce V5.5 for Windows 2000 product guide A VMware system image is very nice in that it is portable to different systems. You can store multiple versions of virtual machines on the same system and easily start them (limited by disk space). When using VMware you do sacrifice a bit on performance. We used VMware 4.0 and the Microsoft Sysprep utility to change the Windows SID. We found VMware to be especially useful and amazingly compatible and reliable (truly excellent software). For more information on VMware, refer to the following URL: http://www.vmware.com/ During the installation of the nodes in the ITSO runtime environment, we created zip files (backups) for key stages of the implementation. Ghost allows for the imaging of systems, but is much more limited in moving images to a system of different hardware specs (device drivers). The big 338 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide advantage of Ghost is that when done, you are running the native operating system on the hardware and have better performance. We used the Ghost multicast feature to load systems on the network and created Microsoft DOS-based network client boot diskettes to connect to a Windows 2000 share where the Ghost image was stored. This can be used to capture (dump) or load from image. For more information on Symantec Ghost, refer to the following URL: http://www.ghost.com/ Using these utilities allowed us to go back to a previous state during the installation (provided an image was captured of the system). This can save a tremendous amount of time and allow you to verify your knowledge of the environment before proceeding to a deployment in a production environment. Tip: The following only applies if you have Windows 2000 Datacenter Server on your build server. VMware V3.2 does not support a Physical Address Extension (PAE) enabled host system, so we had to disable PAE by removing “/PAE” from the boot.ini file of the host system, which is running Windows 2000 Datacenter Server, by doing the following: Make a copy of the original copy of boot.ini file Change the last line in boot.ini file from: multi(o)disk(0)rdisk(0)partition(1)\WINNT=”Microsoft Windows 2000 Datacenter Server” /fastdetect /PAE To: multi(0)disk(0)disk(0)partition(1)\WINNT=”Microsoft Windows 2000 Datacenter Server” /fastdetect Chapter 11. Implement a team development environment 339 340 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 12 Chapter 12. Create a store This chapter describes how to seed the development environment with a new store using one of the sample stores shipped with IBM WebSphere Commerce V5.5, Business Edition as a starting point. In addition, we demonstrate by example the key changes that must be made to assets of the store and provide a procedure and Ant script to package the store archive in preparation for deployment. For more advanced customization of commands and EJBs, refer to Chapter 13, “Customize a store: Price Watch example” on page 393. The chapter is organized into the following sections: Overview Package and verify store archive Import store assets into CVS Required customization of basic store assets Further customization of basic store assets Publish the store archive to the workspace Add the store front files to CVS Set up additional team development nodes © Copyright IBM Corp. 2003. All rights reserved. 341 12.1 Overview The following sections describe the steps that we recommend be followed when setting up the development environment and creating a store. The instructions in 12.2, “Package and verify store archive” on page 343 and 12.6, “Publish the store archive to the workspace” on page 384 only needs to be done once, whereas the instructions in 12.8, “Set up additional team development nodes” on page 388 must be followed once for each development machine. The steps involved in the preparation of the workspace and customization of the store archive are as follows: 1. Prepare the WebSphere Commerce Studio workspace (see 12.2, “Package and verify store archive” on page 343). 2. Prepare the source control repository (optional - see 12.3, “Import store assets into CVS” on page 350). 3. Customize the store archive (see 12.4, “Required customization of basic store assets” on page 354). 4. Publish the store archive to the workspace (see 12.6, “Publish the store archive to the workspace” on page 384). 5. Prepare subsequent team developer machines (optional - see 12.8, “Set up additional team development nodes” on page 388). Figure 12-1 on page 343 gives an overview of these steps. The figure shows the individual that performs each step and illustrates the different steps involved in a stand-alone and a team development environment. 342 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Stand-alone Environment Team Environment Package and verify store archive Package and verify store archive Import store assets into CVS Stand-alone Developer Required customizations of basic store assets Required customizations of basic store assets Team Lead Optional customizations of basic store assets Optional customizations of basic store assets Publish store archive to the workspace Publish store archive to the workspace Add store front files to CVS Set up additional team development nodes Team Developer Figure 12-1 Overview of store creation steps 12.2 Package and verify store archive In this section we prepare the WebSphere Commerce Studio workspace for store customization. The WebSphere Commerce Studio installation will already have created a workspace with the WebSphere Commerce base classes and store-independent JSPs. In this section we augment this workspace with additional resources. We assume that you have already decided on a store model to base your development on. In the following examples, we use the B2B Direct store model, also known as ToolTech. Substitute all references to B2B Direct or ToolTech for the store model that you will use for development. Chapter 12. Create a store 343 If you just want to import directly the customized ITSO store assets found throughout this chapter, use ITSO.sar found in the c:\6969code\sar directory in place of the B2B Direct store archive. Note: In a team development environment, the following preparations should be performed on the Build and SCM node, acting as a master development environment. These preparation are typically performed by the development lead. For details on configuring the Build and SCM node, refer to 11.2, “Build and SCM node implementation” on page 328. 12.2.1 Back up workspace and databases Since the WebSphere Commerce Studio workspace tends to fill up with classes and projects during the life cycle of a product, it is a good idea to make a backup of the workspace before any modifications are made. In addition, we recommend that you back up the WebSphere Commerce instance database and WebSphere Commerce Payments database. Back up workspace The backup is simply done by copying the workspace from the location chosen during installation of WebSphere Commerce Studio (for example, c:\ibm\workspace) to a backup location. Ensure that WebSphere Studio Application Developer is not running during the backup. Note that the WebSphere Commerce Studio workspace occupies a lot of space. Ensure that the target drive for the backup has sufficient free space to hold the entire workspace. The workspace is approximately 400-500 MB. Back up databases We recommend that you back up the WebSphere Commerce instance database (for example, wc1dev) and WebSphere Commerce Payments database (for example, wpm) used by WebSphere Commerce Studio. For details on using the DB2 backup command, refer to “DB2 backup and restore” on page 988. 12.2.2 Create the Packaging project In this section we create a project that will be used for packaging the store archives and other deployment assets. The project will contain build scripts as well as configuration data for the store archive and a stand-alone deployment tool. This project will also include XML files used for data mass load into the instance database. 344 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide We recommend using store archives as a base for development. Using store archives has several advantages, including: Convenient packaging of database and store front assets. Useful for distributing prototypes and demo stores. Ability to change the store directory and identifier at publish time, resulting in the ability to deploy the same store in multiple instances. The concept profile stores introduced in WebSphere Commerce V5.5 are tightly linked to store archives. Possibility to package the same store in several versions, such as database-only for development purposes, lightweight upgrade version, etc. Store archives do not, however, support the deployment of database schema changes, customized Java code (such as commands and EJBs), instance-level (store-independent) data, or database assets for customized tables. In order to simplify deployment of such assets, we supply a stand-alone deployment tool to be used as a supplement to the store archive. The high-level steps involved in the creation of the packaging project are as follows: Create a project in WebSphere Studio Application Developer called Packaging. Extract the script files supplied with this redbook. Extract the sample store model archive into the project. We describe these steps in detail in the following sections. Create project in WebSphere Commerce Studio To create a project in WebSphere Commerce Studio, do the following: 1. Open WebSphere Commerce Studio by selecting Start -> Programs -> IBM WebSphere Commerce Studio -> WebSphere Commerce development environment. 2. Select File -> New -> Project. 3. Select Simple in the left-hand pane of the new window and Project in the right-hand pane (see Figure 12-2 on page 346). Click Next. Chapter 12. Create a store 345 Figure 12-2 Selecting the type of the new project 4. Enter Packaging as the project name. Click Next. Figure 12-3 Specifying the name of the new project 5. The Referenced Projects window will appear. Check Stores, WebSphereCommerceServerExtensionsData and WebSphereCommerceServerExtensionsLogic projects, then click Finish. 346 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 12-4 Selecting the referenced projects The new project will now be created. Add build script files supplied with this redbook To add the build script files supplied with this redbook, do the following: Note: The build scripts provided with this redbook will be used to package SAR files, build the application, and deploy the application. The build script can be found in the ITSO sample code c:\6969code\build directory. For more information, refer to Chapter 10, “ITSO sample code” on page 319. 1. Go to the Resource perspective by selecting Window -> Open Perspective -> Other..., select Resource in the Select Perspective window, and click OK. 2. Highlight the Packaging project and select File -> Import. 3. Select File system and click Next. 4. Enter the path to the build directory of the additional material supplied with this redbook in the Directory field, for example c:\6969code\build. 5. Select and expand the build folder in the left-hand pane. 6. Check the DeployTool folder and SARFile folder check boxes. Click Finish. Chapter 12. Create a store 347 Extract the sample store archive to the SARFile folder To extract the sample store archive into the SARFile folder, do the following: 1. Go to the Resource perspective by selecting Window -> Open Perspective -> Other, select Resource in the Select Perspective window, and click OK. 2. Select and expand the Packaging project, highlight the new SARFile folder and select File -> Import. 3. Select Zip file in the Import window and click Next. 4. Enter the path to the store archive for the store model and click Finish. Tip: You can click Browse to search for the file, but since WebSphere Studio Application Developer assumes that you will be importing a file with extension .jar or .zip, the browser window will not show store archives. To search for store archives, enter *.sar in the File name field and click Open. For example, we entered the following for the B2BDirect.sar which we chose to use as a starting point for our working example. c:\ibm\wcstudio\Commerce\samplestores\B2BDirect\B2BDirect.sar Note: If you do not wish to make the modifications found throughout this chapter, but simply want to import them, use ITSO.sar (found in c:\6969code\sar directory) instead of B2BDirect.sar. 12.2.3 Package a store archive (SAR) To ensure that the build script that was added to the SARFile project in the previous section correctly builds the store archive, we recommend that you package the store archive using the build.xml Ant script and then publish this to the Development Integration Test node as defined in 11.4, “Development Integration Test node implementation” on page 338. The purpose of this section is to validate that you have all assets of the store archive and that the store archive packaging works properly as a baseline for development. At this point, we have not customized the store archive; we are just validating that we can reproduce it. The store archive that is packaged during this procedure will be called ITSO.sar to distinguish it from the original B2BDirect.sar. The ITSO.sar at this stage is identical in function to the B2BDirect.sar. We will later make customizations to the ITSO.sar. 348 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Note: build.xml Ant script for store archive packaging We have supplied build.xml Ant script to package the store archive. There are a few scenarios in which the build.xml script is used, depending upon where the files are that it will package. The build.xml script will package both the data and store front assets into the store archive. The store archive will contain assets from the following locations: Packaging/SARFile/META-INF Packaging/SARFile/WEB-INF Packaging/SARFile/SAR-INF Packaging/SARFile/xml Stores/Web Content/ (if found) Packaging/SARFile/ (if not found in the Store project) If you have published a store archive to the workspace, the store front assets will thus be picked up from the Stores/Web Content/. Otherwise, the store front assets will be retrieved from the Packaging/SARFile/. To package the SAR file, do the following: 1. Go to the WebSphere Commerce Studio workspace. 2. Change to the Resource Pespective. 3. Expand the Packaging project. 4. Expand the SARFile folder 5. Right-click the build.xml file and select Run Ant. 6. Enter -DSTOREDIR=ToolTech in the Arguments text field. Ensure that only the build-sar-full target is checked. Note: This is a way of temporarily overriding the store directory specified in the build script. If you have chosen to base your development on another store model, substitute that model’s store directory for ToolTech in the parameter value. ITSO.sar: If you chose to use ITSO.sar, do not specify this argument. 7. Click Finish. 8. Running the build.xml script will generate a file called ITSO.sar in the SARFile folder. To verify that the file exists, select the SARFile folder, and select File -> Refresh. Chapter 12. Create a store 349 Note: The build.xml Ant script contains the store archive name. 12.2.4 Publish the store archive (SAR) To publish the ITSO.sar to the Development Integration Test node, refer to 14.3.1, “Publish the store archive (SAR)” on page 520. Ensure that you have a pristine runtime environment to publish to. As we recommended, you should have a backup of the WebSphere Commerce instance database and better yet a pristine WebSphere Commerce instance using such software as VMware or Ghost. 12.2.5 Verify the store after publish After you have published the repackaged store archive on the Development Integration Test node, we recommend that you verify the store is working properly. For details on how to verify the store, refer to 16.2.10, “Verify the runtime environment and store functionality” on page 577. At this stage you have validated the ITSO defined process for packaging the store archive. 12.3 Import store assets into CVS The purpose of this step is to prepare the CVS repository with the code and data for the store as a base for further customization. Note: You can skip this step if you do not need source control management in your environment. Up to this point all resources have been stored on the local file system. In a team development environment with software configuration management (SCM), we want to put the resources that will be changed as part of the customizations under source control. Importing store assets into CVS is done as follows: Create a CVS module from the project Add the files to CVS Table 12-1 on page 351 summarizes the projects and the resources in each project that must be added to source control. 350 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Table 12-1 Names of projects and contained directories to add to source control Project Resources Project description Packaging DeployTool SARFile Deployment packaging tools Stores Web Content Web content, such as JSPs and property files WebSphereCommerceServerExtensionsData ejbModule Custom EJBs and data beans WebSphereCommerceServerExtensionsLogic src Custom commands and utilities 12.3.1 Create a CVS module from the project The following procedure shows how to add the first project. Repeat these steps for the remaining three projects shown in Table 12-1: 1. Change to the Resource perspective. 2. Right-click the Packaging project. 3. Select Team -> Share Project. 4. When the Share Project wizard opens, we entered the CVS connection details as seen in Figure 12-5 on page 352 and then clicked Finish. In this example, we created the CVS user needed for authentication in “Create CVS users” on page 334. Tip: In our example, we chose to put only some of the files in each project under source control. This results in the label decorations for the projects always showing up with a greater-than sign, as if the contents had been altered. To avoid this, you can tell WebSphere Studio Application Developer to ignore non-CVS files by right-clicking such files or directories, selecting Team -> Add to .cvsignore and clicking OK. This will create a file named .cvsignore containing the names of those files. This file can then be put under source control using the procedure outlined above. Chapter 12. Create a store 351 Figure 12-5 Example of CVS connection information Note: At times during the development we encountered the following message even when specifying a correct user name and password: If you get this error, just enter the password once again and the CVS server should accept the user name and password. 352 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 5. WebSphere Studio Application Developer will communicate with the CVS server and create the new project as a module on the server. To verify that CVS module was created correctly, you should see the CVS server host name [CVS_Server_hostname] to the right of the Packaging project. 6. Repeat this process for each of the projects listed in Table 12-1 on page 351. 12.3.2 Add the files to CVS In the previous section, we only created the module in the CVS repository. At this point the CVS repository thus has only the Packaging directory, but no files. This step details how to add the files to the CVS module. To add files to CVS module within the CVS repository, do the following: 1. Ensure you have set the DTD to ASCII within CVS, as described in “Set CVS DTD file extension to ASCII” on page 337. Tip: If you do not perform this step, the DTD files added to the CVS repository will be stored in binary format. If you make this mistake, you can change the file content type from binary to ASCII by right-clicking the file and selecting Team -> Change ASCII/Binary Property. Next, select ASCII without keyword substitution, click Next, select Include files that are already shared in the repository and then click Finish. 2. Highlight the two folders DeployTool and SARFile, right-click one of them and select Team -> Add to Version Control. Note: In this example, we are adding the DeployTool and SARFile projects. You will need to repeat the process for each project listed in Table 12-1 on page 351. 3. Right-click the project folder and select Team -> Commit. 4. Enter a comment, such as First time import of build project, and click OK. WebSphere Studio Application Developer will now add the files to the repository. 5. Repeat this process for each of the projects listed in Table 12-1 on page 351. Chapter 12. Create a store 353 12.4 Required customization of basic store assets The sample store that we have built upon for the ITSO store contains a lot of information that does not apply to our store. This section describes the steps that are necessary in order to customize the basic store information. The information that should always be modified for a store includes: Store directory and identifier Hardcoded references Store address Catalog data Store front-end assets All of the configuration and catalog data for the store, is contained in XML files, which can be found in the Packaging project under the directory SARFiles/WEB-INF/stores/BusinessDirect/data/ToolTech/data. Note: The sample store archives contain the database assets in the following directory format: WEB-INF/stores//data//data In our example, the directory structure includes BusinessDirect for the business model, and ToolTech for the store directory. Internally, the B2BDirect business model default store identifier and directory is ToolTech. The following sections describe how to customize the assets outlined. For additional information, refer to the Store Development Guide, IBM WebSphere Commerce V5.5 product guide. 12.4.1 Store directory and identifier The composite sample stores provided with IBM WebSphere Commerce V5.5, visible in the default store publishing view, have unfortunately been configured by default in a way that the store identifier and store directory parameters are read-only. In previous versions of WebSphere Commerce, the store directory and identifier were user defined at publishing time. We have defined two possible solutions to change the read-only attributes in the SAR file for store directory and identifier: Modify ForeignKeys.dtd store identifier and directory values Modify store-refs.xml to expose publishing parameters 354 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Note: In our example, we did both. In some cases we wanted to default to ITSO, and in other cases we wanted to specify the store directory and identifier at publishing time. Lastly, we did both just to demonstrate how. Modify ForeignKeys.dtd store identifier and directory values To modify the store archive with the desired store identifier and store directory values for your store, do the following: 1. Change to the Resource perspective. 2. Select and expand the Packaging project. 3. Select and expand the SARFile folder. 4. Open the file WEB-INF/stores/BusinessDirect/data/ForeignKeys.dtd. 5. Change the values of the store directory and identifier in ForeignKeys.dtd to suit your store. See Example 12-1 for ITSO store changes. Note: Within WebSphere Studio Application Developer, the default view for DTD files is the Design view. You will need to click the Source tab to see the contents of the ForeignKeys.dtd file. Also, in Example 12-1, we have ordered the locale entities. Example 12-1 ForeignKeys.dtd for the ITSO Store Note: We noticed that the ORGANIZATION_DN and ORGENTITYNAME values have been changed to lowercase as of the WebSphere Commerce V5.5.0.2 Fix Pack. Chapter 12. Create a store 355 Modify store-refs.xml to expose publishing parameters The ForeignKeys.dtd displayed in Example 12-1 on page 355 defines a number of XML entitities that may be used in the XML file that will be mass loaded during the store publishing process. Any of these entities can be exposed to the Parameters page in the store publishing user interface, in either read-only or editable mode, by adding them to the SAR-INF/store-refs.xml file. Example 12-2 displays how to add the store owner organization to the publishing Parameters page. The sample stores expose the store directory and identifier, but do not allow the user to change the store directory and identifier at publish time. If you wish to allow this, edit the file SAR-INF/store-refs.xml in the SARFile project by changing the two occurrences of the string readonly to text. Example 12-2 shows an example of this. Example 12-2 Modify store-refs.xml to expose publishing parameters If the parameters are changed at publishing time, the XML entities will be updated to reflect this. For example, the value entered as the store directory in the store publishing Parameters page will be substituted by the store publishing XML parser for &STORE_DIR; in all of the XML files being mass loaded during the publishing process. 356 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: At the time of writing, a problem with the store publishing component resulted in erroneous renaming of store front files. We found that all files that had the same name as the source store directory would be renamed to the target store directory name. In this case, the result was that the cascading stylesheet file ToolTech.css would be renamed to ITSO.css during the store publish if the target store directory was set to ITSO. To work around this problem, we chose to rename this file to Main.css and update all references to the file. This was simply done using search and replace in all JSP files in the store archive. 12.4.2 Hardcoded references The sample store archives contain many references that have been hard-coded to the internal store model name. For example, the B2BDirect.sar known as ToolTech contains many hardcoded references to ToolTech. There are two types of files that need to be modified, each in a different way: Hardcoded files for mass load files Replace the hardcoded references in these files with &STORE_IDENTIFIER;. This type of file is resolved during mass load. Hardcoded references for runtime files Replace the hardcoded references with the desired store name (hardcoded value). For example, from ToolTech to ITSO. Hardcoded files for mass load files We did a search on the files (grep) and found that B2BDirect.sar (ToolTech) contained hardcoded references to ToolTech. We modified the files listed in Example 12-3 and replaced ToolTech with &STORE_IDENTIFIER;. Note: There are other files that contain ToolTech, but do not need to be changed. For example, ibm-wc-load.xml, unpack.xml and store-data-assets.dtd contain ToolTech. However, ToolTech is the name of a temporary directory that store publish uses to unpack and process files. Example 12-3 Hardcoded references in mass load files with ToolTech WEB-INF\stores\BusinessDirect\data\ToolTech\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\businesspolicy.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\campaign.xml (comment only) WEB-INF\stores\BusinessDirect\data\ToolTech\data\catalog.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\fulfillment.xml Chapter 12. Create a store 357 WEB-INF\stores\BusinessDirect\data\ToolTech\data\offering.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\shipping.xml (comment only) WEB-INF\stores\BusinessDirect\data\ToolTech\data\de_DE\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\de_DE\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\en_US\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\en_US\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\es_ES\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\es_ES\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\fr_FR\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\fr_FR\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\it_IT\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\it_IT\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\ja_JP\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\ja_JP\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\ko_KR\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\ko_KR\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\pt_BR\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\pt_BR\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\zh_CN\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\zh_CN\store.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\zh_TW\accesscontrol.xml WEB-INF\stores\BusinessDirect\data\ToolTech\data\zh_TW\store.xml For example, the action groups for the access control for the ToolTech sample store are all prefixed with the string ToolTech, as can be seen from the short excerpt from the accesscontrol.xml file in Example 12-4. Example 12-4 Example of hard-coded references These references should be changed to refer to an XML entity. In our store archive we changed all occurrences of the string ToolTech to the string &STORE_IDENTIFIER;. The previous excerpt should thus be changed as seen in Example 12-5. Example 12-5 Example of dynamic references to the store identifier 358 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Note: It is not strictly necessary to change the names of the ID resolver internal alias resolution identifiers (strings identified by the preceeding @-sign), but we did so for consistency. Hardcoded references for runtime files Replace the hardcoded references with desired store name (hardcoded value) for the files listed in Example 12-6. For example, replace ToolTech with ITSO. Example 12-6 Hardcoded references in runtime files for ToolTech WEB-INF\xml\tools\stores\ToolTech\devtools\flow\fsf\fsf.xml WEB-INF\xml\tools\stores\ToolTech\devtools\flow\repository\RepositoryInfo.xml WEB-INF\xml\tools\stores\ToolTech\devtools\flow\repository\Site.xml 12.4.3 Store address The address of the store is defined on a per-locale basis in the store.xml files found in WEB-INF/stores/BusinessDirect/data/ToolTech/data/, where is the locale. Example 12-7 shows a modified version of the en_US locale variant of the store address. Note that the business title was changed in the previous section from the default hard-coded value of ToolTech to the dynamic value &STORE_IDENTIFIER;. Example 12-7 Sample en_US/store.xml store address for the en_US locale Chapter 12. Create a store 359 12.4.4 Catalog data The catalog data for the store archive is stored in the files listed in Table 12-8. Example 12-8 Catalog related XML files in the store archivee File Description catalog.xml Catalog master data. /catalog.xml Locale-dependent catalog data for locale . store-catalog.xml Relations between the store and catalog. store-catalog-shipping.xml Definition of shipping costs for products. store-catalog-tax.xml Definition of tax codes for the catalog. offering.xml Prices for products in the catalog. While developing the ITSO store, we constructed two sets of catalog data files: Development ITSO catalog ITSO catalog hierarchy and sample products for development. Note: The ITSO.sar contains product catalog data for US English only. The /catalog.xml for all other languages besides US English have been pruned (contain no data). Pruned ITSO catalog The pruned catalog.xml files are structurally intact, but do not contain any product data. The pruned ITSO catalog.xml file will be used for the purposes of packaging and publishing a store archive without catalog data. Note: Once the ITSO store is deployed in a production environment, only store assets will be published using a store archive. The store catalog will be maintained using the WebSphere Commerce Accelerator and CSV file imports. Long term, the ITSO store will devise an automated method of managing catalog data using the MassLoader and supporting tools. Development ITSO catalog While developing the ITSO store, we wanted to have the proper catalog hierarchy and some sample data available to test with. For this reason, we updated the 360 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide catalog XML files within WebSphere Commerce Studio to contain the categories and products listed in Table 12-2. Table 12-2 Development ITSO catalog with sample products Category Sub category WebSphere Redbook Software DB2 Redbook Software Product Item SKU # IBM WebSphere Application Server V5.0 Systems Management and Configuration: WebSphere Handbook Series, SG24-6195 Hardcopy SG24-6195 SG24-6195-PDF WebSphere Commerce V5.5 Handbook, Customization and Deployment Guide, SG24-6969 Hardcopy SG24-6969 SG24-6969-PDF IBM WebSphere Application Server V5 CD WAS-001-CD Zip WAS-001-ZIP IBM WebSphere Commerce V5.5, Business Edition CD WC-001-CD Zip WC-001-ZIP DB2 UDB/WebSphere Performance Tuning Guide, SG24-6417 Hardcopy SG24-6417 SG24-6417-PDF DB2 UDB Evaluation Guide for Linux and Windows, SG24-6934 Hardcopy SG24-6934 SG24-6934-PDF IBM DB2 UDB V8.1 Enterprise Server Edition CD DB2-001-CD Zip DB2-001-ZIP IBM DB2 Data Miner V8.1 CD DB2DM-001-CD Zip DB2DM-001-ZIP Chapter 12. Create a store 361 Category Sub category Tivoli Redbook Software Product Item SKU # Enterprise Business Portals II with IBM Tivoli Access Manager, SG24-6885 Hardcopy SG24-6885 SG24-6885-PDF Measuring e-business Web Usage, Performance, and Availability, SG24-6931 Hardcopy SG24-6931 SG24-6931-PDF Tivoli Access Manager V4.1 CD TAM-001-CD Zip TAM-001-ZIP CD TWSA-001-CD Zip TWSA-001-ZIP Domino Designer 6: A Developer’s Handbook, SG24-6854 Hardcopy SG24-6854 SG24-6854-PDF Patterns: Custom Designs for Domino & WebSphere Integration, SG24-6903 Hardcopy SG24-6903 SG24-6903-PDF Lotus Domino V6.0 CD DOM-001-CD Zip DOM-001-ZIP CD ST-001-CD Zip ST-001-ZIP Tivoli Web Site Analyzer V4.2 Lotus Redbook Software Lotus Sametime V3.0 The sample ITSO catalog files created for development test purposes can be found in the ITSO provided in ITSO.sar and in the sample code c:\6969code\catdata directory. We modified the following files to include the ITSO catalog categories, products and items listed in Table 12-2 on page 361 for the en_US locale: 362 catalog.xml en_US/catalog.xml /catalog.xml (all other locales pruned - no data) store-catalog.xml store-catalog-shipping.xml offering.xml WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: Since the sample development catalog has only been defined for US English, it is important that all the locale-dependent catalog.xml files for other locales are pruned as described in the next section (see Example 12-10 on page 363). If this is not done, the store publishing will fail. The c:\6969code directory structure matches that of the SAR directory structure for the files listed. Pruned ITSO catalog In 12.4.4, “Catalog data” on page 360, we described two methods of constructing catalog data files. This section describes the method of pruning the catalog files. In this case the pruned catalog.xml files are structurally intact, but do not contain any product data. The pruned ITSO catalog XML files can be used to package and publish a store archive without catalog data. This is useful if your catalog data will be managed in a separate process from deploying your store front assets. For example, you may decide to manage the catalog data in an automated fashion using the MassLoad utility. Since a store must have a master catalog, the catalog.xml file should not be removed from the store archive. Instead the catalog.xml file should be pruned to only contain a catalog skeleton. Example 12-9 shows the data that should be left in the catalog-related XML files. Example 12-9 Sample pruned catalog.xml defining the master catalog Example 12-10 lists a sample pruned locale-specific catalog.xml. This file is used for the language-dependent description for the master catalog. Example 12-10 Sample en_US/catalog.xml Example 12-13 lists the pruned store-catalog-tax.xml. This file contains the tax calculation information. Example 12-13 Sample pruned store-catalog-tax.xml Example 12-14 lists the pruned offering.xml. This file contains the trading position containers available in the store. Example 12-14 Sample pruned offering.xml Assign roles to container buyer organization Example 12-21 on page 377 lists the XML added to the modelorgrole.xml, to assign roles to the new container Buyer Organization. The modelorgrole.xml file can be found in the WEB-INF/stores/BusinessDirect/data/model directory in the store archive, For reference purposes we looked at the storeorgrole.xml for roles assigned to the Buyer A Organization, since our example Buyer Organization requires the same roles listed in Example 12-4 on page 377. 376 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Table 12-4 Role assigned to container buyer organization Role name role_id Buyer Administrator -21 Buyer Approver -22 Buyer (buy-side) -24 Procurement Buyer Administrator -25 Procurement Buyer -26 Example 12-21 ITSO modified modelorgrole.xml (snippet) We would like to highlight a few key points regarding the code snippet in Example 12-22. When a user registers and specifies as its parent organization any descendent of “o=Buyer Organization,o=Root Organization” (meaning any store, since Root is at the top of the tree), assign them the Registered Customer role in the organization that owns the store in which they are registering (effectively granting them access to the store only), as long as that store’s owner is a descendent of “o=Seller Organization,o=Root Organization”. Configure business entity flag For the purposes of contracts, we need to specify that any organization created under the Buyer Organization container is marked as a business entity. This will allow the descendent buyer organizational units to the Buyer Organization to participate in contracts. Example 12-23 lists the code added to the BusinessEntities section in the MemberRegistrationAttributes.xml, which can be found in the xml\member directory in the store archive. Example 12-23 ITSO snippet to BusinessEntities in MemberRegistrationAttributes.xml The business entity flag will be checked for every organization registration. The meaning of Example 12-23 is as follows: whenever an organization is registered as a descendent of “o=Buyer Organization,o=Root Organization”, and to any store under “o=Root Organization” (any store in the system), assign to this organization the BusinessEntity flag. The business entity flag is captured interally as a MemberAttribute in the MBRATTRVAL table. 378 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Note: When a store archive is published containing the XML files we have modified in this section, there are database table entries that are refreshed in cache. If you were to manually load these files, you would need to refresh the registry or restart the WebSphere Commerce instance application server for the changes to take effect. 12.5.4 Business accounts Business accounts can be created by either of the following methods: Create a business account using the WebSphere Commerce Accelerator Create a business account using an XML file included in the store archive In this section, we provide an overview of business accounts and provide a brief explanation of what we did in the store archive for the ITSO store for business accounts. Business account overview Business accounts represent the relationship between a store and the store's customer organizations. Business accounts provide a starting point for managing business relationships. Using business accounts, you can track contracts and orders for customer organizations. In addition, you can configure how buyers from customer organizations shop in a store. A business account contains the following information about a customer organization: The name of the customer organization and a contact person within that organization. The department and name of the account representative from the store assigned to the customer organization. Information about purchase orders a customer organization has with a store. How invoices are delivered to the customer organization. If the customer organization has a credit line. Any display customization information for the business customer. Store pages can be customized for a business account by specifying a piece of HTML code that can be used by a store's JavaServer Pages files. Any general remarks about the business account. Business accounts control customer entitlement by providing the ability to buyers from customer organizations to access a store's master catalog and see standard pricing for products contained in the master catalog. If a customer Chapter 12. Create a store 379 organization is not entitled to purchase products in the store's master catalog at standard prices, they are limited to products and prices covered by contracts the customer organization has with a store. Before creating a business account for a customer organization, the customer organization must already exist in WebSphere Commerce. Also, at least one person associated with the customer organization should be a registered customer, since a contact at the customer organization is required when creating a business account. 12.5.5 Contracts This section provides an overview of contracts and describes the modifications to the contract.xml that we made for the ITSO store. Contracts overview Contracts enable a customer organization to purchase products from a store or a group of stores at a specified price for a specified period of time under specific conditions. WebSphere Commerce provides the ability to define and deploy contracts that have been negotiated. A contract consists of the following elements: Profile The contract profile contains the identifying information for the contract. This information includes a unique name for the contract, a short description, and a time period for which the contract is valid. Participants Contract participants are the organizations that take part in the contract. There is a buyer organization, a seller organization, and contacts at both organizations. Terms and conditions Contract terms and conditions are the rules that cover the actual implementation of the contract. Contract terms and conditions cover such information as product pricing, returns and refunds, payment, shipping, and order approval. Attachments Contract attachments cover any information not covered by the previous elements, such as file attachments, that provide additional information about the contract and any general remarks about the contract. WebSphere Commerce stores Universal Resource Identifiers (URIs) for contract attachments, not the actual attachments. 380 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Reference A contract can refer to another contract to share its terms and conditions. For example, contract A can refer to contract B. Thus, a buyer who is entitled to contract A will be entitled to all the terms and conditions from contract A, as well as to all the terms and conditions in contract B. All contracts are associated with business accounts. Contracts cannot be created for customers you have not created an account for. Different items in a single order may be purchased under different contracts. Buyers can select the contract they shop under at either the start of the shopping flow or when they add an item to their order, depending on the store design. When purchasing items under different contracts, the following rules apply: Contracts for all items in an order must share at least one payment method. If the contract for an item does not share a payment method, the buyer cannot add that item to the order. Only the payment methods shared by all items in an order can be used to pay for the order. All items in an order must come from contracts belonging to the same business account or the store default contract. In IBM WebSphere Commerce V5.5, Business Edition, a contract can be created by either of the following two methods: Create a contract using the WebSphere Commerce Accelerator Contracts created using the Accelerator are always associated with an account. Create contract using XML Creating a new contract using XML allows you to create contracts that are not associated with business accounts. Every store has at least one contract not associated with a business account: the store default contract. To successfully create a contract using XML, you should be familiar with XML and the structure of the DTD or XSD files that defines the structure of contract XML files. Contracts.xml for the ITSO store The business policy related data in the store archive is found in the contract.xml file. This file can be used to load data, such as contracts, and the related terms and conditions at store publishing time. The contract.xml supplied in the ToolTech sample store defines four contracts: Contract 1234, which is the store default contract. Chapter 12. Create a store 381 Contract 2345, belonging to account 1. This contract defines a storewide discount, an order approval limit, a contract purchase minimum and maximum, as well as a number of shipping-related restrictions. Contract 3456, belonging to account 2. This contract defines a discount on two of the product categories and allows the use of the OfflineCard cassette for VISA, Master Card, and American Express. Contract 4567, belonging to account 2. This contract defines a larger discount on two of the categories, and allows the buyer to use two more shipping options than contract 3456. Restriction: IBM WebSphere Commerce V5.5, Professional Edition only supports one contract, the default contract, which defines the terms and conditions for all customers. IBM WebSphere Commerce V5.5, Business Edition supports contracts that are related to specific business accounts. In our working example, we only define the store default contract in the store archive. Contracts for other buyers will be created and loaded subsequently using the WebSphere Commerce Accelerator. The store default contract, as defined in contract.xml for the ITSO store, is shown in Example 12-24. This contract is identical to the ToolTech default contract, with the exception of the name. Example 12-24 Default contract.xml for the ITSO store 382 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Chapter 12. Create a store 383 12.5.6 Taxes, shipping couriers and shipping prices The tax related store archive data can be found in the files tax.xml, taxfulfill.xml and store-catalog-tax.xml. Shipping information is stored in the files shipping.xml, shipfulfill.xml and store-catalog-shipping.xml. Taxes, discounts, and shipping prices are defined in the Calculation Code Framework of WebSphere Commerce, which is complex. Unless you fully understand this framework, we suggest that you leave out tax information (prune XML files of data) from the store archive and configure the tax information manually using the WebSphere Commerce Accelerator. Tip: In WebSphere Commerce V5.4, tax and shipping information was managed from Store Services. In WebSphere Commerce V5.5, this functionality has been moved to the WebSphere Commerce Accelerator. If you choose to include taxes and shipping information in the store archive, refer to Store Development Guide, IBM WebSphere Commerce V5.5 for details about the data model and XML file format. 12.5.7 Payment information The file paymentinfo.xml contains data used by store publish to configure WebSphere Commerce Payments for the store. The file specifies whether the store uses WebSphere Commerce Payments and if so, the detailed configuration of each enabled cassette. Refer to Store Development Guide, IBM WebSphere Commerce V5.5 for information on customizing the paymentinfo.xml file. 12.6 Publish the store archive to the workspace After the customizations in the previous sections have been completed, the store archive is ready to be published to the WebSphere Commerce Studio workspace 384 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide by the development lead who has been preparing this base store archive to the development team as a starting point. Note: In a team development environment, the following preparations should be performed on the Build and SCM node, acting as a master development environment. These preparation are typically performed by the development lead. For details on configuring the Build and SCM node, refer to 11.2, “Build and SCM node implementation” on page 328. 12.6.1 Package the customized store archive Refer to 12.2.3, “Package a store archive (SAR)” on page 348 for details on how to package the store archive with the updated store assets. Note: At this stage you have a customized version of the B2B Direct (ToolTech) store model with the ITSO store front and catalog assets. The store archive is packaged as ITSO.sar. 12.6.2 Publish the customized store archive to runtime After packaging of the customized base store archive, we recommend that you publish the store archive as described in 12.2.4, “Publish the store archive (SAR)” on page 350 on the Development Integration Test node. This step is done to verify that the customized store archive publishes and works properly before publishing to the workspace. If you wish, you can skip this step and directly publish to the workspace. 12.6.3 Verify the customized store archive Verify that the customized store archive is working properly with the changes made on the Development Integration Test node. Refer to 12.2.5, “Verify the store after publish” on page 350 for details. 12.6.4 Publish the store archive to the workspace Now that you have verified that the customized store archive is working properly as your base store for customization, you are ready to publish the store in the WebSphere Commerce Studio environment. 1. We recommend that you back up the workspace and instance database as described in 12.2.1, “Back up workspace and databases” on page 344 and “DB2 backup and restore” on page 988, respectively before proceeding. Chapter 12. Create a store 385 2. Create the .sar directory as follows: \Commerce\instances\\sar For example: c\ibm\wcstudio\Commerce\instances\wc1dev\sar 3. Copy ITSO.sar. For example, in the ITSO team development environment we copied the ITSO.sar from the Development node as follows: From: \Packaging\SARFile\ITSO.sar To: \Commerce\instances\\sar 4. Start the servers for WebSphere Commerce and WebSphere Commerce Payments from within WebSphere Commerce Studio. a. Select Window -> Show View -> Servers. b. Select WebSphereCommercePaymentsServer, and right-click Start. Note: By default, when the WebSphere Commerce Payments instance is created during the WebSphere Commerce Studio installation, the instance does not require a database password (no need for IBMPayServer). c. Select WebSphereCommerceServer, and right-click Start. Note: We started the WebSphereCommerceServer last to ensure the console shows the WebSphere Commerce messages. Atlernatively, you can switch between the console output for the servers within the Debug perspective in WebSphere Studio Application Developer V5.0.1. WebSphere Studio Application Developer V5.1 contains a new feature to switch console output directly in the console view in the J2EE and Server perspectives. 5. Launch the WebSphere Commerce Administration Console: a. Open Microsoft Internet Explorer. 386 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: Do not use the internal browser in WebSphere Studio Application Developer to log on to the WebSphere Commerce administration tools. This will not work, because each tool opens in a new window, which causes problems with the internal WebSphere Studio Application Developer browser. For more information refer to “Configure the default Web browser” on page 1027. b. Enter the following URL in the Address field (on a single line): https://localhost:9443/webapp/wcs/admin/servlet/ToolsLogon? XMLFile=adminconsole.AdminConsoleLogon 6. Click Yes if an Internet Explorer security warning is displayed. 7. Log on using the site administrator ID and password you supplied when installing WebSphere Commerce Studio (for example, wcadmin). 8. Select Site and click OK. 9. Select Store Archives -> Publish. 10.Select the check box next to ITSO.sar and click Next. 11.From the Parameters page, change the values for Store directory and Store identifier to suit your store and click Next. In our example, we accepted the default values of ITSO. 12.From the Summary page, review the parameter values and click Finish. 13.A confirmation window should appear informing you that the store archive was submitted for publishing. Click OK. 14.The Publish Status window will appear. Select the check box in the line for the store archive that was just submitted for publishing and click Details. 15.The Publish Details window will appear. This window will automatically refresh every 20 seconds. The publishing process is finished when the status changes from Publishing to Successful. 12.6.5 Verify customized store in the WebSphere Test Environment At this point, we have published a sample store model with basic customizations. Before proceeding, the store should be tested to check for any obvious errors or omissions. If a new locale has been added, it should be tested if it is possible to change to that locale, it should be tested to see if new taxes or shipping providers work as expected, and so on. Chapter 12. Create a store 387 12.7 Add the store front files to CVS Note: You can skip this section if you do not wish to use source control. In 12.3, “Import store assets into CVS” on page 350 we imported the core projects and added the files that need to be under source control to the CVS repository. At that time the Stores project did not contain the store-specific files that were published in 12.6.4, “Publish the store archive to the workspace” on page 385. To add the store front files to CVS, do the following: 1. Change to the Resource perspective in WebSphere Studio Application Developer. 2. Expand the Stores project and the Web Content folder. 3. Right-click the folder matching the store directory chosen during publish. In our case it is ITSO. 4. Select Team -> Add to Version Control. 5. Right-click the same folder and select Team -> Commit. 6. Enter a comment ,such as First time import of store directory, and click OK. WebSphere Studio Application Developer will now add the files to the repository. 7. Repeat steps 3–6 above for the folder Stores/Web Content/WEB-INF/classes/ITSO. 12.8 Set up additional team development nodes Note: This section can be skipped if you are not using source control. The previous sections have all focused on the work involved in setting up the initial store and development environment. In this section we describe how to set up additional Development nodes. The following steps are assumed to be performed on Development nodes with a pristine installation of WebSphere Commerce Studio. 388 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 12.8.1 Turn off directory pruning The projects that were put under source control contain a number of empty directories. In order to restore these empty directories on the target Development node, we need to turn off a feature of CVS that prevents empty directories from being created when checking out files from the repository. To turn off directory pruning, do the following: 1. Open WebSphere Commerce Studio. 2. Select Window->Preferences. 3. Expand Team and select CVS. 4. Ensure that the check box next to Prune empty directories is not checked. 5. Click OK. Note: The Prune empty directories feature is very useful during the regular development cycle, because CVS actually never deletes a directory from the repository. We recommend that you turn this feature back on once you have started the development cycle and added code to the two extension projects. 12.8.2 Checking out the projects The project that was added to the repository in 12.3, “Import store assets into CVS” on page 350 must be checked out on the developer machines to ensure that all the developers work on the same code base. In WebSphere Commerce Studio, this is done in a similar fashion to the original import: 1. Change to the Resources perspective in WebSphere Studio Application Developer. 2. Right-click the Stores project and select Team->Share Project. 3. The Share Project wizard opens. Enter the CVS connection details as they apply to your environment. Click Finish. 4. The Remote Project Exists window will appear, asking if you wish to synchronize with the existing remote module. Click Yes as seen in Figure 12-6 on page 390. Chapter 12. Create a store 389 Figure 12-6 Warning about existing remote project 5. The Select Tag window will open. Select HEAD and click OK as seen in Figure 12-7. Figure 12-7 Selecting the branch to synchronize with Important: We do not recommend that you check out the files using the Check Out As Project context menu item in the CVS Repository Exploring perspective when customizing WebSphere Commerce. That would replace the existing project with the contents of the projects in the repository instead of synchronizing the files. Synchronize with repository At this point, WebSphere Commerce Studio has made a link between the local Stores project and the remote Stores CVS module, but no files have been synchronized. To synchronize the files, do the following: 1. Right-click the Stores project and select Team->Synchronize with Repository. 2. This will open the Synchronize - Incoming Mode window, if it is not already open, and show the Stores directory structure. If the Synchronize window is 390 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Outgoing mode, then click the Incoming Mode button in the title bar of the window as seen in Figure 12-8. Figure 12-8 Synchronize window in Incoming Mode 3. Right-click the Stores folder in the Synchronize pane and select Override and Update to synchronize all CVS files in the project as seen in Figure 12-9. Figure 12-9 Select Override and Update to get all CVS files synchronized Repeat the above steps for the following projects: – WebSphereCommerceServerExtensionsData – WebSphereCommerceServerExtensionsLogic Chapter 12. Create a store 391 Check out the Packaging project The above steps ensure that the team members are using the source controlled versions of the customized projects in WebSphere Commerce Studio. Since the Packaging project will be needed during the build cycle, this project must also be checked out from CVS: 1. Change to the CVS Repository Exploring perspective in WebSphere Studio Application Developer by selecting Window -> Open Perspective -> CVS Repository Exploring. 2. The repository selected previously should show as a location using the following syntax: ::@:, for example: :pserver:nielsen@bottom440:/repo. 3. Expand the Repository Location. 4. Expand the node HEAD. 5. Right-click Packaging and select Check Out As Project. 12.8.3 Package and publish data-only store archive The previous steps have focused on synchronizing the local store file assets with the developer machines, but the database of the developer machine is still unchanged. To deploy the database assets of the store, we will create a special version of the store archive without any store front assets. The instructions in this section should be repeated during the build cycle whenever the developer has modified database assets for the store: 1. Change to the Resources perspective in WebSphere Studio Application Developer. 2. Expand the SARFile project. 3. Right-click build.xml and select Run Ant. 4. Ensure that the only selected target is build-sar-no-storefront. 5. Ensure that the -DSTOREDIR=ToolTech argument is not specified. 6. Click Finish. 7. A store archive called ITSO.sar is created in the root of the SARFile project (you may have to refresh the project to see the file in WebSphere Studio Application Developer). Copy this file to the directory: \Commerce\instances\\sar. 8. Publish the store archive as described in 12.6.4, “Publish the store archive to the workspace” on page 385. 392 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 13 Chapter 13. Customize a store: Price Watch example This chapter contains the technical design for the Price Watch example along with details on how to implement it. The topics covered in this chapter include the building of custom database tables, custom commands, entity and access beans, data beans, and JavaServer Pages. Also covered are building a custom e-mail message and using the WebSphere Commerce scheduler to run a command that sends e-mails to the user. Detailed steps for using WebSphere Commerce Studio to build the example are given along with many useful hints and tips to help make customizing your store more efficient and simple. Where appropriate, possible decisions that must be made are explained and guidelines are highlighted. The chapter is organized into the following sections: 1. 2. 3. 4. 5. 6. 7. 8. Overview Solution design Price Watch example pre-conditions Configuring the e-mail transport and SMTP server Creating the new database table Creating the new data access beans Creating the new commands Creating the new data bean © Copyright IBM Corp. 2003. All rights reserved. 393 9. Creating the new JavaServer Pages 10.Creating the batch e-mail command 11.Importing the e-mail template 12.Configuring the scheduler to run the batch job 13.1 Overview This chapter describes the procedure for implementing the Price Watch example. This example section is divided into the following tasks: 1. Solution Design. 2. Creating the new database table. 3. Creating the new data access beans for accessing the new database table. This involves creating an Entity bean and an Access bean. 4. Creating the new commands. Both controller commands and task commands will be used. 5. Creating the new Data beans, which will be used to pass results from the commands to the JSPs (Java Server Pages). 6. Creating the new JSPs. These will provide the user interface for the new functionality within your site. 7. Creating the batch e-mail command. This will run on a schedule to check the prices of the products selected by the users and e-mail notifications accordingly. 8. Creating the e-mail template JSP that will form the basis for the e-mail sent to the users. 9. Configuring the e-mail transport for sending outgoing e-mail and configuring a lightweight SMTP server to act as a mail gateway. 10.Configuring the WebSphere Commerce scheduler to run the batch command. 13.2 Solution design This section contains the technical design for the Price Watch example. The design in this document is not complete, but contains enough information to describe the solution for the purposes of this example. It is not intended to be a guide for writing technical design documents. 394 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 13.2.1 Use cases This section contains a summary of the use cases for the Price Watch example. Only the operational (runtime) cases are included. The use cases listed here do not represent the full set of possible use cases, only those that are sufficient to describe the scenario for our example. For example, cases that handle error conditions are not described, because they are not specific to our example. The detailed use cases can be found in 9.2.4, “Use case model” on page 301. UC-PW01 Display Price Watch list UC-PW02 Add items to Price Watch list UC-PW03 Delete item from Price Watch list UC-PW04 Delete all items from Price Watch list UC-PW05 Schedule job checks Price Watch list and e-mail customers 13.2.2 Solution overview The solution consists of the following assets: A database table – XPRICEWATCH An entity bean (and associated access bean) – XPriceWatch Controller commands – PriceWatchListDisplay – ManagePriceWatchList – CheckPriceWatchPrices Task commands – – – – PriceWatchList PriceWatchAdd PriceWatchDelete PriceWatchDeleteAll Data beans – PriceWatchBean – PriceWatchEmailBean JavaServer Pages (JSPs) – PriceWatchList.jsp – PriceWatchEmail.jsp Chapter 13. Customize a store: Price Watch example 395 13.2.3 Solution limitations This section explains the limitations of the technical solution. These limitations were not overlooked; the steps required to correct them were deemed to be out of scope for this book. Where appropriate, suggested solutions to these limitations are given, but not explained in detail. Sites with multiple catalogs are not supported. The price watch prices are assumed to be correct for the user’s current currency. No historical data regarding price watch items is retained, since entries in XPRICEWATCH are deleted when the e-mail is sent to the customer. 13.2.4 Data storage Our design requires a new table for storing price watch data. Each price watch price is associated with the user who created the watch and also the product and contract to which the price watch belongs. This new table is to be called XPRICEWATCH. Tip: It is good practice to begin the names of any new tables that you create with an X. This visually distinguishes your custom tables from the predefined WebSphere Commerce tables. When developing or maintaining code, having this visual indication helps you understand how the business logic has been implemented. An example of this would be if you needed to store more address information for a user than is catered for by default. It would be logical to create a table called XADDRESS to store this extra information. If you decide to extend the existing entity bean (see Chapter 13 in the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5) for ADDRESS to include this new table, it would be clearer that the two tables are related to this naming convention. The XPRICEWATCH database table is defined in Table 13-1. Table 13-1 XPRICEWATCH table 396 Column name Column type Description MEMBERID BIGINT User that the price watch belongs to CATENTRY_ID BIGINT Item to which the price watch belongs CONTRACT_ID BIGINT Contract used to determine item price WATCHPRICE DECIMAL(20,5) Price at which user would purchase item WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: When designing new tables that have foreign key relationships with existing WebSphere Commerce tables, it is important to match the data types correctly. For the sake of continuity, it is still advisable to match the data types to those used in WebSphere Commerce even if the fields have no direct relationship. The primary key consists of the MEMBERID, CATENTRY_ID and CONTRACT_ID columns. All three of these columns are required to uniquely identify an individual watch price, since each user may have multiple entries with possibly more than one being for a single item (if more than one contract is offered). The constraints for this table are described in Table 13-2. Table 13-2 Constraints for XPRICEWATCH Column name Foreign table name Foreign column name Constraint type MEMBERID USERS USERS_ID Cascade CATENTRY_ID CATENTRY CATENTRY_ID Cascade CONTRACT_ID CONTRACT CONTRACT_ID Cascade These constraints ensure that if the user, item, or contract that this price watch belongs to is deleted, the price watch is also removed, since it is no longer valid. 13.2.5 Data access (entity bean) In order to access the XPRICEWATCH table, a CMP (Container Managed Persistence) entity bean is required. It is good practice to give the entity bean the same name as the underlying table, so it will be named XPriceWatch. The entity bean should have the mapping between the CMP fields and the database table columns shown in Table 13-3. Table 13-3 EJB to RDB mapping for entity bean CMP field name CMP field type Database column name Database column type memberId Long MEMBERID BIGINT catEntryId Long CATENTRY_ID BIGINT contractId Long CONTRACT_ID BIGINT watchPrice java.math.BigDecimal WATCHPRICE DECIMAL(20,5) Chapter 13. Customize a store: Price Watch example 397 This mapping is known as an EJB (Enterprise Java Bean) to RDB (Remote DataBase) mapping. Note that in DB2, all price data is stored using the DECIMAL(20,5) type. In order to be able to select particular rows from the table, a number of FinderHelper methods must be created (see 13.6.1, “Create the entity bean” on page 409 for more details). FinderHelpers are required that perform the following: Select a single watch price for a known user, item, and contract. Select all entries for a particular user. This is required for the purposes of displaying the Price Watch list page. Select all entries for all users. This is required for the scheduled command in order for it to process each price watch in turn. 13.2.6 Controller commands This section details the necessary controller commands that are required for implementing the solution. PriceWatchListDisplayCmd This command will be called by the user when the price watch list is to be displayed. The logic in this command corresponds to use case UC-PW01. The following is a summary of the command logic: 1. Use the PriceWatchList task command to retrieve the list for the specified user. 2. Pass the list (stored in a PriceWatchBean object; see 13.2.8, “Passing data to the JSP” on page 400) to the JSP for display. ManagePriceWatchListCmd The logic in this command corresponds to use cases UC-PW02 to UC-PW04. This command will be called by the user in order to perform one of the following actions: Add a new price watch entry to their list (PriceWatchAddTaskCmd) Update a price watch entry in their list (PriceWatchAddTaskCmd) Delete a price watch entry from their list (PriceWatchDeleteTaskCmd) Delete all the price watch entries in their list (PriceWatchDeleteAllTaskCmd) The action taken will depend on the value of the action parameter that is passed to the command when it is executed. Depending on the action to be performed, the appropriate task command will be executed by the controller command. 398 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide These task commands are shown in brackets in the above list. These task commands are detailed in 13.2.7, “Task commands” on page 399. Additionally, the PriceWatchList task command will be called to retrieve the new list before displaying the price watch list JSP, as in the PriceWatchListDisplay command. CheckPriceWatchPricesCmd The logic in this command corresponds to use case UC-PW05. This command will be executed by the scheduler at an interval set by the store administrator. This command should perform the following: 1. Acquire the list of all price watch items from the XPRICEWATCH table using the XPriceWatch bean. 2. For each item in the list: a. Find the price of the item for the given contract. The GetContractUnitPriceCmd task command can be used. This command should be passed the catEntryId and contractId for the price watch item and the item price should be retrieved. b. Find the watch price chosen for the item using the XPriceWatch bean. c. If the item price is less than the price watch price, e-mail the associated user to inform them. The AddressAccessBean can be used to retrieve the user’s name and e-mail address. d. If an e-mail was sent, delete the price watch entry from the table. 3. Exit the command without forwarding to a JSP, since the command is to be run by the scheduler. To send the e-mail, the SendMsgCmd command can be used. For more details on the use of this command, please refer to 13.10, “Creating the batch e-mail command” on page 482. 13.2.7 Task commands This section details the necessary task commands that are required for implementing the solution. PriceWatchListTaskCmd This task command should instantiate the PriceWatchBean data bean and populate it with the price watch items for the currently logged on user, or for the user ID passed to the command. The XPriceWatch bean should be used to retrieve the data from the database. Chapter 13. Customize a store: Price Watch example 399 PriceWatchAddTaskCmd This task command should add a price watch entry to the XPRICEWATCH table or update an entry if one already exists for the given user, item, and contract. The logic should be implemented as follows: 1. Check if an entry already exists in the table. This can be done by using the XPriceWatch bean and catching the FinderException that occurs when no row exists for the given key. 2. If no row exists, create a new row with the given data. 3. If a row exists, update the row using the instance of the access bean returned in step 1. Nothing is returned from this command. PriceWatchDeleteTaskCmd This command should delete a price watch entry from the XPRICEWATCH table. The entry to delete is determined by the user, contract, and item IDs passed to the command. The XPriceWatch bean can be used to first find the entry and then to remove it. PriceWatchDeleteAllTaskCmd This command should use the XPriceWatch bean to delete all entries in the XPRICEWATCH table for a specified user. This must be done by retrieving a collection of the XPriceWatch beans, one for each entry, and then deleting them in turn. 13.2.8 Passing data to the JSP This section will discuss data beans and their various forms. What is a data bean for? A data bean is an object that provides easy access to data from within a JSP. A data bean can be used to: Access data which is generated during the execution of a command Retrieve data from the database (through the use of access beans) It is possible to create a data bean that does both of the above, but it is not good practice to do so. If it seems necessary to combine database access with the storage of results from a command, you may consider using two separate data beans. For further details about data beans, please refer to 13.8, “Creating the new data bean” on page 463. 400 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide The price watch data bean For our solution, we simply require a means of passing the price watch list data from the controller commands to the JSP. A simple data bean is required to achieve this. This data bean will be called PriceWatchBean. The data bean must contain the following data: An ordered list of the catalog entry IDs An ordered list of the contract IDs An ordered list of the watch prices For any given index value, the values in these lists should correspond to the price watch entry for that index. The price watch e-mail data bean To pass the dynamic contents of the price watch customer notification e-mail to the JSP e-mail template, a data bean called PriceWatchEmailBean will be needed. The data bean must contain the following data: The first name of the user to whom the e-mail is being sent The price watch item’s catalog entry ID. This will be used to retrieve details about the item for display in the JSP. The list price of the item. Note that this could be retrieved in the JSP by using a WebSphere Commerce data bean, but the value is already retrieved in the command so it is more efficient to just pass it on to the JSP. The price watch price for the item. 13.2.9 Price watch list page JSP The page layout should consist of the header and sidebar as per the other pages. The main content should consist of: The price watch list table as shown in Table 13-4. The table shown contains sample data and the remove link for each row. Table 13-4 Layout of price watch list table SKU Product Price Watch Price 12345678 Sample Product 599.99 580.00 Remove 87654321 Another Product 450.00 400.00 Remove A Remove All button. This button will link to the ManagePriceWatchList command, passing the cmdAction=deleteall parameter. If no there are no entries in the list, a message stating this would replace the table. Chapter 13. Customize a store: Price Watch example 401 13.2.10 E-mail template JSP The layout of the e-mail will be as shown in Example 13-1. Example 13-1 Layout for the price watch notification e-mail Dear , An item in the ITSO Store has a new price that is below your price watch limit!!! Item: New Price: Your Watch Price: Visit the store now to buy this item!! The PriceWatchEmailBean should be used to retrieve all the required fields from the CheckPriceWatchPrices command. 13.2.11 Access control The command level access control policies for the user-executed commands should be set to allow access to all site users. This includes the PriceWatchListDisplay and ManagePriceWatchList commands. The CheckPriceWatchPrices command does not require an access control policy because it will only be executed by the site administrator (that is, the user assigned to the command in the scheduler). By default, the site administrator has authority to run any command. 13.3 Price Watch example pre-conditions The Price Watch example requires that the following tasks have been completed: 1. WebSphere Commerce Studio has been installed and configured. For details on setting up a team development environment, refer to Chapter 11, “Implement a team development environment” on page 323 for details. The team environment includes WebSphere Commerce Studio. 402 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: You must complete the post-install tasks for messaging found in the Installation Guide, IBM WebSphere Commerce Studio V5.5 product guide. In addition, complete the steps in technote 1114621 every time prior to restarting the WebSphere Commerce server within WebSphere Studio Application Developer. 2. Either the B2BDirect.sar (ToolTech) or the ITSO.sar has been published within the WebSphere Commerce Studio workspace. For details on creating and publishing a store to the WebSphere Commerce Studio workspace, refer to Chapter 12, “Create a store” on page 341. 13.4 Configuring the e-mail transport and SMTP server This section describes how to set up the e-mail transport in WebSphere Commerce. A new message type must be created in the database for our Price Watch example. Also, the Administration Console must be used to configure the transport. This section also describes how to set up a free SMTP server for use with the example. If you already have an SMTP server or do not wish to use the software suggested, please proceed directly to 13.4.2, “Adding the new message type to the database” on page 403. 13.4.1 Setting up the James SMTP server For details on setting up the Java Apache Mail Enterprise Server (also known as Apache James) refer to 21.7.1, “Java Apache Mail Enterprise Server (James) configuration” on page 950. 13.4.2 Adding the new message type to the database To add a new message type for our e-mail message, complete the following steps: 1. Ensure the DB2 Server is started on the development node. 2. Open the DB2 Command Center by selecting Start -> Programs -> IBM DB2 -> Command Line Tools -> Command Center. 3. Click the Interactive tab. Chapter 13. Customize a store: Price Watch example 403 4. Connect to your development database by entering the following in the Interactive window: connect to user using where – is the database name. If you created your database with a different name when you installed WebSphere Commerce Studio, substitute that name here. – is your DB2 user name. – is the password for your DB2 user. Press Ctrl + Enter or click the Execute button on the tool bar. The bottom pane should show a message confirming that the SQL ran successfully. 5. Enter the SQL shown in Example 13-2 in the Interactive window. Example 13-2 SQL to create PriceWatchNotificationEmail message type insert into msgtypes (DESCRIPTION, MSGTDIR, MSGTYPE_ID, NAME, VIEWNAME) values ( 'E-mail message for notification of Price Watch price matches', 1, 800, 'PriceWatchNotificationEmail', 'PriceWatchNotificationEmailView' ) Note: DB2 script for Price Watch example Throughout the Price Watch example, we reference DB2 command and SQL scripts that need to be run. We have included a script called db2_build.sql in the c:\6969code\pricewatch directory. Before starting to make the database changes in this chapter, you may wish to make a backup of your WebSphere Commerce instance database. This will allow you to easily return to the default state if you make a mistake. Refer to “DB2 backup and restore” on page 988 for details on how to do this. The db2_build.sql command can be run now and will execute all DB2 scripts referenced throughout the chapter. db2 connect to user using db2 -tvf db2_build.sql 404 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 6. Press Ctrl + Enter. The bottom pane should show a message confirming that the SQL ran successfully. 13.4.3 Configuring the e-mail transport To configure the e-mail transport, complete the following steps: 1. Switch to the J2EE perspective within WebSphere Commerce Studio. 2. In the Servers view, start the WebSphereCommerceServer server. 3. Open a browser window and start the Administration Console using the following address: https://localhost/webapp/wcs/admin/servlet/ToolsLogon?XMLFile=adminconsole. AdminConsoleLogon 4. Log on to the Administration Console. 5. Select Site and click OK. 6. Select Configuration -> Transports. 7. Click E-Mail in the transports table. 8. In the Host entry in the table, enter the address of the server on which your SMTP server is running. If it is running on the same machine as WebSphere Commerce Application Developer, then use localhost. 9. Click OK. 10.Confirm that the status of e-mail transport is Active. If it is not, complete these steps: a. Check the box next to E-Mail. b. Click Change Status. 13.4.4 Configuring the e-mail message type To configure the e-mail message type, do the following: 1. From the WebSphere Commerce Administration Console, click Configuration -> Message Types. 2. Click New. 3. In the Message Type list, select PriceWatchNotificationEmail. 4. In the Message Severity text boxes, enter 0 in both. 5. Select E-Mail from the Transport list. 6. Select Standard Device Format from the Device Format list. Chapter 13. Customize a store: Price Watch example 405 7. Click Next. The settings on this page will be set at command runtime, so leave all values as the default. 8. Click Finish. 9. Click Logout to exit the Administration Console. 13.5 Creating the new database table It is logical to start the implementation by dealing with the data. Before any beans can be created or any business logic can be implemented in commands, it is necessary to have somewhere to store the data we will be manipulating. Note: If you have already run the db2_build.sql script, continue to 13.6, “Creating the new data access beans” on page 408. In order to create the new table in the database, complete the following steps: 1. Open the DB2 Command Center by clicking Start -> Programs -> IBM DB2 -> Command Line Tools -> Command Center. 2. Click the Interactive tab. 3. Connect to your development database by entering the following in the Interactive window: connect to user using where – is the database name. If you created your database with a different name when you installed WebSphere Studio Application Developer, substitute that name here. – is your DB2 user name. – is the password for your DB2 user. Press Ctrl + Enter or click the Execute button on the tool bar. 406 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 13-1 Connecting to the database in DB2 The bottom pane should show a message confirming that the SQL ran successfully. 4. Create the new table called XPRICEWATCH. Enter the SQL shown in Example 13-3 on page 408 in the Interactive window. Chapter 13. Customize a store: Price Watch example 407 Example 13-3 SQL for creating the XPRICEWATCH table create table XPRICEWATCH ( MEMBERID BIGINT NOT NULL, CATENTRY_ID BIGINT NOT NULL, CONTRACT_ID BIGINT NOT NULL, WATCHPRICE DECIMAL(20,5) NOT NULL, constraint p_memberid primary key (MEMBERID, CATENTRY_ID, CONTRACT_ID), constraint f_memberid foreign key (MEMBERID) references users (users_id) on delete cascade, constraint f_catentry_id foreign key (CATENTRY_ID) references catentry (catentry_id) on delete cascade, constraint f_contract_id foreign key (CONTRACT_ID) references contract (contract_id) on delete cascade ) 5. Press Ctrl + Enter. The bottom pane should show a message confirming that the SQL ran successfully. Tip: Leave your DB2 Command Center window open because you will need it again in the following sections. 13.6 Creating the new data access beans Now that the table has been created, we can create the entity bean and access bean that we will use to access the table from within our commands. The next steps describe how to create the beans in WebSphere Commerce Studio. Note: WebSphere Commerce Studio or WebSphere Studio Application Developer In this book, and in the WebSphere Commerce product documentation, you will see references to WebSphere Commerce Studio and WebSphere Studio Application Developer. WebSphere Commerce Studio is the name of the development environment shipped with WebSphere Commerce. It consists of WebSphere Studio Application Developer and a specific workspace with additional tooling for WebSphere Commerce development. In this book, depending on context, you will see references to both. The entity bean we are about to create will henceforth be known as the XPriceWatch bean. 408 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 13.6.1 Create the entity bean In this section we will create an entity bean for the XPRICEWATCH database table. Create entity bean To create the entity bean, complete the following steps: 1. If you have not already done so, start WebSphere Commerce Studio by clicking Start -> Programs -> IBM WebSphere Commerce Studio -> WebSphere Commerce development environment. 2. Open the J2EE perspective. 3. Within the J2EE Hierarchy, expand EJB Modules. 4. Right-click the WebSphereCommerceServerExtensionsData module and select New -> (Other ->) Enterprise Bean. 5. On the Enterprise Bean Creation Select page, select WebSphereCommerceServerExtensionsData (default) and then click Next. 6. On the Create an Enterprise Bean page, do the following as seen in Figure 13-2 on page 410: a. Select Entity bean with container-managed persistence (CMP) fields. b. In the Bean name text box, enter XPriceWatch Note: The bean name should always be the same as the table name it accesses unless you have good reason to do otherwise. This makes your projects easier to maintain. Note also that the name does not require the word “Bean” on the end as this is added automatically by the wizard. c. In the Default package text box, enter com.ibm.itso.sample.ejb d. Click Next. The Enterprise Bean Details window will now be displayed. We will now add the CMP attributes to the bean. We must create one CMP attribute for each column in the XPRICEWATCH database table. Chapter 13. Customize a store: Price Watch example 409 Figure 13-2 Create an Enterprise Bean: Bean type and name 7. On the Enterprise Bean Details page, click the Add button next to the CMP Attributes box. 8. When the Create CMP Attribute window appears, do the following: a. In the Name text box, enter memberId. b. In the Type text box, enter java.lang.Long. In this case, the Java type Long is equivalent to the DB2 type BIGINT. Important: It is important to map to the correct Java type; otherwise, errors can occur when you use your beans. Also, you must always use the object type and not the primitive (for example, java.lang.Long, not long). This is important because a primitve cannot have a null value. If the database query returns a null value, it cannot be assigned to the CMP variable and will cause an error. c. The MEMBERID field in the database forms part of the primary key for the XPRICEWATCH table. Indicate this by selecting the Key Field check box. You will notice that the last three boxes will be disabled. 410 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 13-3 Create CMP Attribute for MEMBERID field d. Click Apply to add the CMP Attribute as seen in Figure 13-3. The attribute will be added to the bean. The window will clear and remain open so that you can add further attributes. 9. On the Create CMP Attribute page, do the following: a. In the Name text box, enter catEntryId. b. In the Type text box, enter java.lang.Long. c. CATENTRY_ID also forms part of the primary key, so select Key Field. d. Click Apply to add the CMP Attribute. 10.On the Create CMP Attribute page, do the following: a. In the Name text box, enter contractId. b. In the Type text box, enter java.lang.Long. c. CONTRACT_ID also forms part of the primary key, so select Key Field. d. Click Apply to add the CMP Attribute. 11.On the Create CMP Attribute page, do the following: a. In the Name text box, enter watchPrice. b. In the Type text box, enter java.math.BigDecimal. c. Make sure that Key Field is not selected. The last three check boxes should be checked as seen in Figure 13-4 on page 412. Chapter 13. Customize a store: Price Watch example 411 Figure 13-4 Create CMP Attribute for WATCHPRICE field d. Click Apply to add the CMP Attribute. e. Click Close. The window will close and you will be returned to the Enterprise Bean Details window. Note that the three CMP fields you added are displayed as seen in Figure 13-5 on page 413. 412 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 13-5 Enterprise Bean Details 12.On the Enterprise Bean Details window, leave all the other settings as their default values and click Next. 13.We now need to specify the superclass for the bean. Click Browse on the EJB Java Class Details page. 14.In the Select a class using: (any) text box, enter ECEntityBean. All Entity beans must extend this class. You will see in the Matching Types and Qualifier lists the class with the name you have entered. There is only one in the list in this case. In cases where more than one package has a class by the name you entered, you can use this to select the exact class you wish to subclass. 15.Make sure that com.ibm.commerce.base.objects.ECEntityBean is selected and click OK. Chapter 13. Customize a store: Price Watch example 413 16.We now need to specify what interfaces the remote interface should extend. Click Add. Once again, the Type Selection window will open. 17.In the Select a class using: (any) text box, enter Protectable. This interface must be implemented in order for the bean to be protected using Access Control. 18.Make sure that com.ibm.commerce.security.Protectable is selected and click OK. 19.Click Finish to create the bean. You will see that the XPriceWatch bean has now been created in the J2EE Hierarchy (see Figure 13-6). Figure 13-6 The XPriceWatch bean is now visible in the J2EE Hierarchy 414 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Bean configuration Now we need to configure the new bean so that it can be used in WebSphere Commerce Server. To do this, complete the following steps: 1. Double-click the WebSphereCommerceServerExtensionsData project. If it is not visible, open the J2EE Hierarchy and then expand EJB Modules first. The EJB Deployment Descriptor will now open as seen in Figure 13-7. Figure 13-7 EJB Deployment Descriptor 2. Click the Access tab. 3. In the Isolation Level section, click Add as seen in Figure 13-7. The Add Isolation Level window will open. 4. Make sure that Repeatable Read is selected and click Next. 5. Check the XPriceWatch bean from the Beans found list and click Next. 6. Check the XPriceWatch bean to select all of its methods. The XPriceWatch item will expand and all of the methods will turn grey. 7. Click Finish. Chapter 13. Customize a store: Price Watch example 415 Set security identity of the bean Next, we must set the security identity of the bean. This is also done on the Access tab of the Deployment Descriptor as follows: 1. Click Add next to the Security Identity list. 2. Select Use identity of EJB server from the Run as mode group and click Next. 3. Check the XPriceWatch bean in the Beans found list and click Next. 4. Check the XPriceWatch bean to select all of its methods. The XPriceWatch item will expand and all of the methods will turn grey. 5. Click Finish. 6. Make sure that the EJB Deployment Descriptor window is active and then press Ctrl+S to save your work. Remove uneeded methods At this point, we must remove some of the fields and methods that WebSphere Commerce Studio generated when the bean was created. Remember that when we created the bean earlier, we extended the ECEntityBean class. This class already has implementations of these fields and methods that we should not override. To remove these fields and methods from the XPriceWatch bean, complete the following steps: 1. Expand the WebSphereCommerceServerExtensionsData project. If it is not visible, open the J2EE Hierarchy and then expand EJB Modules first. 2. Expand the XPriceWatch bean and then double-click the XPriceWatchBean class to open the editor. You can see where the class resides in the class source editor window in Figure 13-8 on page 417. 416 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 13-8 Open the XPriceWatch bean class for editing 3. In the Outline view (see Figure 13-9 on page 418), select the following four members by clicking the first one and then holding the Ctrl key and clicking the other three: – – – – myEntityCtx getEntityContext() setEntityContext(EntityContext) unsetEntityContext() Right-click one of the selected members and select Delete from the menu. Tip: When dealing with large classes, sometimes it is not easy to locate the methods you require in the Outline view. To make it easier, you can sort the methods by clicking the sort icon in the Outline view title bar. This does not affect the source code. Chapter 13. Customize a store: Price Watch example 417 Figure 13-9 Delete the entity context members from the XPriceWatchBean class 4. Make sure that the XPriceWatchBean.java window is active and then press Ctrl+S to save your work. Create accessors for key fields By default, when an Entity bean is created, accessors (getters and setters) are not created for any CMP fields that were created as key fields. In most cases, this is acceptable, since the value of the key is usually known when a bean is used to access rows in the database. In some circumstances, for example when a bean has multiple finders and the key is not needed for one of them, you may wish to retrieve the key value(s) from the results. To achieve this, we must add a getter method for each element of our key to the bean. To do this, complete the following steps: 1. Expand the WebSphereCommerceServerExtensionsData project. If it is not visible, open the J2EE Hierarchy and then expand EJB Modules first. 2. Expand the XPriceWatch bean and then double-click the XPriceWatchBean class to open the editor. 418 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 3. In the outline view, right-click the memberId field and select Generate Getter and Setter from the menu. The Generate Getter and Setter window will open. Whichever field you right-clicked will have both the getter and setter selected in the Select Methods to Create in Type list. 4. Uncheck the setCatEntryId(Long), setContractId(Long) and setMemberId(Long) methods. 5. Check the getCatEntryId(), getContractId() and getMemberId() methods. The window should appear as in Figure 13-10. Figure 13-10 Settings for generating the getters and setters 6. Click OK. You will see that the code has been generated in the source view. This is shown in Figure 13-11 on page 420. Chapter 13. Customize a store: Price Watch example 419 Figure 13-11 Source code generated by the Generate Getters and Setters wizard Promote new methods to the remote interface Next, we need to promote our new methods to the remote interface so that they will be accessible to us when we use the bean. To do this, complete the following steps: 1. In the outline view, select the getCatEntryId(), getContractId() and getMemberId() methods. 2. Right-click one of the methods and select Enterprise Bean -> Promote to Remote Interface from the menu. You will notice that in the outline view that the two method names now have a small R next to them. This indicates that they have been promoted to the remote interface. 3. Save your work by pressing Ctrl+S. Do not close the XPriceWatchBean.java window, because you will be working on it in the step. 420 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Create a new ejbCreate method When a new row in the database table is to be added using the bean, the ejbCreate method is used. In practice we would of course use the Access bean wrapper rather that the Entity bean itself, but behind the scenes, it is this method that is called. By default, the ejbCreate method that is generated by WebSphere Studio Application Developer only has parameters for the fields that form part of the primary key. This method cannot be used in this case, since the WATCHPRICE column in our table cannot contain null values. When the method is called, the values passed for memberId and catEntry would be used when the bean inserts the row. However, the watchPrice value is not specified and so would be defaulted to null. Because this is not allowed in our table, an error would result. The next step is to create a new ejbCreate method that allows us to specify values for all of the fields in XPRICEWATCH. A corresponding ejbPostCreate method must also be added. To do this, complete the following steps in this order: 1. Make sure that the XPriceWatchBean.java window is selected. 2. Right-click the ejbCreate(Long,Long,Long) method in the Outline view and select Copy from the menu. 3. Right-click again, and select Paste. You will see that you now have two ejbCreate(Long,Long,Long) methods in the Outline view and the source code. 4. Select one of the ejbCreate(Long,Long,Long) methods from the Outline view. It doesn’t matter which one. The source code will jump to this method and the method name will be highlighted in the code. 5. In the source code for the method, add the following parameter to the method: java.math.BigDecimal watchPrice 6. Also, add the following line to set the class variable for watchPrice: this.watchPrice = watchPrice; The method should now look like Example 13-4. Example 13-4 New ejbCreate method for XPriceWatch bean public com.ibm.itso.sample.ejb.XPriceWatchKey ejbCreate( java.lang.Long memberId, java.lang.Long catEntryId, java.lang.Long contractId, java.math.BigDecimal watchPrice) throws javax.ejb.CreateException { Chapter 13. Customize a store: Price Watch example 421 _initLinks(); this.memberId = this.catEntryId this.contractId this.watchPrice return null; memberId; = catEntryId; = contractId; = watchPrice; } 7. Save your work by pressing Ctrl+S. 8. Before the new method will be accessible it must be added to the home interface. In the Outline view, right-click ejbCreate(Long,Long,Long,BigDecimal) and select Enterprise Bean -> Promote to Home Interface. You will notice that an H has appeared next to the method name in the Outline view to denote that the method has been promoted to the home interface. 9. Right-click the ejbPostCreate(Long,Long,Long) method in the Outline view and select Copy from the menu. 10.Right-click again, and select Paste. 11.Select one of the ejbPostCreate(Long,Long,Long) methods from the Outline view. It doesn’t matter which one. 12.In the source code for the method, add the following parameter to the method: java.math.BigDecimal watchPrice The method should now look like Example 13-5. Example 13-5 New ejbPostCreate method for XPriceWatch bean public void ejbPostCreate( java.lang.Long memberId, java.lang.Long catEntryId, java.lang.Long contractId, java.math.BigDecimal watchPrice) throws javax.ejb.CreateException { } 13.Save your work by pressing Ctrl+S. Remove uneeded create methods Now we have an ejbCreate method with the required parameters. Although it would cause no harm to leave it, an additional step will be to remove the ejbCreate(Long,Long,Long) method, because it should not be used for the reasons stated above. It is good practice to not provide methods in classes that will always result in an error. Complete the following steps: 1. Make sure that the XPriceWatchBean.java window is still selected. 422 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 2. In the Outline view, right-click ejbCreate(Long,Long,Long) and select Delete from the menu. Confirm the deletion when prompted. 3. Right-click ejbPostCreate(Long,Long,Long) and select Delete from the menu and confirm the deletion. 4. Save your work by pressing Ctrl+S. 5. Since the ejbCreate(Long,Long,Long) method was promoted to the home interface, we must remove the create method from the XPriceWatchHome class. Double-click the XPriceWatchHome class in the J2EE Hierarchy. The XPriceWatchHome.java source window will open. 6. In the Outline view, right-click create(Long,Long,Long) and select Delete from the menu. Confirm the deletion when prompted. 7. Save your work by pressing Ctrl+S. Create FinderHelper method At this point, we have no method of using our bean to find and return a row in the XPRICEWATCH table. Before we can do that, we need to create a FinderHelper method in the home interface of the bean. FinderHelper methods allow us to specify which of the fields to use as parameters for our database query and how those parameters should be used. The simplest form of a FinderHelper method will accept the key field(s) as a parameter and return an instance of the bean. The returned bean will be populated with the data from the row in the database that corresponds to the key value specified. To add the FinderHelper, complete the following steps: 1. Double-click the WebSphereCommerceServerExtensionsData project. If it is not visible, open the J2EE Hierarchy first. 2. Click the Beans tab. 3. Select the XPriceWatch bean from the Beans list. 4. Scroll down the pane on the right to the WebSphere Extensions section. 5. Next to the Finders list, click Add. The Add Finder Descriptor window will open. 6. Select New. 7. In the Name text box, enter findByMemberIdAndCatEntryIdAndContractId. 8. Click Add next to the Parameters list. a. In the Name text box, enter memberId. b. In the Type text box, enter java.lang.Long. Chapter 13. Customize a store: Price Watch example 423 c. Click OK. 9. To add the second key field, click Add next to the Parameters list. a. In the Name text box, enter catEntryId. b. In the Type text box, enter java.lang.Long. c. Click OK. 10.To add the third key field, click Add next to the Parameters list. a. In the Name text box, enter contractId. b. In the Type text box, enter java.lang.Long. c. Click OK. 11.From the Return Type list, select com.ibm.itso.sample.ejb.XPriceWatch and click Next. 12.From the Finder type list, select WhereClauseFinderDescriptor. 13.In the Finder statement text box, enter: T1.MEMBERID =? AND T1.CATENTRY_ID =? AND T1.CONTRACT_ID =? The Finder statement is used when the source code for the bean is generated. It forms the WHERE clause of the SQL statement used to populate the bean when the FinderHelper method is called. T1 refers to the XPRICEWATCH table in this case. The question marks are replaced at runtime with the values of the parameters passed to the FinderHelper method. This is done in the order that the parameters appear in the method definition. It is therefore important to make sure that the column names in the Finder statement are in the same order as the parameters in the FinderHelper method (findByMemberIdAndCatEntryIdAndContractId defined above). 14.Click Finish. 15.Save your work by pressing Ctrl+S. Create methods for access control You will remember earlier that in order for our bean to support access control, we had to make it implement the Protectable interface. There are two more steps to perform before access control will work properly: 1. Double-click the XPriceWatchBean class to open the source code. 2. At the bottom of the class, before the final closing brace, add the code in Example 13-6 on page 425. 424 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Example 13-6 New getOwner method for the XPriceWatch bean public java.lang.Long getOwner() throws java.lang.Exception { return getMemberId(); } 3. Under the method you just created, add the code in Example 13-7. Example 13-7 New fulfills method for the XPriceWatch bean public boolean fulfills(Long member, String relationship) throws java.lang.Exception { if (relationship.equalsIgnoreCase("creator")) { return member.equals(getMemberId()); } return false; } 4. Save your work by pressing Ctrl+S. 13.6.2 Create the EJB/RDB mapping for the entity bean Now we have completed Entity bean. The next step is to map our bean to the XPRICEWATCH table in the database. This is achieved by creating an EJB to RDB (Remote DataBase) mapping. There are three methods for doing this: Bottom Up: This method will create a new Entity bean and EJB/RDB map from an existing database table. Top Down: This method generates a database schema and EJB/RDB map from an existing bean. Meet In The Middle: This method generates an EJB/RDB map from an existing database table and an existing Entity bean. Since we have already created our table and bean, we need to use Meet-in-the-middle mapping. Create EJB to remote database mapping (RDB) To map the bean to the table, complete the following steps: 1. In the J2EE Hierarchy, right-click WebSphereCommerceServerExtensionsData and select Generate -> EJB to RDB mapping from the menu. 2. On the Create new EJB/RDB mapping window, select Meet In The Middle and then click Next. Chapter 13. Customize a store: Price Watch example 425 3. On the Database Connection window, do the following: a. In the Connection name text box, enter WebSphereCommerceServerExtensionsData. b. In the Database text box, enter , where is your database name. c. In the User ID text box, enter your DB2 user name. d. In the Password text box, enter your DB2 password. e. From the Database vendor type list, select DB2 Universal Database V8.1. f. Leave the JDBC Driver field as IBM DB2 APP DRIVER. g. Click Next. There will be a short delay while the table names are loaded. Once this complete the list of available database tables will be displayed. 4. Check the .XPRICEWATCH table and click Next. 5. Select Match By Name and Type and click Finish. The Mapping editor will now open. 6. The correct mappings between the fields should already be in place. Expand the XPriceWatch bean in the Overview pane. You should see that field names in the Enterprise Beans column should match up with the column names in the Tables column (see Figure 13-12 on page 427). This can also be seen from the list of mappings in the Outline view. Tip: If the mappings are incorrect, perform the following steps: In the Outline view, right-click the incorrect mappings and select Remove Mapping from the menu. Repeat for each incorrect mapping. In the Enterprise Beans pane (the top pane in the Map.mapxmi window), drag each unmapped field on to the corresponding field in the Tables pane as shown in Figure 13-13 on page 427. 7. Save your work by pressing Ctrl+S. 426 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 13-12 EJB/RDB Mapping for XPriceWatch Figure 13-13 Drag and drop fields to create EJB/RDB mappings Chapter 13. Customize a store: Price Watch example 427 Change schema name The next step is to change the schema name so that our new bean will be portable to other databases. To make this modification, complete the following steps: 1. In the J2EE perspective, switch to the J2EE Hierarchy view. 2. Expand Databases, then expand WebSphereCommerceServerExtensionsData. 3. Right-click the (which is the DB2 user name at the time the instance database was created) and select Rename from the menu. 4. Enter NULLID as the new schema name. We now have a completed Entity bean for our XPRICEWATCH table. 13.6.3 Create an access bean for the entity bean Now we must create a new access bean for our entity bean. The purpose of an Access bean is to provide a simple interface to our entity bean. The access bean exposes only the methods of the entity bean that belong to the remote interface, that is, the methods that we need to use to create new database rows and manipulate existing rows. To use WebSphere Studio Application Developer to generate the access bean from the existing XPriceWatch entity bean, complete the following steps: 1. In the J2EE Hierarchy, right-click WebSphereCommerceServerExtensionsData under EJB Modules and select New -> Access Bean from the menu. 2. On the Add an Access Bean window, select Copy Helper and click Next. 3. From the Enterprise Beans list, check XPriceWatch and click Next. 4. From the Constructor method drop-down list, select findByPrimaryKey(com.ibm.itso.sample.ejb.XPriceWatchKey). The method selected here determines which FinderHelper method is invoked when the refreshCopyHelper() method is called after lazy initialization of the Access bean. Additionally, this determines which setters will be provided for initialization purposes. Selecting the findByPrimaryKey() Helper will mean that setters will be provided for each field in the key. For example, in this case, the following initialization setters will be provided: – setInitKey_memberId(Long) – setInitKey_catEntryId(Long) – setInitKey_contractId(Long) 428 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 5. Select all attributes in the Attribute Helpers list (by default, all are selected). 6. Click Finish. 7. Save your work by pressing Ctrl+S. 13.6.4 Generate the deploy code and test the bean The next step is to generate the deploy code for our bean. The code generation tool automatically creates implementation classes for the home and remote interface objects. The JDBC persister and finder classes for CMP beans are also generated. For more details about what is generated, refer to the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide. Generate deploy code To generate the deploy code, complete the following steps: 1. In the J2EE Hierarchy, expand WebSphereCommerceServerExtensionsData. 2. Right-click XPriceWatch and select Generate Deploy Code from the menu. Testing the bean Now everything is complete and we are ready to test the new bean. Enable Universal Test Client If you have already enabled the Universal Test Client on your server, skip the following four steps: 1. Open the Servers perspective by selecting Window -> Open Perspective -> Other -> Server and click OK. 2. Double-click the WebSphereCommerceServer server in the Server Configuration pane, and select the Configuration tab. 3. Check Enable Universal Test Client. 4. Save your changes by pressing Ctrl+S and close the view. 5. Start or restart the WebSphereCommerceServer server. Chapter 13. Customize a store: Price Watch example 429 Test the create method of the bean Since the XPRICEWATCH table is empty, the first test we should perform is to use the bean to add a new row. The following steps show how to test the create method of the bean: 1. In the J2EE Hierarchy, right-click WebSphereCommerceServerExtensionsData and select Run on Server from the menu. The Universal Test Client will appear as shown in Figure 13-14. Figure 13-14 The Universal Test Client 2. Click the JNDI Explorer icon. The JNDI Explorer allows you to find the names of the beans that run in the EJB container on the server. 3. In the JNDI Explorer, find the XPriceWatchHome interface by expanding cell -> nodes -> localhost -> servers -> server1 -> ejb -> com -> ibm -> itso -> sample -> ejb. 4. Click the XPriceWatchHome interface. A new view will open with References and Parameters panes. 430 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 5. In the References pane, select EJB References -> XPriceWatch -> XPriceWatchHome. 6. Click XPriceWatch create(Long,Long,Long,BigDecimal). The Parameters view has now changed to allow you to enter the parameters for the method call. Note that the parameter names are not shown, only their types. The parameters in the table are shown in the order that they appear in the method source. In this case the order is memberId, catEntryId, contractId and watchPrice. 7. In the Parameters view, do the following: a. In the first row, enter -1000 in the Value column. This is the Member ID for the default administrator user. b. In the second row, enter 10001 in the Value column. This is the CATENTRY_ID for one of the products in our catalog. c. In the third row, enter 10003 in the Value column. This is the CONTRACT_ID for one of the contracts. d. In the last row, enter 50.00 in the Value column. This is the price at which we wish to purchase the product. Click Invoke. The results section of the view will display that an XPriceWatch object has been created, as shown in Figure 13-15 on page 432. Note: You can verify that the row was created in the XPRICEWATCH table by executing the following in a DB2 Command Center window: select * from XPRICEWATCH Chapter 13. Customize a store: Price Watch example 431 Figure 13-15 Result of invoking the create method on the XPriceWatch bean Test the FinderHelper method Now we have a row in the XPRICEWATCH table, we can test our FinderHelper method to retrieve the row. To do this, complete the following steps. 1. In the References pane, click the XPriceWatch findByMemberIdAndCatEntryIdAndContractId method. The parameters pane will change to allow you to enter the parameters for the method. 2. In the Parameters pane, do the following: a. Enter -1000 in the first parameter value. b. Enter 10001 as the second parameter value. c. Enter 10003 as the third parameter value. d. Click Invoke. The Results section will show that a new instance of XPriceWatch has been returned. 3. Click Work with Object to add the new bean instance to the EJB References list. In the References pane you will see the new bean instance (XPriceWatch). 432 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 4. Click the new instance of the bean called XPriceWatch (com.ibm.itso.sample.ejb) in the References pane. The list will expand to show the available methods for the XPriceWatch bean. 5. Select the BigDecimal getWatchPrice() method. 6. Because this is a getter method, there are no parameters required, so just click Invoke. The result (50.00000) is shown in the Results section as shown in Figure 13-16. Figure 13-16 Testing a bean getter method in the Universal Test Client Test updating a value using the new bean instance We can now test that we can update a value in the XPRICEWATCH table. We have already found the row that we want to update in the previous step. To change the WATCHPRICE field to a new value, complete the following steps: 1. Select the setWatchPrice(BigDecimal) method from the References pane. 2. In the Parameters pane, enter the new value of 40.00 next to the BigDecimal field. 3. Click Invoke. You will see a message “The method completed successfully” in the Results section. Once again, you can check that the value has been changed in the database using the DB2 Command Center. Chapter 13. Customize a store: Price Watch example 433 Tip: If you try to use the FinderHelper on the home interface again, a message will be displayed saying that the XPriceWatch object is already in use. Before using the home interface again, you must remove the XPriceWatch bean instance you have already created. To do this, click the (Remove EJB entity bean from tree) icon next to the XPriceWatch item in the References pane. 13.6.5 Update the bean with new FinderHelpers The requirement to display a list of all products and prices for a particular user means that we will need a way to retrieve all the rows from the XPRICEWATCH table for a particular MEMBERID. In order to achieve this, we will need to add a new FinderHelper to the XPriceWatch bean, as described in 13.2, “Solution design” on page 394. Add FinderHelper for finding by memberId To add the new FinderHelper, complete the following steps: 1. Double-click the WebSphereCommerceServerExtensionsData project. If it is not visible, open the J2EE Hierarchy first. 2. Click the Beans tab. 3. Select the XPriceWatch bean from the Beans list. 4. Scroll down the pane on the right to the WebSphere Extensions section. 5. Next to the Finders list, click Add. The Add Finder Descriptor window will open. 6. Select New. 7. In the Name text box, enter findByMemberId. 8. Click Add next to the Parameters list. 9. In the Name text box, enter memberId. 10.In the Type text box, enter java.lang.Long. 11.Click OK. 12.From the Return Type list, select java.util.Collection. Note that there could be more than one row returned from the underlying query and hence we need a return type that can hold multiple instances of our bean. 434 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Tip: Unlike when developing for previous versions of WebSphere Commerce, the recommended return type for multiple rowset Finders is now java.util.Collection, not java.util.Enumeration. Using a Collection has advantages over using Enumerations, not least of which is the ability to obtain the size of a Collection without iterating through all the elements. Also, an object Array or an Iterator can be produced from the Collection. 13.Click Next. 14.From the Finder type list, select WhereClauseFinderDescriptor. 15.In the Finder statement text box, enter T1.MEMBERID =? 16.Click Finish. 17.Save your work by pressing Ctrl+S. Add FinderHelper for returning all rows In the business logic for the scheduled command to check the prices and send e-mails to customers, we will need to check every row in the XPRICEWATCH table. In order to do this, we need to add one more finder. This time, there is no where clause because we want to retrieve every row. As such, we do not want to use a WhereClauseFinderDescriptor. In this case, we can use an EjbqlFinderDescriptor and a sample finder available in WebSphere Studio Application Developer. To add the finder, complete the following steps: 1. Select the XPriceWatch bean from the Beans list. 2. Scroll down the pane on the right to the WebSphere Extensions section. 3. Next to the Finders list, click Add. The Add Finder Descriptor window will open. 4. Select New. 5. In the Name text box, enter findAll. 6. From the Return Type list, select java.util.Collection. 7. Click Next. 8. From the Finder type list, select EjbqlFinderDescriptor. 9. From the Select a sample finder list, select Find All Query. The Finder statement text box will automatically be filled with the following: select object(o) from XPriceWatchBean o 10.Click Finish. 11.Save your work by pressing Ctrl+S. Chapter 13. Customize a store: Price Watch example 435 Regenerate the access bean Now that we have added the new finders, we must regenerate the access bean to reflect the new structure. To do this, complete the following steps: 1. If you have closed the EJB Deployment Descriptor, double-click the WebSphereCommerceServerExtensionsData project to re-open it. 2. Click the Beans tab. 3. Select the XPriceWatch bean from the Beans list. 4. Scroll down the pane on the right to the Access Beans section. 5. Select the XPriceWatchAccessBean. 6. Click the Remove button next to the Access bean list. 7. Save your work by pressing Ctrl+S. 8. In the J2EE Hierarchy, right-click WebSphereCommerceServerExtensionsData and select New -> Access Bean from the menu. The Add an Access Bean window will open. 9. Select Copy Helper and click Next. 10.From the Enterprise Beans list, check XPriceWatch and click Next. 11.From the Constructor method drop-down list, select findByPrimaryKey(com.ibm.itso.sample.ejb.XPriceWatchKey). 12.Check all attributes in the Attribute Helpers list. 13.Click Finish. 14.Save your work by pressing Ctrl+S. Regenerate the deploy code for the bean The next step is to regenerate the deploy code for our bean. To generate the deploy code, complete the following steps: 1. In the J2EE Hierarchy, expand WebSphereCommerceServerExtensionsData. 2. Right-click XPriceWatch and select Generate Deploy Code from the menu. Test the new FinderHelper methods Now everything is complete, and we are ready to test the new bean by doing the following: 1. Start or restart the WebSphereCommerceServer server. 436 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Important: You must restart your WebSphereCommerceServer; otherwise, the new bean will not be available. 2. In the J2EE Hierarchy, right-click WebSphereCommerceServerExtensionsData and select Run on Server from the menu. The Universal Test Client will appear as shown in Figure 13-14 on page 430. 3. Click the JNDI Explorer icon. The JNDI Explorer allows you to find the names of the beans that run in the EJB container on the server. 4. In the JNDI Explorer, find the XPriceWatchHome interface by expanding cell -> nodes -> localhost -> servers -> server1 -> ejb -> com -> ibm -> itso -> sample -> ejb. 5. Expand XPriceWatch bean under EJB References and click the XPriceWatchHome interface. 6. In the References pane, click the XPriceWatch findByMemberId method. The parameters pane will change to allow you to enter the parameter for the method. 7. In the Parameters pane, enter -1000 as the parameter value. 8. Click Invoke. The Results section will show that a new java.util.Collection instance has been returned. 9. Click Work with Contained Objects. The XPriceWatch object from within the collection will be added to the References list. If more than one row is returned, an instance for each row is added. Note: If you select Work with Object, the Collection object itself is added to the References list under the Object References heading. This may be useful if you want to invoke the size() method on the Collection to see how many rows were returned before using the Work with Contained Objects option. 10.Repeat the above steps to test the findAll method. You can invoke the methods of the XPriceWatch object to obtain the results of the query in the same manner as in the previous example. Chapter 13. Customize a store: Price Watch example 437 13.7 Creating the new commands In the previous section, we created an entity bean and an access bean in order to store and manipulate our data in the database. Now we can begin to implement the business logic that uses that data. This section demonstrates the process of creating custom commands and describes how to implement the commands for the Price Watch example. When creating a custom command, it is typical to perform the following tasks: 1. Create an interface for the command. 2. Create an implementation class for the command. 3. Register the new command in the command registry. 4. Create access control policies for the command. 5. Modify server and application configuration information so the command can be run in the WebSphere Commerce application. 13.7.1 Create the command interface This section shows how to create the interface for the command. Complete the following steps: 1. Open the Java perspective by clicking the Open a Perspective button and selecting (Other) -> Java. 2. Expand WebSphereCommerceServerExtensionsLogic. 3. Right-click src and select New -> Package. 4. Enter com.ibm.itso.sample.commands in the Name field and click Finish. 5. Right-click the package you just created and select New -> Interface. The Java Interface window will open. 6. In the Name text box, enter ManagePriceWatchListCmd. Note: We recommend that the WebSphere Commerce command interface names should end with Cmd. 7. Next to the Extended interfaces list, click Add. The Extended Interfaces Selection window will open. 8. In the Choose interfaces text box, enter ControllerCommand. All command interfaces in WebSphere Commerce must be descendents of the com.ibm.commerce.command.ControllerCommand interface. That is, 438 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide they must either directly extend the ControllerCommand interface or extend another command’s interface. 9. Click OK. 10.Click Finish. A new file called ManagePriceWatchListCmd.java will be created and selected in the Package Explorer pane. A new editor will open and will contain the code shown in Example 13-8 (or similar). Example 13-8 ManagePriceWatchList interface package com.ibm.itso.sample.commands; import com.ibm.commerce.command.ControllerCommand; /** * @author Insley * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public interface ManagePriceWatchListCmd extends ControllerCommand { } 11.Next, we need to add a static final String to the interface that specifies the name of the default implementation class for our command. Add the following line to the interface: static final String defaultCommandClassName = "com.ibm.itso.sample.commands.ManagePriceWatchListCmdImpl"; WebSphere Commerce will look for this String in order to determine the implementation class for the command. However, if there is an entry in the CMDREG table for this command interface, the implementation class specified in the database will override the default specified in the interface. 12.Save your work by pressing Ctrl+S. 13.7.2 Create the command implementation class The next step is to create the implementation class for our command. Remember that the class name should be that which you specified in the defaultCommandClassName String in the interface. Chapter 13. Customize a store: Price Watch example 439 Create command class To create the command class, complete the following steps: 1. Right-click com.ibm.itso.sample.commands in the Package Explorer and select New -> Class. The Java Class window will open. 2. In the Name text box, enter ManagePriceWatchListCmdImpl. Note that all WebSphere Commerce command implementation class names should end with CmdImpl. 3. Next to the Superclass text box, click Browse. The Superclass Selection window will open. 4. In the Choose a type text box, enter ControllerCommandImpl. All command classes in WebSphere Commerce must be descendents of the com.ibm.commerce.command.ControllerCommandImpl class. 5. Click OK. 6. Click the Add button next to the Interfaces list. The Implemented Interface Selection window will open. 7. In the Choose interfaces text box, enter ManagePriceWatchListCmd. 8. Select Constructors from superclass. 9. Click OK. Before continuing, make sure that the remaining options are left as default. These options are shown in Figure 13-17 on page 441. 440 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Figure 13-17 Adding the implementation class for the ManagePriceWatchList command 10.Click Finish. A new file called ManagePriceWatchListCmdImpl.java will be created and selected in the Package Explorer pane. The source editor will open. Add business logic to command class Complete the following steps to add the command code to the class: 1. Add the import statements to the class as shown in Example 13-9 on page 442. Tip: To avoid having to manually enter the code in the remainder of this chapter, you may wish to open the source files provided in the sample and cut and paste the relevant sections as shown. Chapter 13. Customize a store: Price Watch example 441 Example 13-9 Import statements for ManagePriceWatchListCmdImpl import java.io.*; import java.math.BigDecimal; import import import import import import import import import com.ibm.commerce.ras.*; com.ibm.commerce.server.*; com.ibm.commerce.command.*; com.ibm.commerce.exception.*; com.ibm.commerce.datatype.*; com.ibm.commerce.user.objects.*; com.ibm.commerce.accesscontrol.AccessVector; com.ibm.itso.sample.databeans.PriceWatchBean; com.ibm.itso.sample.ejb.XPriceWatchAccessBean; When you enter this code into WebSphere Studio Application Developer, you will notice that some of the lines have errors. This is not a problem because they will be fixed as you add the remaining code in the chapter. 2. Add the class variables to the source code as shown in Example 13-10. Note how there is a variable for each of the parameters that will be passed to the command when it is called. Tip: It is good practice to create a private final String called CLASS_NAME in every class you create. This variable will be useful in trace statements or exception handling. Additionally, your methods should contain a private final String called METHOD_NAME. An example of when this is useful is when you need to throw an ECApplicationException or an ECSystemException. The exception, as seen in Example 13-11 on page 444, can be reused without alteration as long as the variables are available. Example 13-10 Class variables for ManagePriceWatchListCmdImpl private final String CLASS_NAME = "ManagePriceWatchListCmdImpl"; private AccessVector resources = null; /** * valid values for action are: * - add * - delete * - deleteall * * Note that using 'add' will update an existing entry if one is found. */ private String action = null; private Long memberId = null; 442 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide private Long catEntryId = null; private Long contractId = null; private BigDecimal watchPrice = null; 3. Add setter methods for the following five variables: – – – – – action memberId catEntryId contractId watchPrice a. Select the five variables in the Outline view. b. Right-click one of the variables and select Generate Getter and Setter from the menu. c. Select only the setter methods for the five variables and click OK. Five setter methods will be generated in the source. 4. Add the validateParameters method, as shown in Example 13-11 on page 444, to the class after the constructor method. The purpose of this method is to retrieve the parameters for the command from the request properties object. This method is responsible for determining whether parameters are required or optional. Required parameters should be retrieved inside a try-catch block that catches the ParameterNotFoundException. This exception is thrown if a named parameter does not exist in the request object when a typed getter is used to try and retrieve it. Hence, the single parameter getters (for example, reqProp.getLong("catEntryId")) should be used in this block. If the exception is caught, an ECApplicationException should be thrown, which will halt the execution of the command and an appropriate error page will be returned to the user. Optional parameters should be retrieved outside the try-catch block. The two parameter getters should be used. The first parameter specifies the name of the parameter to be retrieved and the second parameter specifies the default value to use should the parameter not be passed. You can see in Example 13-11 on page 444 that the memberId parameter is optional. If it is not passed, the current userId is retrieved from the command context and used instead. You may use null as the default value if your business logic then uses the presence of a null value to determine that the optional parameter was not specified. Chapter 13. Customize a store: Price Watch example 443 Example 13-11 validateParameters() method for ManagePriceWatchListCmdImpl public void validateParameters() throws ECException { final String METHOD_NAME = "validateParameters"; if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.entry("WC_COMMAND", CLASS_NAME, METHOD_NAME); } TypedProperty reqProp = getRequestProperties(); // check parameters exist and set class variables try { setAction(reqProp.getString("cmdAction")); if (action.equals("add")) { setCatEntryId(reqProp.getLong("catEntryId")); setContractId(reqProp.getLong("contractId")); setWatchPrice(reqProp.getBigDecimal("watchPrice")); } else if (action.equals("delete")) { setCatEntryId(reqProp.getLong("catEntryId")); setContractId(reqProp.getLong("contractId")); } } catch (ParameterNotFoundException e) { throw new ECApplicationException(ECMessage._ERR_CMD_MISSING_PARAM, CLASS_NAME, METHOD_NAME, ECMessageHelper.generateMsgParms(e.getParamName())); } // memberId is optional. If not passed, use the ID of the currently // logged on user. setMemberId(reqProp.getLong("memberId", getCommandContext().getUserId())); if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.exit("WC_COMMAND", CLASS_NAME, METHOD_NAME); } } Note that the example above uses additional logic to determine which parameters should be retrieved depending on the value of the action parameter. 5. Add the performExecute() method to the class: a. Add the code to the class as shown in Example 13-12 on page 445. 444 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Example 13-12 performExecute() method for ManagePriceWatchListCmdImpl /** * The business logic for this controller command. */ public void performExecute() throws ECException { final String METHOD_NAME = "performExecute"; if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.entry("WC_COMMAND", CLASS_NAME, METHOD_NAME); } /// perform server side parameter checking super.performExecute(); TypedProperty rspProp = new TypedProperty(); /// Set the view name so the JSP can be called rspProp.put(ECConstants.EC_VIEWTASKNAME, "PriceWatchList"); setResponseProperties(rspProp); if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.exit("WC_COMMAND", CLASS_NAME, METHOD_NAME); } } This forms the skeleton of the performExecute() method. This code can be used as a basis for every performExecute() method you write for your commands. However, the METHOD_NAME variable and the view task name will need to be changed for other commands. Entry and exit trace lines are included. Tip: It is good coding practice to include entry and exit trace statements in every method you write in your commands. This will help with debugging later on should it be required. If you use the isTracing() method to determine whether or not to call the trace methods, there is no significant overhead in including this code when the trace components are turned off in a production environment. To ensure that the validateParameters() method is called, the super.performExecute() method is invoked. A new TypedProperty object called rspProp is created to hold the response properties for the command. Objects added to the response properties will be available for use in the JSP. Chapter 13. Customize a store: Price Watch example 445 The following line sets the view command name that will be called in order to call the JSP that we wish to display: rspProp.put(ECConstants.EC_VIEWTASKNAME, "PriceWatchList"); For an explanation of the different ways you can call JSPs, refer to the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide. Finally, the setResponseProperties(rspProp) method is called. This method is implemented in the command’s superclass. b. Remember that the command is designed to perform three functions that allow the user to manage their price watch list. These three functions are implemented in three task commands: • • • PriceWatchAddTaskCmd PriceWatchDeleteTaskCmd PriceWatchDeleteAllTaskCmd The action that the command should take will be passed to the command and stored in the action variable. The code in Example 13-13 consists of an if-else if structure that tests the value of action. Depending on its value, one of the three task commands is called. Insert the code in Example 13-13 into the performExecute() method just below the TypedProperty rspProp object is instantiated. Example 13-13 Work section of performExecute() for ManagePriceWatchListCmdImpl if (action.equals("add")) { PriceWatchAddTaskCmd pwaCmd = null; pwaCmd = (PriceWatchAddTaskCmd) CommandFactory.createCommand( "com.ibm.itso.sample.commands.PriceWatchAddTaskCmd", getStoreId()); pwaCmd.setCommandContext(getCommandContext()); pwaCmd.setMemberId(memberId); pwaCmd.setCatEntryId(catEntryId); pwaCmd.setContractId(contractId); pwaCmd.setWatchPrice(watchPrice); pwaCmd.validateParameters(); pwaCmd.execute(); } else if (action.equals("delete")) { PriceWatchDeleteTaskCmd pwdCmd = null; pwdCmd = (PriceWatchDeleteTaskCmd) CommandFactory.createCommand( "com.ibm.itso.sample.commands.PriceWatchDeleteTaskCmd", getStoreId()); pwdCmd.setCommandContext(getCommandContext()); 446 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide pwdCmd.setMemberId(memberId); pwdCmd.setCatEntryId(catEntryId); pwdCmd.setContractId(contractId); pwdCmd.validateParameters(); pwdCmd.execute(); } else if (action.equals("deleteall")) { PriceWatchDeleteAllTaskCmd pwdCmd = null; pwdCmd = (PriceWatchDeleteAllTaskCmd) CommandFactory.createCommand( "com.ibm.itso.sample.commands.PriceWatchDeleteAllTaskCmd", getStoreId()); pwdCmd.setCommandContext(getCommandContext()); pwdCmd.setMemberId(memberId); pwdCmd.validateParameters(); pwdCmd.execute(); } As you can see from the code above, the procedure for calling a task command is as follows: i. Instantiate a variable with the type of the interface of the task command. ii. Call the CommandFactory.createCommand() method with the name of the command interface, including the package name and the store ID. Cast the returned object to the command interface type and assign it to the variable created in the first step. iii. Set the command context of the task command to be the current command context for the controller command. iv. Initialize any task command variables that are required. v. Call validateParameters() on the task command to perform any parameter checking. vi. Call the execute() method on the task command. Important: You should not call the performExecute() method yourself. When execute() is called, a number of important operations are performed before the performExecute() method is invoked. This includes exception handling (non-WebSphere Commerce exceptions are wrapped in an ECSystemException) and performance monitoring tasks. Chapter 13. Customize a store: Price Watch example 447 vii. Retrieve any results from the task command using the getter methods. An example of this can be seen in Example 13-14 when the PriceWatchBean is retrieved. c. Finally, the list of price watch items must be retrieved from the database. You will see in 13.8.3, “Creating the price watch data bean” on page 467 that a data bean is used for storing the list. The PriceWatchListTaskCmd task command is used to retrieve the data from the database and to build the PriceWatchBean object that we will use in the JSP. Add the code in Example 13-14 to the performExecute() method below the if-else block you just added. Example 13-14 Retrieving the price watch list using PriceWatchListTaskCmd // Use PriceWatchListTaskCmd to get the data bean for the price watch // table display. PriceWatchBean pwBean = null; PriceWatchListTaskCmd pwlCmd = null; pwlCmd = (PriceWatchListTaskCmd) CommandFactory.createCommand( "com.ibm.itso.sample.commands.PriceWatchListTaskCmd", getStoreId()); pwlCmd.setCommandContext(getCommandContext()); pwlCmd.setMemberId(memberId); pwlCmd.validateParameters(); pwlCmd.execute(); pwBean = pwlCmd.getPriceWatchBean(); // Put the populated data bean on the response rspProp.put("pwBean", pwBean); The last line of the code above puts the data bean into the response properties object. 6. Save your work by pressing Ctrl+S. 7. Rebuild the project by right-clicking WebSphereCommerceServerExtensionsLogic and selecting Build Project. Whenever you change or add code and you are happy that the code is in a state you are ready to test, you must rebuild the project that the code belongs to. Doing this will compile the Java source and create the class files. Only at this stage will you see compile errors in your code, should there be any. For example, uncaught exceptions will be flagged in the code source view. Any 448 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide errors will be highlighted with a white cross in a red circle in the package explorer and in the code source. Warning: Do not enable the option to automatically rebuild your projects when you make changes in the WebSphere Studio Application Developer preferences. If you enable this option, there will be a significant delay (>10 minutes) every time you save your work while the projects rebuild. WebSphere Studio Application Developer recompiles every class in the workspace on every save when this option is enabled, not just the classes that have changed. 13.7.3 Add the task commands to the workspace In this section we need to create the four task commands used by the controller commands: PriceWatchList PriceWatchAdd PriceWatchDelete PriceWatchDeleteAll 13.7.4 Register the new command in the command registry Before the new command can be used, it must be registered in the command registry. This is done by adding a new entry in the URLREG database table. In the DB2 Command Center or a DB2 Command prompt, ensure you are connected to your development database and then execute the SQL shown in Example 13-15. Example 13-15 SQL for registering the ManagePriceWatchList command insert into URLREG (URL,STOREENT_ID,INTERFACENAME,HTTPS,DESCRIPTION,AUTHENTICATED) values ( 'ManagePriceWatchList', 10001, 'com.ibm.itso.sample.commands.ManagePriceWatchListCmd', 0, null, null ) Make sure you use the correct store ID in the SQL. Note that you should specify the interface name of the command, not the implementation class name. Chapter 13. Customize a store: Price Watch example 449 13.7.5 Create the PriceWatchListDisplayCmd command In this section, we will create the PriceWatchListDisplayCmd command. This command will be called when the user selects price watch from the menu bar. Create the command interface This section shows how to create the interface for the command. Complete the following steps: 1. Open the Java perspective by clicking the Open a Perspective button and selecting (Other) -> Java. 2. Expand WebSphereCommerceServerExtensionsLogic -> src -> com.ibm.itso.sample.commands. 3. Right-click com.ibm.itso.sample.commands and select New -> Interface. The Java Interface window will open. 4. In the Name text box, enter PriceWatchListDisplayCmd. 5. Next to the Extended interfaces list, click Add. The Extended Interfaces Selection window will open. 6. In the Choose interfaces text box, enter ControllerCommand. 7. Click OK. 8. Click Finish. A new file called PriceWatchListDisplayCmd.java will be created and selected in the Package Explorer pane. 9. Add the static final String to the interface as shown in Example 13-16. Example 13-16 PriceWatchList Display interface package com.ibm.itso.sample.commands; import com.ibm.commerce.command.ControllerCommand; /** * @author Insley */ public interface PriceWatchListDisplayCmd extends ControllerCommand { static final String defaultCommandClassName = "com.ibm.itso.sample.commands.PriceWatchListDisplayCmdImpl"; } 10.Save your work by pressing Ctrl+S. 450 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Create the implementation class The next step is to create the implementation class for our command. Remember that the class name should be that which you specified in the defaultCommandClassName String in the interface. To create this class, complete the following steps: 1. Right-click com.ibm.itso.sample.commands in the Package Explorer and select New -> Class. The Java Class window will open. 2. In the Name text box, enter PriceWatchListDisplayCmdImpl. 3. Next to the Superclass text box, click Browse. The Superclass Selection window will open. 4. In the Choose a type text box, enter ControllerCommandImpl. 5. Click OK. 6. Click the Add button next to the Interfaces list. The Implemented Interface Selection window will open. 7. In the Choose interfaces text box, enter PriceWatchListDisplayCmd. 8. Check Constructors from superclass. Before continuing, make sure that the remaining options are left as the default. These options are shown in Figure 13-17 on page 441. 9. Click Finish. A new file called PriceWatchListDisplayCmdImpl.java will be created and selected in the Package Explorer pane. The source editor will open. Add code to class Complete the following steps to add the command code to the class: 1. Add the import statements to the class as shown in Example 13-17. Example 13-17 Import statements for PriceWatchListDisplayCmdImpl import import import import import import import import import import java.io.*; java.math.BigDecimal; com.ibm.commerce.ras.*; com.ibm.commerce.server.*; com.ibm.commerce.command.*; com.ibm.commerce.exception.*; com.ibm.commerce.datatype.*; com.ibm.commerce.user.objects.*; com.ibm.commerce.accesscontrol.AccessVector; com.ibm.itso.sample.databeans.PriceWatchBean; Chapter 13. Customize a store: Price Watch example 451 2. Add the class variables to the source code as shown in Example 13-18. Note how there is a variable for each of the parameters that will be passed to the command when it is called. Example 13-18 Class variables for PriceWatchListDisplayCmdImpl private final String CLASS_NAME = "PriceWatchListDisplayCmdImpl"; private Long memberId = null; 3. Add a setter method for the memberId variable: a. Right-click the memberId variable in the Outline view and select Generate Getter and Setter from the menu. b. Select only the setter method for the memberId variable and click OK. The new setter method will be generated in the source. 4. Add the validateParameters method as shown in Example 13-19 to the class. Example 13-19 validateParameters() method for PriceWatchListDisplayCmdImpl public void validateParameters() throws ECException { final String METHOD_NAME = "validateParameters"; if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.entry("WC_COMMAND", CLASS_NAME, METHOD_NAME); } TypedProperty reqProp = getRequestProperties(); // memberId is optional. If not passed, use the ID of the currently // logged on user. setMemberId(reqProp.getLong("memberId",getCommandContext().getUserId())); if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.exit("WC_COMMAND", CLASS_NAME, METHOD_NAME); } } Note that if memberId is not passed in as a parameter to this command, the user ID from the command context is used. That is, the ID for the currently logged in user is assumed. 5. Add the performExecute() method to the class as shown in Example 13-20 on page 453. 452 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide Example 13-20 performExecute() method for PriceWatchListDisplayCmdImpl /** * The business logic for this controller command. */ public void performExecute() throws ECException { final String METHOD_NAME = "performExecute"; if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.entry("WC_COMMAND", CLASS_NAME, METHOD_NAME); } PriceWatchBean pwBean = null; /// perform server side parameter checking super.performExecute(); TypedProperty rspProp = new TypedProperty(); // Use PriceWatchListTaskCmd to get the data bean for the price watch // table display. PriceWatchListTaskCmd pwlCmd = null; pwlCmd = (PriceWatchListTaskCmd) CommandFactory.createCommand( "com.ibm.itso.sample.commands.PriceWatchListTaskCmd", getStoreId()); pwlCmd.setCommandContext(getCommandContext()); pwlCmd.setMemberId(memberId); pwlCmd.validateParameters(); pwlCmd.execute(); pwBean = pwlCmd.getPriceWatchBean(); // Put the populated data bean on the response rspProp.put("pwBean", pwBean); /// see how controller command call a JSP rspProp.put(ECConstants.EC_VIEWTASKNAME, "PriceWatchList"); setResponseProperties(rspProp); if (WASTrace.isTracing("WC_COMMAND")) { WASTrace.exit("WC_COMMAND", CLASS_NAME, METHOD_NAME); } } Chapter 13. Customize a store: Price Watch example 453 In this method, an instance of the PriceWatchBean is created to hold the list of price watch items to be displayed to the user. The PriceWatchList task command is used to populate the bean before it is passed into the response object. 6. Save your work by pressing Ctrl+S. 7. Rebuild the project by right-clicking WebSphereCommerceServerExtensionsLogic and selecting Build Project. Register the command in the command registry Before the new command can be used, it must be registered in the command registry. As before, add a new entry in the URLREG database table. In the DB2 Command Center or a DB2 Command prompt, ensure you are connected to your development database and then execute the SQL shown in Example 13-21. Example 13-21 SQL for registering the PriceWatchListDisplay command insert into URLREG (URL,STOREENT_ID,INTERFACENAME,HTTPS,DESCRIPTION,AUTHENTICATED) values ( 'PriceWatchListDisplay', 10001, 'com.ibm.itso.sample.commands.PriceWatchListDisplayCmd', 0, null, null ) Make sure you use the correct store ID in the SQL. 13.7.6 Create the task commands In this section, we will create the following task commands: PriceWatchList PriceWatchAdd PriceWatchDelete PriceWatchDeleteAll In order to show how to create a task command, we will show how to build the PriceWatchList task command in this section. To create the remaining task commands, you would follow a similar procedure. For the purposes of our 454 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide example, we will import the remaining three task commands into the workspace from the price watch sample code. Create the PriceWatchList task command In this section, we show how to create the task command classes and explain the code in some detail. Create the task command interface This section shows how to create the interface for the task command. Complete the following steps: 1. Open the Java perspective by clicking the Open a Perspective button and selecting (Other) -> Java. 2. Expand WebSphereCommerceServerExtensionsLogic -> src -> com.ibm.itso.sample.commands. 3. Right-click com.ibm.itso.sample.commands and select New -> Interface. The Java Interface window will open. 4. In the Name text box, enter PriceWatchListTaskCmd. 5. Next to the Extended interfaces list, click Add. The Extended Interfaces Selection window will open. 6. In the Choose interfaces text box, enter TaskCommand and click OK. 7. Click Finish. A new file called PriceWatchListTaskCmd.java will be created and selected in the Package Explorer pane. Add code to the interface To add the required code to the interface, complete the following steps: 1. Add the imports to the interface as shown in Example 13-22. 2. Add the static final String to the interface as shown in Example 13-22. Example 13-22 PriceWatchListTaskCmd interface package com.ibm.itso.sample.commands; import com.ibm.commerce.command.TaskCommand; import com.ibm.commerce.datatype.*; import com.ibm.itso.sample.databeans.PriceWatchBean; /** * @author Steve Insley */ public interface PriceWatchListTaskCmd extends TaskCommand { Chapter 13. Customize a store: Price Watch example 455 static final String defaultCommandClassName= "com.ibm.itso.sample.commands.PriceWatchListTaskCmdImpl"; } 3. Add the abstract class variable definitions to the interface, as shown in Example 13-23, on the line before the defaultCommandClassName variable. Example 13-23 Abstract class variable definitions for the interface public void setMemberId(Long newMemberId); public int getNoOfWatches(); public PriceWatchBean getPriceWatchBean(); 4. Save your work by pressing Ctrl+S. Create the implementation class The next step is to create the implementation class for the task command. Remember that the class name should be that which you specified in the defaultCommandClassName String in the interface. To create this class, complete the following steps: 1. Right-click com.ibm.itso.sample.commands in the Package Explorer and select New -> Class. The Java Class window will open. 2. In the Name text box, enter PriceWatchListTaskCmdImpl. 3. Next to the Superclass text box, click Browse. The Superclass Selection window will open. 4. In the Choose a type text box, enter TaskCommandImpl and click OK. 5. Click the Add button next to the Interfaces list. The Implemented Interface Selection window will open. 6. In the Choose interfaces text box, enter PriceWatchListTaskCmd, select the interface from the list, and click OK. 7. Check Constructors from superclass. 8. Uncheck Inherited abstract methods. In this case we do not want to automatically generate the methods as defined in the interface, because they would not be generated as we require. We will manually add the getters and setters for the variables in a later step. 456 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 9. Click Finish. A new file called PriceWatchListTaskCmdImpl.java will be created and selected in the Package Explorer pane. The source editor will open. Add code to class Complete the following steps to add the command code to the class: 1. Add the import statements to the class as shown in Example 13-24. Example 13-24 Import statements for PriceWatchListTaskCmdImpl import import import import java.math.BigDecimal; java.rmi.Naming; java.rmi.RemoteException; java.util.*; import javax.ejb.CreateException; import javax.ejb.FinderException; import javax.naming.NamingException; import import import import import import com.ibm.commerce.catalog.objects.CatalogEntryDescriptionAccessBean; com.ibm.commerce.command.TaskCommandImpl; com.ibm.commerce.exception.*; com.ibm.commerce.ras.*; com.ibm.commerce.rules.util.NoOpOutputStream; com.ibm.itso.sample.ejb.XPriceWatchAccessBean; import com.ibm.itso.sample.databeans.PriceWatchBean; 2. Add the class variables to the source code as shown in Example 13-25. Note how there is a variable for each of the parameters that will be passed to the command when it is called. Example 13-25 Class variables for PriceWatchListTaskCmdImpl private final String CLASS_NAME = "PriceWatchListTaskCmdImpl"; private Long memberId = null; private PriceWatchBean pwDataBean = new PriceWatchBean(); private int noOfWatches = 0; 3. Add a setter method for the memberId variable: a. Right-click the memberId variable in the Outline view and select Generate Getter and Setter from the menu. b. Select only the setter method for the memberId variable and click OK. The new setter method will be generated in the source. Chapter 13. Customize a store: Price Watch example 457 4. Add the getter methods to the end of the class as shown in Example 13-26. Example 13-26 Getter methods for noOfWatches and pwDataBean public int getNoOfWatches() { return noOfWatches; } public PriceWatchBean getPriceWatchBean() { return pwDataBean; } 5. Add the validateParameters method as shown in Example 13-27 to the class. Example 13-27 validateParameters() method for PriceWatchListTaskCmdImpl public void validateParameters() throws ECException { final String METHOD_NAME = "validateParameters"; if ( memberId == null ) { throw new ECApplicationException(ECMessage._ERR_CMD_MISSING_PARAM, CLASS_NAME, METHOD_NAME, "The memberId must be set."); } } The validateParameters() method in a task command varies from how you would implement it in a controller command. We are not retrieving the parameters from the request object in this case. The parameters must be set by the calling command before the task command is executed. As a result, the logic to validate the parameters is slightly different. You will see that we simply test the value of the memberId parameter and if it is null, we throw an ECApplicationException. We do this because the memberId is a required parameter. At this point, you could perform further validation on your parameters, such as range checking or illegal character checking. 6. Add the performExecute() method to the class as shown in Example 13-28. Example 13-28 performExecute() method for PriceWatchListTaskCmdImpl public void performExecute() throws ECException { final String METHOD_NAME = "performExecute"; Vector cCatEntryIds = new Vector(); Vector cContractIds = new Vector(); Vector cWatchPrices = new Vector(); 458 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide super.performExecute(); try { Collection pwaBeans = new XPriceWatchAccessBean().findByMemberId(memberId); noOfWatches = pwaBeans.size(); if (!pwaBeans.isEmpty()) { Iterator beans = pwaBeans.iterator(); while ( beans.hasNext() ) { XPriceWatchAccessBean pwaBean = (XPriceWatchAccessBean) beans.next(); pwaBean.refreshCopyHelper(); cCatEntryIds.add(pwaBean.getCatEntryId()); cContractIds.add(pwaBean.getContractId()); cWatchPrices.add(pwaBean.getWatchPrice()); } pwDataBean.setCatEntryIds((Long[]) cCatEntryIds.toArray(new Long[0])); pwDataBean.setContractIds((Long[]) cContractIds.toArray(new Long[0])); pwDataBean.setWatchPrices((BigDecimal[]) cWatchPrices.toArray(new BigDecimal[0])); } } catch (CreateException e) { throw new ECSystemException(ECMessage._ERR_CREATE_EXCEPTION, CLASS_NAME, METHOD_NAME, e.getMessage()); } catch (javax.naming.NamingException e) { throw new ECSystemException(ECMessage._ERR_NAMING_EXCEPTION, CLASS_NAME, METHOD_NAME, e.getMessage()); } catch (java.rmi.RemoteException e) { throw new ECSystemException(ECMessage._ERR_REMOTE_EXCEPTION, CLASS_NAME, METHOD_NAME, e.getMessage()); } catch (FinderException e) { throw new ECSystemException(ECMessage._ERR_FINDER_EXCEPTION, CLASS_NAME, METHOD_NAME, e.getMessage()); } } In this method the XPriceWatchAccesBean is used to retrieve all of the price watch items for the given member ID. These are returned by the findByMemberId() method as a Collection. Chapter 13. Customize a store: Price Watch example 459 Each XPriceWatchAccessBean is retrieved from the Collection object in turn and the price, contract ID, and watch price are obtained and stored in vectors. When alll the rows have been retrieved, the vectors are converted to arrays and added to the instance of the data bean. This will in turn be used in the JSP when displaying the price watch list. 7. Save your work by pressing Ctrl+S. 8. Rebuild the project by right-clicking WebSphereCommerceServerExtensionsLogic and selecting Build Project. The PriceWatchList task command is now complete. If you were to create the remaining task commands yourself, you would follow a process similar to that which you have just completed. Import the remaining task commands to the workspace In this section, we will import the remaining three task commands to the workspace: 1. From the Java perspective, expand WebSphereCommerceServerExtenstionsLogic -> src -> com.ibm.itso.sample.commands. 2. Right-click com.ibm.itso.sample.commands and select Import. 3. Select File system and click Next. 4. Click Browse and navigate to the sample code directory, for example: c:\6969code\pricewatch\code\WebSphereCommerceServerExtensionsLogic\ src\com\ibm\itso\sample\commands. 5. Click OK. 6. Check the following files: – – – – – – PriceWatchAddTaskCmd.java PriceWatchAddTaskCmdImpl.java PriceWatchDeleteTaskCmd.java PriceWatchDeleteTaskCmdImpl.java PriceWatchDeleteAllTaskCmd.java PriceWatchDeleteAllTaskCmdImpl.java 7. Click Finish. 8. Rebuild the project by right-clicking WebSphereCommerceServerExtensionsLogic and selecting Build Project. 460 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 13.7.7 Create access control policies for the commands This section explains how to create an access control policy XML document and load the policy using the acpload tool. In order to allow customers to execute the price watch commands, we must create and load an access control policy file. The PriceWatchListDisplay and ManagePriceWatchList commands are to be run by the users of the store and so need to be included. The CheckPriceWatchPrices command is intended to be run only by the scheduler, which in turn uses the site administrator user ID, and so does not require an access control policy. The steps in this section are for loading the policies in the WebSphere Studio Application Developer environment. For details on loading access control policies, refer to the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide. Creating an access control policy XML file To create the file, complete the following steps: 1. Open an Explorer window and navigate to tC:\WebSphere\CommerceStudio55\Commerce\xml\policies\xml, where C:\WebSphere\CommerceStudio55 is your WebSphere Studio Application Developer installation directory. 2. Create a new text file called PriceWatchACPolicy.xml. 3. Add the XML as shown in Example 13-29 to the file. Example 13-29 PriceWatchACPolicy.xml Chapter 13. Customize a store: Price Watch example 461 This file defines one action, Execute, that a user can perform on the commands. Two resource categories are defined that associate the commands’ interfaces with the action. Finally, the resources are bound to the AllSiteUserCmdResourceGroup group in order to specify that all users can execute these commands. 4. Save and close the file. Load the access control policy file with acpload The next step is to load the policy file using the acpload command-line tool. To do this, complete the following steps: 1. Click Start -> Run. 2. Enter Cmd and click OK. A command line window will open. 3. Enter the command as shown below: acpload PriceWatchACPolicy.xml Where: – is the name of your development database – is your DB2 administrator user – is the DB2 password If the command runs correctly, you will see the following output: Running XMLTransform... Running Id Resolver... Running MassLoader... For these changes to take effect, you must restart the WebSphereCommerceServer server. 462 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 13.7.8 Enable component tracing in development environment To test that the trace code is working correctly, the component tracing in WebSphere Commerce Studio Application Developer must be enabled. Refer to the Appendix of the Programming Guide and Tutorials, IBM WebSphere Commerce V5.5 product guide for details of how to do this. For the example in this book, you must enable the com.ibm.websphere.commerce.WC_COMMAND component. For a full list of tracing components that you may wish to enable, refer to the Administration Guide, IBM WebSphere Commerce V5.5 product guide. The output from the trace statements in the command code is written to the activity.log file in \\.metadata\.plugins\com.ibm.etools.server.co re\tmp0\logs. This file is a binary file and should be read using the Activity Log tool. The output is also written to a plain text file called trace.log. This file is in the \\.metadata\.plugins\com.ibm.etools.server.co re\tmp0\logs\server1 directory. 13.8 Creating the new data bean The next step is to create a data bean to hold the information that we want to display in our JSP. This section explains the various ways in which you can implement data beans, and then shows our example implementation in detail. A data bean is simply a class that stores data. A data bean should use private class-wide variables for the data storage and public accessors (getters) in order to make the data externally available. The simplest form of data bean contains no business logic at all. 13.8.1 Data bean types Before deciding on how best to implement a data bean, it is important to consider the scenario in which it will be used. The following is a list of possible scenarios in which a data bean could be employed: To make data from a Controller command available to a JSP To make data from the database available to a JSP To make data from a Controller command and the database available to a JSP Chapter 13. Customize a store: Price Watch example 463 The first two scenarios are the most common. While it is certainly possible to implement a bean for the third scenario, you may wish to consider the alternative, which is to create two beans instead of one in order to separate the two different functions that the bean would provide. It will become clear from the following explanations as to why this is preferable. A data bean to hold data from a command This is the simplest form of a data bean. While it is possible to simply add results as name-value pairs to the response properties within the command, it is good programming practice to use a data bean. This allows for logical grouping of results and the structure can be more easily reused if necessary. It also simplifies the retrieval of parameters. When using the TypedProperty.getParameter() method, the returned value must be cast to the correct type before it can be used. This is avoided when using data beans, because each getter method returns the value in the correct type. The bean class must have the following properties: Private variables to hold the data Public accessors (getters and setters) to allow external access to the data Implement the com.ibm.commerce.beans.DataBean interface The com.ibm.commerce.beans.DataBean interface extends from java.io.Serializable. This allows the bean and the data contained within it to be cached along with the JSP if desired. To use the bean, an instance of the bean class should be created in the Controller command. The results from the business logic in the command that are required for display in the JSP should be stored in the data bean using the setter methods of the bean. In the controller command, a TypedProperty object is used to store name-value pairs that are to be added to the response properties. To make the data available to the JSP, the bean instance should be added to this object. This object in turn is passed to the setResponseProperties() method in the performExecute() method of the command. In the JSP, the bean can be retrieved as follows: Values can then be retrieved from the bean using the getter methods. For example: String someVal = beanVar.getSomeValue(); 464 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide or: Vector someVector = beanVar.getSomeVector(); The values can also be written directly to the JSP output if the data type returned implements the toString() method. For example: would write the contents of the variable returned by getSomeValue() to the JSP. A data bean to retrieve data from the database This type of data bean is designed to be self populating. The values available for display in the JSP are retrieved within the data bean and do not need to be calculated or retrieved in a Controller command. The bean class should have the following properties: Private variables to hold the data. Public accessors (getters) to allow external access to the data. Public accessors (setters) for setting initialization variables. Implement the com.ibm.commerce.beans.SmartDataBean interface. Implement the populate() method. Optionally, the class can extend another class that provides the data access, such as an Access bean. The data bean must implement the populate() method. When the data bean is activated using the DataBeanManager in the JSP, the command context and request properties are passed to the bean and the populate() method is called. When creating the bean, the populate() method should be implemented. You should add code to this method that populates the data bean. This can be done by instantiating and using access beans or session beans or by whatever method is appropriate. If it is known that all the required data can be retrieved using an existing access bean, the data bean can extend the access bean class, giving access to its methods. In this case, before activating the data bean in the JSP, the setInitKey_xxx() methods of the bean (inherited method from the access bean) should be called with the initialization values. The populate() method should call the refreshCopyHelper() method and handle all the necessary exceptions. The data from the bean can be accessed in the JSP using the getter methods provided by the parent access bean class, or the developer can implement getters in the bean class to provide access to the data if necessary. Chapter 13. Customize a store: Price Watch example 465 Note: It is good coding practice to implement smart data beans that extend access bean classes rather than using access beans directly in the JSP code. Using access beans in the JSP code does not fit with the programming model for WebSphere Commerce and there are issues surrounding access control when this is done. In order to retrieve the required data from the database, sometimes an initialization value is required (this could be multiple values). For example, the ItemDataBean bean that is provided with WebSphere Commerce needs to know the item ID for the item you wish to retrieve the data for. In this case, the bean provides a setter method called setItemId(), which you should invoke with the item ID before activating the bean. When the bean is activated, the code in the populate() method of the bean uses the itemId value as the key when retrieving the data from the database. An example of how you instantiate a bean that needs initializing is shown in Example 13-30. Example 13-30 Code for instantiating a smart data bean requiring initialization parameters Sometimes, the data bean will not need any initialization values. For example, the bean may retrieve data from a database table for which the key is known and is constant. In some cases, the initialization data may be retrievable from the request properties, which is already available to the bean. For example, the only data required may be the user ID of the currently logged-on user, which is always available. An example of how you instantiate a bean that does not need initializing is shown in Example 13-31. Example 13-31 Code for instantiating a smart data bean not requiring initialization SomeSmartDataBean sdBean = new SomeSmartDataBean(); com.ibm.commerce.beans.DataBeanManager.activate(sdBean, request); 13.8.2 Further considerations When the use of data beans is necessary, it is important to consider which type of data bean is appropriate. It is generally better practice to retrieve all the necessary data for the display in the controller command. Should errors occur during the database access, it is easier to handle the errors in the command than 466 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide at JSP code runtime. If an error occurs at the end of a large JSP, some display HTML may have been flushed from the buffer and the user’s browser will have a partial response. At this point it is too late to redirect to an error page and very strange results can occur. If the error is trapped at command runtime, the user can be redirected to an appropriate error page. This being the case, most data beans will be data beans that hold data from a command. The data bean will be instantiated in the command and passed to the JSP. There are some cases where this is not appropriate, for example, when there are items of data in the database that are to be displayed on every page on the site. It is not practical to implement the code to retrieve this data in every controller command and pass on the populated bean. In cases such as this, it is logical to use a smart data bean. The bean can be instantiated in each JSP in order to retrieve the data for display. Important: When using self-populating smart data beans in your JSPs, be very careful to avoid situations where runtime errors may occur, because the user may experience strange and unpredictable output as a result. To give an example of using smart data beans, let’s assume that in our Price Watch example we want to display the user’s current price watches in a box on every page. A data bean that extends the XPriceWatchAccessBean, retrieves the current user ID from the request properties, and populates itself would be appropriate. 13.8.3 Creating the price watch data bean First, we need to create a new package for the data bean. It is good practice to keep data beans in a separate package from the commands and EJBs, etc. Create package for data beans Complete the following steps to create the package: 1. Switch to the Java perspective. 2. In the Package Hierarchy, expand WebSphereCommerceServerExtensionsLogic. 3. Right-click src and select New -> Package from the menu. 4. In the Name text box, enter com.ibm.itso.sample.databeans. 5. Click Finish. Chapter 13. Customize a store: Price Watch example 467 Create the data bean Now we can create the data bean as follows: 1. Right-click the com.ibm.itso.sample.databeans package and select New -> Class from the menu. 2. In the Name text box, enter PriceWatchBean. 3. Clear the contents of the Superclass text box. 4. Next to the Interfaces list, click Add. 5. In the Choose interfaces text box, enter DataBean. Select the DataBean interface in the Matching types list that is a member of the com.ibm.commerce.beans package and click OK. 6. Check Constructors from superclass and Inherited abstract methods. 7. Click Finish. The PriceWatchBean class will be created and the source editor for the class will open. Add code to the data bean Complete the bean by completing the following steps: 1. Add the following to the class source: import java.math.BigDecimal; 2. Add the class variables shown in Example 13-32 to the class. Insert the code above the constructor. Example 13-32 Class-wide variables for the PriceWatchBean private Long[] catEntryIds = null; private Long[] contractIds = null; private BigDecimal[] watchPrices = null; These variables are arrays. A particular numbered element of each array represents a row in the price watch list. 3. Create setter methods for the three variables: a. In the Outline view, select catEntryIds, contractIds and watchPrices. b. Right-click one of the selected variables and select Generate Getter and Setter from the menu. The Generate Getter and Setter window will open. c. Select only the setter methods for the three variables. Do not select the getter methods at this stage. We will create them later. d. Click OK. 468 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 4. Add the getter methods to the source as shown in Example 13-33. Example 13-33 Getter methods for PriceWatchBean variables public Long getCatEntryId(int idx) { try { return catEntryIds[idx]; } catch (IndexOutOfBoundsException e) { return null; } } public Long getContractId(int idx) { try { return contractIds[idx]; } catch (IndexOutOfBoundsException e) { return null; } } public BigDecimal getWatchPrice(int idx) { try { return watchPrices[idx]; } catch (IndexOutOfBoundsException e) { return null; } } As you can see, the getter methods include some error checking code. The getters each accept a parameter of type int, which correspond to an element of the relevant array. The error case in which an index that is outside of the bounds of the array is passed is handled and null is returned by the getter. This ensures that a runtime error will not occur in this case when the JSP is used. 5. Add the two additional methods shown in Example 13-34 to the source. Example 13-34 Convenience methods for PriceWatchBean public int getNoOfWatches() { int noOfWatches = 0; if (catEntryIds != null) { noOfWatches = catEntryIds.length; } return noOfWatches; } public boolean isListEmpty() { return (catEntryIds == null || catEntryIds.length == 0); } Chapter 13. Customize a store: Price Watch example 469 The getNoOfWatches() method provides an easy way to retrieve the number of price watch items that are stored in the bean. This method will return 0 if bean has not been initialized, that is, if the three arrays have not been correctly set. This method is coded to protect against NullPointerExceptions occurring when the method is called. The isListEmpty() method provides a way of easily testing if the bean contains any data. 6. Save your work by pressing Ctrl+S. 13.9 Creating the new JavaServer Pages This section contains details about the price watch JSP. In support of the JSP file, updates must be made to the properties files that contain the text to be displayed to the user. This section describes, at a fairly high level, the steps that were taken to create the sample, along with the theory and decisions involved. If you wish to follow these steps, ignore the following Import sample JSP section. Import sample JSP If you do not wish to build this JSP, you can import the finished JSP into your workspace as follows: 1. Open the Java perspective. 2. Expand Stores -> Web Content -> ToolTech. Note: You may recall, there are two different starting points for the customization example, either ToolTech or the ITSO store. This section will refer to ToolTech. If you published the ITSO store, use ITSO inplace of ToolTech within the procedure. 3. Right-click the ToolTech folder and select New -> Folder from the menu. 4. In the Folder name text field, enter PriceWatch and click Finish. 5. Right-click the new folder and select Import from the menu. The Import window will open. 6. Select File System from the list of sources. 7. Click Next. 8. Next to the Directory list, click Browse. 470 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide 9. Navigate to the c:\6969code directory where you extracted the redbook sample code containing the price watch samples (for example, c:\6969code\pricewatch\code\Stores\Web Content\ToolTech\PriceWatch). 10.Click OK. The selected folder and its contents will be displayed in the Import window. 11.Select the PriceWatchList.jsp file from the right-hand pane. 12.Ensure that Create selected folders only is the only selected option in the Options frame. 13.Click Finish. The JSP will now be added to your workspace. The following sections explain this JSP. You may wish to open the source of this JSP now as a reference while reading the remainder of this section. 13.9.1 Globalization In order to support multiple languages in our store, all of the displayed text is stored in properties files and referenced by the JSP, depending on the language selected by the user when they log on to the site. The properties files in the ToolTech example must be replaced with the files provided in the price watch sample. Changes to properties files The following properties files must be updated with the changes shown in this section: tooltechtext.properties tooltechtext_en_US.properties The default file, tooltechtext.properties, is used when the language-specific properties file cannot be determined. The tooltechtext_en_US.properties file is the file used when United States English is chosen when logging on to the store. The lines shown in Example 13-35 should be changed in the #Header section of the file. Example 13-35 Lines changed in Header section of properties file Header_Title = ITSO Store Header_Welcome = Welcome to the ITSO store Chapter 13. Customize a store: Price Watch example 471 Add the following line to the #Header section: Header_PriceWatchList = Price Watch Add the lines shown in Example 13-36 to the #Item Display section: Example 13-36 Lines changed in Item Display section of properties file ItemDisp_AddLabel = Add Price Watch ItemDisp_AddPriceWatch = Add Add the lines shown in Example 13-37 to the end of the file. This introduces a new section that contains the text for our new JSP, PriceWatchList.jsp Example 13-37 New price watch section in properties file # Price Watch PriceWatch_Title = Price Watch List PriceWatch_Message = The products you currently have a Price Watch for are listed below. If you wish to remove a watch, click Remove next to the product you wish to remove. PriceWatch_NoItems = You have no products in your Price Watch list. PriceWatch_SKU = SKU PriceWatch_Product = Product PriceWatch_Price = Price PriceWatch_WatchPrice = Watch Price PriceWatch_Remove = Remove PriceWatch_RemoveAll = Remove All If you wish to use additional languages in your store, be sure to add all of the lines shown above to the appropriate properties file. Important: Only the files mentioned above have been modified in our example and as a result, errors will occur if you select a language other than United States English when logging on to the store. Of course, if you add the appropriate entries yourself, the sample would work. Note that when modifying a language properties file, the server must be restarted before the changes will take effect. This is because the values are cached by the server for performance reasons when the server is started. 13.9.2 Creating the JSP file Typically, the easiest way to create a new JSP file is to use one of the sample store JSPs as a template. Once you have customized one JSP with the format of 472 WebSphere Commerce V5.5 Handbook Customization and Deployment Guide your new store, you can then use that as a template for future JSPs. It is possible to create a JSP from scratch, but it is far quicker and less error prone to reuse an existing JSP. Here are some general tips for choosing which JSP to use as a starting point: Choose a JSP with a simple layout and minimal data. If you will be displaying the same data on your page as on one of the sample pages, use that as a starting point, because the bean declarations will already be in place. If you require a layout similar to an existing page, use the one that is the best match. Starting point for the JSP For the Price Watch example JSP, the StoreCatalogDisplay.jsp JSP was used as the starting point since it had little content. To create the minimal template for the new JSP, the StoreCatalogDisplay.jsp code was stripped down to the bare minimum that was required for our new JSP. This new JSP template can be seen in Example 13-38. Example 13-38 Starting point for the new JSP Chapter 13. Customize a store: Price Watch example 473
|