Jakarta Commons经典实例(影印版)
Jakarta Commons经典实例(影印版)
Timothy M. O'Brien
出版时间:2005年06月
页数:404
长期以来,Java一直承诺向开发人员提供可重用、模块化和可移植的特性。要实现上层的软件结构开发者可对已有的框架和组件进行扩展,或按需定制,而无需从最底层的细节开始。一个典型的例子就是万维网联盟(W3C)定义的DOM接口。应用程序开发人员很少会去编写一个自己的XML解析器,但他们常常编写自己的组件,而这些组件的功能在一些自由软件库中已经实现了,只是开发者们不知道这些开源组件的存在罢了。本书采用O'Reilly经典实例系列丛书中惯用的问题-求解模式概述了可供使用的软件库以解决上述问题。这里仅列出部分本书所涵盖的Commons项目和组件:
* 对核心Java语言的扩展,包括字符串和日期操作、字符串编码和参数验证
* 对XML的支持,从解析、文档生成到使用搜索引擎索引XML文档所需的XPath
* 模板化框架使你能够超越JSP的基本功能,不仅Web页面,甚至XML文件或者电子邮件都能够进行模板化
* 使用FTP、SMTP、POP、NNTP、特别是HTTP和WebDAV等功能所需的工具
* 使用Functor进行编程的新方法,包括使用predicate、closure、transformer和functor(替换控制结构,如for和while)
* 新的collection和collection工具,包括LRU Map、predicated collection、适用于Java 1.4的typed collection、filtering iterator和set操作
* 对JavaBean的扩展,从bean到map的转换至序列化bean为XML字符串
* 提供对矩阵、复数、线性回归支持的新数学工具库
* 对Jakarta Commons组件和Maven、Ant协同使用的指导
* 日志、编码和对象池(object pools)
仅仅了解一两个有用的工具类是不够的,您必须意识到做出不同选择的可能,并对所选技术的全景有所了解。如果您希望能够摆脱令人手忙脚乱的编程方法并熟练掌握Java这门语言,《Jakarta Commons经典实例》正是您所需要的工具。
  1. Preface
  2. 1. Supplements to the Java 2 Platform
  3. 1.1 Obtaining Commons Lang
  4. 1.2 Joining the Commons-User Mailing List
  5. 1.3 Getting the Commons Lang Source Code
  6. 1.4 Automating the Generation of toString()Content
  7. 1.5 Customizing Generated toString()Content
  8. 1.6 Automating hashCode()and equals()
  9. 1.7 Automating compareTo()
  10. 1.8 Printing an Array
  11. 1.9 Cloning and Reversing Arrays
  12. 1.10 Transforming Between Object Arrays and Primitive Arrays
  13. 1.11 Finding Items in an Array
  14. 1.12 Creating a Map from a Multidimensional Array
  15. 1.13 Formatting Dates
  16. 1.14 Rounding Date Objects
  17. 1.15 Truncating Date Objects
  18. 1.16 Creating an Enum
  19. 1.17 Generating Unique Numeric Identifiers
  20. 1.18 Validation of Method Parameters
  21. 1.19 Measuring Time
  22. 2. Manipulating Text
  23. 2.1 Setting Up StringUtils and WordUtils
  24. 2.2 Checking for an Empty String
  25. 2.3 Abbreviating Strings
  26. 2.4 Splitting a String
  27. 2.5 Finding Nested Strings
  28. 2.6 Stripping and Trimming a String
  29. 2.7 Chomping a String
  30. 2.8 Creating an Emphasized Header
  31. 2.9 Reversing a String
  32. 2.10 Wrapping Words
  33. 2.11 Testing the Contents of a String
  34. 2.12 Measuring the Frequency of a String
  35. 2.13 Parsing Formatted Strings
  36. 2.14 Calculating String Difference
  37. 2.15 Using Commons Codec
  38. 2.16 Getting the Commons Codec Source Code
  39. 2.17 Calculating Soundex
  40. 3. JavaBeans
  41. 3.1 Representing Beans Graphically
  42. 3.2 Obtaining Commons BeanUtils
  43. 3.3 Getting the Commons BeanUtils Source Code
  44. 3.4 Accessing Simple Bean Properties
  45. 3.5 Accessing Nested Bean Properties
  46. 3.6 Accessing Indexed Bean Properties
  47. 3.7 Accessing Mapped Bean Properties
  48. 3.8 Accessing a Simple,Nested,Indexed,and Mapped Bean Property
  49. 3.9 Determining the Type of a Bean Property
  50. 3.10 Comparing Beans
  51. 3.11 Copying Bean Properties
  52. 3.12 Cloning a Bean
  53. 3.13 Setting a Bean Property
  54. 3.14 Testing Property Access
  55. 3.15 Validating Beans with Predicates
  56. 3.16 Creating a Map of Bean Properties
  57. 3.17 Wrapping a Bean with a Map
  58. 3.18 Creating a Dynamic Bean
  59. 3.19 Getting and Setting Properties as Strings
  60. 4. Functors
  61. 4.1 Obtaining Commons Collections
  62. 4.2 Getting the Commons Collections Source Code
  63. 4.3 Reversing a Comparator
  64. 4.4 Chaining Comparators
  65. 4.5 Comparing Nulls
  66. 4.6 Fixed-Order Comparison
  67. 4.7 Using Simple Predicates
  68. 4.8 Writing a Custom Predicate
  69. 4.9 Creating Composite Predicates
  70. 4.10 Transforming Objects
  71. 4.11 Creating a Chain of Transformations
  72. 4.12 Applying Conditional Transformations
  73. 4.13 Writing a Closure
  74. 4.14 Chaining Closures
  75. 4.15 Modeling Conditional Statements with Closures
  76. 4.16 Modeling Loops with Closures
  77. 5. Collections
  78. 5.1 Obtaining Commons Collections
  79. 5.2 Using a Looping Iterator
  80. 5.3 Iterating Over an ArrayList
  81. 5.4 Filtering a Collection with a Predicate
  82. 5.5 Iterating Through Distinct Elements
  83. 5.6 Using a Bag
  84. 5.7 Using a Buffer
  85. 5.8 Creating a Priority Queue
  86. 5.9 Using a Blocking Buffer
  87. 5.10 Storing Multiple Values in a Map
  88. 5.11 Retrieving a Key by a Value
  89. 5.12 Using a Case-Insensitive Map
  90. 5.13 Creating Typed Collections and Maps
  91. 5.14 Constraining Map Values
  92. 5.15 Constraining List Contents
  93. 5.16 Transforming Collections
  94. 5.17 Creating a Least Recently Used Cache
  95. 5.18 Using a Lazy Map
  96. 5.19 Counting Objects in a Collection
  97. 5.20 Performing Set Operations
  98. 5.21 Retrieving Map Values Without Casting
  99. 6. XML
  100. 6.1 Obtaining Jakarta Commons Digester
  101. 6.2 Turning XML Documents into Objects
  102. 6.3 Namespace-Aware Parsing
  103. 6.4 Creating a Simple XML Command Language
  104. 6.5 Variable Substitution and XML Parsing
  105. 6.6 Obtaining Jakarta Commons Betwixt
  106. 6.7 Turning Beans into XML Documents
  107. 6.8 Customizing XML Generated from an Object
  108. 6.9 Turning XML Documents into Beans
  109. 7. Application Infrastructure
  110. 7.1 Obtaining Commons CLI
  111. 7.2 Parsing a Simple Command Line
  112. 7.3 Parsing a Complex Command Line
  113. 7.4 Printing Usage Information
  114. 7.5 Obtaining Commons Configuration
  115. 7.6 Configuring Applications with Properties Files
  116. 7.7 Configuring Applications with XML
  117. 7.8 Using Composite Configuration
  118. 7.9 Obtaining Commons Logging
  119. 7.10 Using an Abstract Logging Interface
  120. 7.11 Specifying a Logging Implementation
  121. 7.12 Obtaining Apache Log4J
  122. 7.13 Configuring Log4J with a Properties File
  123. 7.14 Configuring Log4J with XML
  124. 8. Math
  125. 8.1 Using Fractions
  126. 8.2 Finding the Maximum and Minimum in an Array
  127. 8.3 Using Number Ranges
  128. 8.4 Generating Random Variables
  129. 8.5 Obtaining Commons Math
  130. 8.6 Calculating Simple Univariate Statistics
  131. 8.7 Solving a System of Linear Equations
  132. 8.8 Arithmetic with Complex Numbers
  133. 8.9 Establishing Relationships Between Variables
  134. 8.10 Estimating the Amount of Time Left in a Process
  135. 9. Templating
  136. 9.1 Obtaining Commons JEXL
  137. 9.2 Using an Expression Language
  138. 9.3 Invoking Methods in an Expression
  139. 9.4 Externalizing Logic with an Expression Language
  140. 9.5 Obtaining Jakarta Velocity
  141. 9.6 Using a Simple Templating Language
  142. 9.7 Writing Templates with Conditionals and Loops
  143. 9.8 Using Macros in a Templating Engine
  144. 9.9 Invoking Methods in a Template
  145. 9.10 Obtaining FreeMarker
  146. 9.11 Using a Complex Scripting Engine
  147. 9.12 Accessing XML Documents from a Templating Engine
  148. 9.13 Using Velocity in a Web Application
  149. 9.14 Using FreeMarker in a Web Application
  150. 9.15 Writing Templates in Eclipse
  151. 10. I/O and Networking
  152. 10.1 Obtaining Commons IO
  153. 10.2 Copying Streams,byte [],Readers,and Writers
  154. 10.3 Closing Streams,Readers,and Writers
  155. 10.4 Printing a Human-Readable File Size
  156. 10.5 Copying Files,Strings,and URLs
  157. 10.6 Deleting Directories Recursively
  158. 10.7 Obtaining the Size of a Directory
  159. 10.8 Touching a File
  160. 10.9 Filtering Files
  161. 10.10 Measuring Stream Traffic
  162. 10.11 Splitting an OutputStream
  163. 10.12 Obtaining Jakarta ORO
  164. 10.13 Using Globs and Perl5 Regular Expressions to List Files
  165. 10.14 Obtaining Commons Net
  166. 10.15 Writing an FTP Client
  167. 10.16 Sending Mail with SMTP
  168. 10.17 Checking a POP3 Mailbox
  169. 11. HTTP and WebDAV
  170. 11.1 Obtaining Jakarta HttpClient
  171. 11.2 Getting Jakarta HttpClient Source Code
  172. 11.3 Performing an HTTP GET
  173. 11.4 Sending Parameters in a Query String
  174. 11.5 Retrieving Content with a Conditional GET
  175. 11.6 Debugging HTTP Communications
  176. 11.7 Making an HTTP POST Request
  177. 11.8 Sending POST Data from a File
  178. 11.9 Uploading Files with a Multipart POST
  179. 11.10 Basic Authentication
  180. 11.11 NTLM Authentication
  181. 11.12 Working with Cookies
  182. 11.13 Handling Redirects
  183. 11.14 SSL
  184. 11.15 Accepting a Self-Signed Certificate
  185. 11.16 Obtaining Jakarta Slide
  186. 11.17 Connecting to WebDAV Resources
  187. 11.18 Modifying a WebDAV Resource
  188. 12. Searching and Filtering
  189. 12.1 Obtaining Commons JXPath
  190. 12.2 Querying an Object Graph with XPath
  191. 12.3 Search a Collection of Simple Objects
  192. 12.4 Applying XPath Queries to Complex Object Graphs
  193. 12.5 Obtaining Jakarta Lucene
  194. 12.6 Creating an Index of XML Documents
  195. 12.7 Searching for a Specific Term in a Document Index
  196. 12.8 Finding the Frequency of Terms in an Index
  197. Index
