Jakarta Commons Cookbook

by
Format: Paperback
Pub. Date: 2004-12-01
Publisher(s): Oreilly & Associates Inc
List Price: $44.95

Rent Book

Select for Price
There was a problem. Please try again later.

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

eBook

We're Sorry
Not Available

Summary

Instead of stumbling around the Jakarta site and reading pages of documentation written by groups of disconnected developer teams, The Jakarta Commons Cookbook helps developers by aggregating information into a survey of the available tools in a way that allows them to get up and running quickly. The Jakarta Commons Cookbook introduces design possibilities, explores combining utilities in novel assemblies to create complex applications, and provides example code for a wide variety of uses.

Author Biography

Tim O'Brien is an active committer in the Jakarta Commons, a sub-project 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, studying Computer Engineering at the University of Virginia

Table of Contents

Preface xi
Supplements to the Java 2 Platform
1(39)
Obtaining Commons Lang
1(2)
Joining the Commons-User Mailing List
3(1)
Getting the Commons Lang Source Code
4(1)
Automating the Generation of toString() Content
5(2)
Customizing Generated toString() Content
7(3)
Automating hashCode() and equals()
10(2)
Automating compareTo()
12(2)
Printing an Array
14(1)
Cloning and Reversing Arrays
15(2)
Transforming Between Object Arrays and Primitive Arrays
17(2)
Finding Items in an Array
19(2)
Creating a Map from a Multidimensional Array
21(1)
Formatting Dates
22(2)
Rounding Date Objects
24(2)
Truncating Date Objects
26(2)
Creating an Enum
28(4)
Generating Unique Numeric Identifiers
32(2)
Validation of Method Parameters
34(3)
Measuring Time
37(3)
Manipulating Text
40(24)
Setting Up StringUtils and WordUtils
41(1)
Checking for an Empty String
41(2)
Abbreviating Strings
43(2)
Splitting a String
45(1)
Finding Nested Strings
46(2)
Stripping and Trimming a String
48(1)
Chomping a String
49(1)
Creating an Emphasized Header
49(1)
Reversing a String
50(1)
Wrapping Words
51(2)
Testing the Contents of a String
53(2)
Measuring the Frequency of a String
55(1)
Parsing Formatted Strings
56(3)
Calculating String Difference
59(2)
Using Commons Codec
61(1)
Getting the Commons Codec Source Code
62(1)
Calculating Soundex
62(2)
JavaBeans
64(33)
Representing Beans Graphically
65(3)
Obtaining Commons BeanUtils
68(1)
Getting the Commons BeanUtils Source Code
69(1)
Accessing Simple Bean Properties
70(2)
Accessing Nested Bean Properties
72(2)
Accessing Indexed Bean Properties
74(1)
Accessing Mapped Bean Properties
75(2)
Accessing a Simple, Nested, Indexed, and Mapped Bean Property
77(2)
Determining the Type of a Bean Property
79(1)
Comparing Beans
80(4)
Copying Bean Properties
84(1)
Cloning a Bean
85(1)
Setting a Bean Property
86(1)
Testing Property Access
87(1)
Validating Beans with Predicates
88(2)
Creating a Map of Bean Properties
90(1)
Wrapping a Bean with a Map
91(2)
Creating a Dynamic Bean
93(2)
Getting and Setting Properties as Strings
95(2)
Functors
97(35)
Obtaining Commons Collections
98(1)
Getting the Commons Collections Source Code
99(1)
Reversing a Comparator
100(2)
Chaining Comparators
102(2)
Comparing Nulls
104(2)
Fixed-Order Comparison
106(4)
Using Simple Predicates
110(4)
Writing a Custom Predicate
114(2)
Creating Composite Predicates
116(4)
Transforming Objects
120(1)
Creating a Chain of Transformations
121(2)
Applying Conditional Transformations
123(2)
Writing a Closure
125(1)
Chaining Closures
126(1)
Modeling Conditional Statements with Closures
127(3)
Modeling Loops with Closures
130(2)
Collections
132(52)
Obtaining Commons Collections
132(1)
Using a Looping Iterator
133(2)
Iterating Over an ArrayList
135(2)
Filtering a Collection with a Predicate
137(3)
Iterating Through Distinct Elements
140(1)
Using a Bag
141(5)
Using a Buffer
146(2)
Creating a Priority Queue
148(4)
Using a Blocking Buffer
152(3)
Storing Multiple Values in a Map
155(2)
Retrieving a Key by a Value
157(3)
Using a Case-Insensitive Map
160(2)
Creating Typed Collections and Maps
162(4)
Constraining Map Values
166(3)
Constraining List Contents
169(1)
Transforming Collections
170(2)
Creating a Least Recently Used Cache
172(2)
Using a Lazy Map
174(4)
Counting Objects in a Collection
178(2)
Performing Set Operations
180(2)
Retrieving Map Values Without Casting
182(2)
XML
184(25)
Obtaining Jakarta Commons Digester
185(1)
Turning XML Documents into Objects
186(5)
Namespace-Aware Parsing
191(3)
Creating a Simple XML Command Language
194(4)
Variable Substitution and XML Parsing
198(3)
Obtaining Jakarta Commons Betwixt
201(1)
Turning Beans into XML Documents
201(3)
Customizing XML Generated from an Object
204(3)
Turning XML Documents into Beans
207(2)
Application Infrastructure
209(20)
Obtaining Commons CLI
209(1)
Parsing a Simple Command Line
210(2)
Parsing a Complex Command Line
212(1)
Printing Usage Information
213(2)
Obtaining Commons Configuration
215(1)
Configuring Applications with Properties Files
216(1)
Configuring Applications with XML
217(1)
Using Composite Configuration
218(3)
Obtaining Commons Logging
221(1)
Using an Abstract Logging Interface
222(1)
Specifying a Logging Implementation
223(2)
Obtaining Apache Log4J
225(1)
Configuring Log4J with a Properties File
225(2)
Configuring Log4J with XML
227(2)
Math
229(20)
Using Fractions
229(3)
Finding the Maximum and Minimum in an Array
232(1)
Using Number Ranges
232(3)
Generating Random Variables
235(1)
Obtaining Commons Math
236(1)
Calculating Simple Univariate Statistics
237(2)
Solving a System of Linear Equations
239(2)
Arithmetic with Complex Numbers
241(1)
Establishing Relationships Between Variables
242(2)
Estimating the Amount of Time Left in a Process
244(5)
Templating
249(33)
Obtaining Commons JEXL
252(1)
Using an Expression Language
253(3)
Invoking Methods in an Expression
256(1)
Externalizing Logic with an Expression Language
257(2)
Obtaining Jakarta Velocity
259(1)
Using a Simple Templating Language
260(2)
Writing Templates with Conditionals and Loops
262(3)
Using Macros in a Templating Engine
265(3)
Invoking Methods in a Template
268(3)
Obtaining FreeMarker
271(1)
Using a Complex Scripting Engine
272(4)
Accessing XML Documents from a Templating Engine
276(2)
Using Velocity in a Web Application
278(2)
Using FreeMarker in a Web Application
280(1)
Writing Templates in Eclipse
281(1)
I/O and Networking
282(22)
Obtaining Commons IO
283(1)
Copying Streams, byte[], Readers, and Writers
284(1)
Closing Streams, Readers, and Writers
285(2)
Printing a Human-Readable File Size
287(1)
Copying Files, Strings, and URLs
288(1)
Deleting Directories Recursively
289(1)
Obtaining the Size of a Directory
290(1)
Touching a File
291(1)
Filtering Files
291(2)
Measuring Stream Traffic
293(1)
Splitting an OutputStream
294(1)
Obtaining Jakarta ORO
295(1)
Using Globs and Perl5 Regular Expressions to List Files
296(1)
Obtaining Commons Net
296(1)
Writing an FTP Client
297(2)
Sending Mail with SMTP
299(2)
Checking a POP3 Mailbox
301(3)
HTTP and WebDAV
304(34)
Obtaining Jakarta HttpClient
304(2)
Getting Jakarta HttpClient Source Code
306(1)
Performing an HTTP GET
307(1)
Sending Parameters in a Query String
308(3)
Retrieving Content with a Conditional GET
311(3)
Debugging HTTP Communications
314(2)
Making an HTTP POST Request
316(2)
Sending POST Data from a File
318(1)
Uploading Files with a Multipart POST
319(2)
Basic Authentication
321(2)
NTLM Authentication
323(2)
Working with Cookies
325(2)
Handling Redirects
327(3)
SSL
330(1)
Accepting a Self-Signed Certificate
331(2)
Obtaining Jakarta Slide
333(1)
Connecting to WebDAV Resources
334(2)
Modifying a WebDAV Resource
336(2)
Searching and Filtering
338(23)
Obtaining Commons JXPath
339(1)
Querying an Object Graph with XPath
339(3)
Search a Collection of Simple Objects
342(2)
Applying XPath Queries to Complex Object Graphs
344(3)
Obtaining Jakarta Lucene
347(1)
Creating an Index of XML Documents
348(6)
Searching for a Specific Term in a Document Index
354(3)
Finding the Frequency of Terms in an Index
357(4)
Index 361

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.