IBM Content Manager Ondemand Web Enablement Kit Java Apis the Basics and Beyond
Total Page:16
File Type:pdf, Size:1020Kb
Front cover IBM Content Manager OnDemand Web Enablement Kit Java APIs The Basics and Beyond Develop Web applications by using ODWEK V8.4 Java APIs Gain insightful best practices, hints, and tips Tune and troubleshoot OnDemand Web applications Wei-Dong Zhu Mark Mikeal Hassan A. Shazly Elliott Wade Sebastian Welter ibm.com/redbooks International Technical Support Organization IBM Content Manager OnDemand Web Enablement Kit Java APIs: The Basics and Beyond December 2008 SG24-7646-00 Note: Before using this information and the product it supports, read the information in “Notices” on page ix. First Edition (December 2008) This edition applies to Version 8 Release 4 of IBM Content Manager OnDemand (program number 5724-J33). © Copyright International Business Machines Corporation 2008. 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 . ix Trademarks . x Preface . xi The team that wrote this book . xii Become a published author . xiv Comments welcome. xiv Part 1. Programming with the ODWEK Java APIs . 1 Chapter 1. ODWEK Java API overview . 3 1.1 Origin of the ODWEK Java APIs . 4 1.2 Content Manager OnDemand system overview . 4 1.2.1 Content Manager OnDemand Library Server and Object Servers . 4 1.2.2 Content Manager OnDemand data . 6 1.2.3 Content Manager OnDemand data model . 7 1.2.4 Content Manager OnDemand data indexing and loading . 10 1.3 ODWEK Java APIs function overview. 11 1.3.1 Typical Web applications developed by using the ODWEK Java APIs . 11 1.4 ODWEK Java APIs architecture . 12 1.5 ODWEK Java APIs components . 13 1.5.1 ODWEK Java and native shared library . 14 1.5.2 Viewers . 14 1.5.3 ODWEK Java API distribution files . 15 1.6 WEBi client . 17 Chapter 2. ODWEK Java API classes . 21 2.1 Core API classes and their functional relationship . 22 2.1.1 Core API classes. 22 2.1.2 Functional relationship . 23 2.1.3 Server connection classes . 24 2.1.4 Content Manager OnDemand data model classes . 28 2.1.5 Search classes . 32 2.1.6 Document data retrieval classes . 35 2.1.7 Error handling class . 38 2.2 Sample console application. 39 2.3 Setting up a Web development environment by using Rational Application Developer . 43 © Copyright IBM Corp. 2008. All rights reserved. iii Chapter 3. ODWEK Java API examples . 53 3.1 Examples overview . 54 3.1.1 Example files. 54 3.1.2 Program flow and control . 59 3.2 Making a connection to Content Manager OnDemand . 59 3.3 Obtaining a list of cabinets and folders . 63 3.4 Displaying OnDemand folder information . 66 3.5 Obtaining a list of OnDemand folder search fields . 70 3.6 Displaying an Content Manager OnDemand search results list . 74 3.7 Retrieving and displaying an OnDemand document . 79 3.7.1 Viewing line data documents with the applet . 84 3.8 Disconnecting from OnDemand . 88 Chapter 4. Internet use case . 91 4.1 Use case overview . 92 4.2 Connection pooling consideration for the use case. 94 4.3 Sample application for the use case . 98 Part 2. Best practices, hints, and tips . 105 Chapter 5. Introduction to best practices, hints, and tips. 107 Chapter 6. Connection pooling and connection handling . 111 6.1 Connection pooling overview . 112 6.1.1 Benefits of connection pooling . 112 6.2 Connection pooling objects and pooling technique . 113 6.2.1 The ODServer class . 113 6.2.2 ODWEK Java API objects and threads. 114 6.2.3 The ODWEK Java API pool levels . 117 6.3 A simple connection pool code example . 118 6.3.1 The pooling mechanism . 118 6.3.2 Connection pool code functions . 120 6.3.3 Connection pool code sample. 121 6.4 Thread safety . 128 6.4.1 Instance variables . 129 6.4.2 Synchronization. 129 6.4.3 Implementing synchronization in the ODWEK Java APIs . 130 6.4.4 Synchronizing servlet code . 131 6.5 Resource consumption control . 132 6.5.1 Connection initialization . 132 6.5.2 Logging off and terminating a client connection . 135 6.5.3 Allocation and release of resources and sessions . 136 6.6 Timeout . 137 6.6.1 Inactivity timeout . 138 iv IBM Content Manager OnDemand Web Enablement Kit Java APIs: The Basics and Beyond 6.6.2 Other timeouts. 139 6.6.3 Implementing an application timeout by using the ODServer.cancel() method . 140 6.6.4 Recommended timeout implementation for a Web application. 141 Chapter 7. Globalization . 143 7.1 Globalization overview . 144 7.2 Content Manager OnDemand character conversion architecture . 146 7.2.1 Index data and annotations conversions. 147 7.2.2 UTF conversion. 148 7.2.3 Document data conversions . 149 7.3 Code page conversion in ODWEK . 149 7.3.1 API conversions . 149 7.3.2 Browser conversions. 150 7.3.3 Document data conversions . 150 7.4 The ICU conversion library . 151 7.5 Using Unicode as the database code page. 152 7.6 ODWEK language configuration . 154 7.7 Integrating custom code pages . 156 7.7.1 Locations that require configuration . 156 7.7.2 ICU and ICONV. 157 7.7.3 Customizing code page mappings for ICU . 158 7.8 Globalizing applications by using ICU . 158 Chapter 8. Folder searching. ..