书名:Jakarta Commons经典实例(影印版)
作者:Timothy M. O'Brien
国内出版社:东南大学出版社
出版时间:2005年06月
页数:404
书号:7-5641-0048-6
原版书出版商:O'Reilly Media
Timothy M. O'Brien
 
Timothy M. O'Brien is an active committer in the Jakarta Commons, a subproject of the Apache Software Foundation's Jakarta project. As a consultant, Tim tries to encourage the adoption of open source software and nudge organizations to view community participation as an essential strategy.In addition to his professional responsibilities, he is a bass/baritone who sings frequently in the Chicagoland area. Tim discovered programming on a Basic Four, TRS-80, and Commodore 64 in his hometown of Wellesley, Massachusetts; subsequently, he studied Computer Engi- neering at the University of Virginia.
Timothy M O'Brien是一位Jakarta社区的活跃成员。而Jakarta是Apache软件基金会(Apache Software Fundation)所属Apache工程的子项目。作为一名顾问人员,Tim致力于提倡采用开源软件,并敦促各组织把参与社区看作一项重要战略。
除了专业工作外,他还是一位男中低音歌手,常在芝加哥地区一展歌喉。Tim的编程生涯起始于家乡Massachusetts州的Wellesley,开始时学习的是Basic Four、TRS-80及Commodore64,后来他进入弗吉尼亚大学(the University of
Virginia)学习计算机工程。
 
 
The animal on the cover of Jakarta Commons Cookbook is an aardvark. Native to the grasslands and woodlands of sub-Saharan Africa, the aardvark is the only surviving species in the Orycteropodidae family of mammals.Despite being named for its resemblance to the pig (the word aardvark derives from the Dutch for "earth pig"), the aardvark's appearance is far more similar to that of marsupials, such as the bilby and the bandicoot.
Aardvarks are distinguished by their pig-like torso, arched back, oversized ears, and lengthy snout. They are typically yellow-gray in color, although their tough skin may appear reddish-brown when coated in soil. On average, the adult aadvark is slightly more than three feet long and weighs approximately 90 to 140 pounds.Aardvarks dine almost exclusively on ants and termites, for which their tiny, tubular mouth and long, slender tongue are ideally suited. Upon locating a cache of ants with their keen sense of smell, aardvarks use their strong front legs to dig into the nest and rapidly lap up the insects with their sticky tongue. Scientists have observed aardvarks devouring as many as 50,000 insects in a single night!
By nature, aardvarks tend to be reclusive.They are nocturnal creatures that build elaborate individual burrows of up to 40 feet in length in their home terrain, used to search for food and provide temporary shelter. Mothers make use of burrows as a more permanent home when giving birth to their young.
Currently, aardvarks are not considered an endangered species. However, they are still targeted by hunters for their exquisite cylindrical teeth, which are often used for decorative purposes.