Jakarta Commons Online Bookshelf

Vikram Goyal

2005 | 402 pages
ISBN:

$39.95 PDF ebook  

You can also purchase each module individually. See the module list at the bottom of this page.


RESOURCES

Look Inside Resources Downloads

DESCRIPTION

Written for developers and architects with real work to do, the Jakarta Commons Online Bookshelf is a collection of 14 PDF modules, each focused on one of the main Commons components. Commons is a collection of over twenty open-source Java tools broadly ranging from logging, validation, bean utilities and XML parsing. The Jakarta Commons Online Bookshelf summarizes the rationale behind each component and then provides expert explanations and hands-on examples of their use. You will learn to easily incorporate the Jakarta Commons components into your existing Java applications.

Why spend countless hours writing thousands of lines of code, when you can use the Jakarta Commons re-usable components instead? Each of the packages is independent of the others, and Manning lets you pick which of the Commons components you want to learn about. Each Module can be purchased separately or purchased together in the entire Jakarta Commons Online Bookshelf.

Why is Jakarta Commons so popular? Because it provides re-usable solutions to your everyday development tasks. Make your work life better starting today. Purchase one of the modules or the entire Bookshelf and get the guidance of an experienced Jakarta Commons pro.

WHAT THE READERS SAY ABOUT THIS BOOK...

"Great stuff! This is the ultimate missing manual to Jakarta Commons."
--Glen Smith, J2EE Consultant, Bytecode Pty Ltd

"...this manuscript is packed with incredibly useful information."
--Dirk Verbeeck, Jakarta Project Management Committee

"...has something for every developer. Well organized and structured."
--Robert Burrell Donkin, Apache Jakarta Commons Committer

"It is extremely well written, has outstanding examples that work, and provides excellent documentation."
--Doug Warren, Software Architect, Leading diversified financial services company

"Vikram's articles for O'Reilly mean that he's got as high visibility as anyone for Commons literature. The articles are linked from the Commons site itself."
--Henri Yandell, Jakarta PMC Chair

"Chapter 4 is on Digester, which I always think is a hard one to understand and Vikram does a solid job there."
--Henri Yandell, Jakarta PMC Chair

"There is ample background, context, and in-depth information to complement freely available materials."
--Yoav Shapira, Jakarta Commons Committer

"Very well written. Interesting, engaging, sometimes humorous in a good way"
--Yoav Shapira, Jakarta Commons Committer

ABOUT THE AUTHOR...

Vikram Goyal, author of Beginning JSP 2.0 and Professional JSP Site Design, regularly writes how-to articles on open source projects. His series of articles on Jakarta Commons was the first such effort to make sense out of the chaotic world of Jakarta Commons. His article series is still reflected in the official main entry page of Jakarta Commons as the only online series covering these components. Vikram is a Sun Certified Programmer for the Java 2 Platform. Vikram lives in Brisbane, Australia.

Acknowledgements

Writing a book isn't an easy task. When I first proposed the schedule for this book to Ben Sullins, my acquisitions editor, he wisely pointed out that my estimates for completing the manuscripts were grossly underestimated. I replied with false bravado that I was going to be very focused on writing this book, and I wanted to stick to my schedule.

Yeah, right!

One and a half years later (more than a year over my initial estimate), I'm writing these acknowledgements. During this period, I have changed houses three times, changed my day job once, survived two computer crashes, gone on an overseas trip, and remembered innumerable birthdays and anniversaries.

Throughout, my wife - my friend - stood by me. She encouraged me to continue when I felt I couldn't finish the book, and she threatened me with dire consequences when I said I would quit writing. She complained less about the time we couldn't spend together, and she tried to make most of the time that we did spend together.

She stood by me all this time and didn't carry out the threat to divorce me. I proudly dedicate this book to her.

Several other people helped me with the book-writing process. First, Marjan Bace had the vision to agree to publish a book on a not-so-hot topic from a not-so-known author. Ben Sullins, my acquisitions editor, gets a special nod for helping me settle into the writing process.

Bruce Byfield was my initial development editor and provided some valuable insight into my first review chapter. Jackie Carter took the initial work done by Bruce and guided me through the rest of the chapters with considerable ease. She provided lots of input, and I hope I was able to apply most of them in my writing. David Roberson started the review process for the book, and Karen Tegtmeyer took it to completion; both of them did a fine job of organizing the best possible group of people to review the book. Karen did an exceptional job in the last few weeks of the book's production by organizing and collating all the information from the reviewers. She further helped by providing essential copy for the book's web site.

Many thanks to all the reviewers: Jack Herrington, Oliver Zeigermann, Yoav Shapira, Glen Smith, Doug Warren, John Keyes, Dirk Verbeeck, Robert Burrell Donkin, Henri Yandell, Cos DiFazio, and Wahid Sadik. This book has benefited many times over because of your input.

Doug Warren also agreed to be the technical proofreader for the book and was exceptionally thorough.

In the production stage, Mary Piergies, my project editor, made sure every little detail was on track and that all the necessary people were on board. Leslie Haimes provided the cover design and spoilt me for choice. At the moment, I'm working with Helen Trimes in promoting this book, and I'm confident in her ability to provide the maximum possible coverage.

Finally, I would like to thank Tiffany Taylor, who, as a copy editor, made an infinite number of corrections to my manuscript. I didn't realize that in spite of my best efforts to say things the correct way, there was always a better way, and I'm thankful to Tiffany for making me realize this. I will endeavor to make fewer mistakes in my next book.

Individual Modules

You may purchase each module separately. Read more about each module below.

$7.00 HttpClient
$5.00 Uploading files with FileUpload
$4.00 Handling Protocols with the Net Component
$6.00 XML Parsing with Digester
$4.00 JXPath and Betwixt: Working with XML
$4.00 Validating Data with Validator
$7.00 Enhancing Java Core Libraries with Collections
$7.00 Enhancing Java Core Libraries with BeanUtils and Lang
$6.00 Pool and DBCP: Creating and Using Object Pools
$4.00 Codec: Encoders and Decoders
$6.00 Managing Components with Modeler
$5.00 Command-line Processing with CLI
$5.00 Understanding and Using Chain
$4.00 Working with the Logging and Discovery Components

Module 1: HttpClient

HttpClient is a feature rich Commons component that provides a way for developers to build their own browsers, web clients and distributed systems. It is a robust system that is extensible and compliant with most HTTP standards.

Even though HttpClient is one of the better-documented Commons component, it lacks a comprehensive manual style information about its capabilities. This module will help you understand the basics behind this component, including detailed information about each of the protocols supported by this component. It discusses this component's structure and shows how to use the new Preferences architecture. Detailed examples show how to use each of the HttpClient's features. Covers HttpClient 3.0 Alpha 2.

What's Inside

Module 2: Uploading files with FileUpload

FileUpload is an RFC 1867 compliant component that makes adding file upload capabilities in your web application simple. It's a server side component that parses web requests seamlessly and makes available these files for storage or further processing to your application.

This module delves into RFC 1867 to understand the basics of uploading files on the Internet. It starts with a section that clearly explains every facet of this RFC. Once the stage is set with the basics, it then delves into a section that explains how file upload would be done if the FileUpload component wasn't available. Finally, detailed examples of using the FileUpload component are presented, in various scenarios that range from simple uploads to complex forms to large files to storing files in a database.

What's Inside

Back to module list

Module 3: Handling Protocols with the Net Component

The NET component of Jakarta Commons is a feature rich, robust suite of packages that make handling Internet based protocols a breeze. It provides basic access to several of these protocols from a low level abstraction that provides direct access to their inner working. For those who want simple interfaces, this library provides several high level abstractions.

The NET module is a treasure trove of information about all the protocols that are supported by this Jakarta Commons component. There is basic information on protocols like FTP, TFTP, NNTP, SMTP, POP3, Whois, Telnet, Echo, Discard and so on. These protocols are discussed using their RFC as the basis, and simple and clear explanation is provided about them. The NET component's API is examined to understand how it encapsulates these protocols. Finally, an all-in-one application is created that handles both UDP and TCP based protocols from a single interface. This application shows how to use most of the protocols and exercise their interfaces.

What's Inside

Back to module list

Module 4: XML Parsing with Digester

The Digester component of Jakarta Commons makes it easy to read and parse configuration files and initialize system objects. It acts as an XML to Java object mapping tool that fires rules when matching patterns in the configuration file are encountered. Even though it is a very feature rich component, its architecture is such that plugging in your own set of rules is a breeze.

To understand Digester, it is important to understand the Digester Stack. Consequently, this module starts with a description of this particular entity in clear layman terms. It then shows how Digester does it matching business, and provides examples and description of the pre-built matching rules. The rules are many, and they are divided into relevant categories based on what they do. This module then shows you how to create and apply your own rules. There are several examples of Digester best practices, including externalizing rule and pattern sets, namespace aware parsing and sharing rules.

What's Inside

Back to module list

Module 5: JXPath and Betwixt: Working with XML

JXPath and Betwixt are two components that showcase the best of XML handling routines that the Commons component provides. These are complementary technologies that enable high degree of interaction between Java objects and XML data. Betwixt is a Data Binding tool and JXPath provides an expression language for complex data structures and objects. JXPath is based on the XPath syntax.

This module showcases the best of two components of the XML world! Betwixt part of this module shows you the meaning of Data Binding and how this concept relates to Java objects. It also shows you how Betwixt works, a very important concept that must be understood before Betwixt is used. It has detailed examples and best practices for using this component in real world situations. JXPath part of this module covers a detailed examination of XPath, the W3C standard for locating parts in an XML document. This module shows how this is relevant to Java objects and how it makes it easier to locate complex maps, collections and nested objects, and modify them. This module also covers Variables and Pointers, JXPath concepts that are normally hard to understand.

What's Inside

Back to module list

Module 6: Validating Data with Validator

Validator is a Jakarta Commons component that provides two things. First it provides a validation engine that is highly configurable and can be plugged in almost all situations. Second, it provides a basic set of rules for this engine. Together, they provide the basis for building highly effective validation routines which are applicable in almost all Java applications.

This module shows you how to use the Validator component. It not only provides the basic examples, but shows how to use this component in a normal Java application, a Java based Model 1 Web application and a Java based Model 2 application (Struts). It also shows you how to build a Wrapper class that you can use in your own applications. It covers the basics of data validation and lays the rules for effective data validation routines.

What's Inside

Back to module list

Module 7: Enhancing Java Core Libraries with Collections

The Collections component provides a rich suite of classes that seek to build upon the basic Java Collections API. It fills the gaps left by core Java Collection classes, by providing new interfaces, implementations and utilities over the more basic types.

This module examines the Collections component in very hands on manner. All packages in this component are analyzed with simple examples that build on as the complexity grows. Functors, Closures, Decorators and Transformers are discussed and explained with the help of examples. This module covers Collections 3.0, which represents a significant change from previous Collections versions.

What's Inside

Back to module list

Module 8: Enhancing Java Core Libraries with BeanUtils and Lang

BeanUtils is a supplement to the Java Reflection and Introspection API which uses these classes as the basis for easy access to Javabeans, both static and dynamic. Lang is a group of classes that enhance the core Java Lang package with helpful utilities and functions.

Understanding BeanUtils without understanding the terminology behind dynamic Javabean access is like going to the ocean without learning how to swim. Scalar, Dynamic, Nested, Indexed, DynaBeans! These are terms that must be understood if BeanUtils is to be properly utilized. This module does just that, by explaining each of these terms with the help of detailed examples, and then shows how to use them with BeanUtils. Everything that you can do with BeanUtils is explained, including the new package that interacts the Collections component. Covers BeanUtils version 1.7.0

The Lang part of this module shows how to use this component using examples modeled on each package. This means that comprehensive coverage of each package is covered, including examples of the best classes from each package.

What's Inside

Back to module list

Module 9: Pool and DBCP: Creating and Using Object Pools

Pool is the Commons component that deals with managing object pools in a generic manner. DBCP is one such implementation that showcases the best of this component for managing database connection objects. Using Pool is easy, because of its API which is designed for extension and interoperability. This ease of operation makes it easy to create object pools like DBCP, which however, still require factory classes for creating and managing the objects that it maintains (Database Connections).

This module shows in one concise collection, the best way to use Pool and DBCP components. Because DBCP is built on Pool, Pool is covered first and simple pools are created to highlight the best way to create your own object pools. A small commentary on the need for object pools is also included which has a comparison of object pools and garbage collectors. The DBCP part of the module shows you how to use this component to create the best connection pools, including several specialized DBCP pool implementations. It also shows you how to use a JOCL file, and how to configure your application servers.

What's Inside

Back to module list

Module 10: Codec: Encoders and Decoders

Codec is a Jakarta Commons component that provides implementations for common encoding and decoding functions. Some of these functions are indeed pretty common, for example, Base64, Hex and URL. Some of them not so, for example, all phonetic encodings like Soundex, Refined Soundex and Metaphone.

This module provides a description of the various encoders and decoders provided by Codec. It explains Base64, Hex, MD5, SHA, Soundex, Metaphone and Double Metaphone. The phonetic encoders are very useful in situations where similar sounding names are more important than similarly spelled names. It then shows you how to use Codec to encode and decode these technologies, with a detailed examination of the Codec API, in case you want to extend it to create your own encoder and decoder.

Back to module list

Module 11: Managing Components with Modeler

If you have ever used JMX for managing distributed components, you know that one of the most powerful and flexible MBean is a Model MBean. However, creating metadata information about each MBean is a painful process and one that requires several lines of code. The Modeler component of Jakarta Commons makes this task easier by providing a mechanism to read configuration files that contain Model MBean information in an XML format. Further, it provides several useful alternatives to the way Model MBeans are managed, making the overall process well worth the effort.

The module introduces the Modeler component. Before, it does that, however, it introduces JMX for users who are not well versed in this technology. So no prior knowledge is assumed as the JMX tutorial at the starting of this module takes care of all the basic stuff. This tutorial also servers as the basis for understanding the problem with Model MBeans, and how Modeler helps to solve this problem. Modeler's several capabilities are explained with examples, including the new feature where Modeler can be integrated with ANT using a set of generic ANT tasks.

What's Inside

Back to module list

Module 12: Command-line Processing with CLI

CLI is a Jakarta Commons component that is used to make command line interrogation easier by providing a singular interface. This component helps in parsing these arguments provided via the command line, looking for missing and incorrect options and providing feedback to the end-user. These options are then fed to the application where they can be used for configuration or management.

This module provides a detailed look at the process of command line interrogation using the CLI component for examples. The format of CLI options is explained in great detail and all the possible types of CLI options are examined. These include, simple options, arguments, switch and property options. Finally, examples are provided that show how to format help messages for the end-user.

What's Inside

Back to module list

Module 13: Understanding and Using Chain

Chain is a recently released Commons component that has gained increased popularity because of its association with Struts. Chain is an implementation of the "Chain of Responsibility" pattern that advocates a series of commands being put together in a chain where commands are independent entities that have no knowledge of their predecessor or successor entity. Thus, commands work in isolation, with only a common "context".

This module explains the Chain component in great detail with full fledged examples. The "Chain of Responsibility" pattern is the basis for this component and this is highlighted with a simple example, which also shows how to create a basic chain of commands.

The biggest advantage of the Chain component is the fact that it is going to be used as the basis for the next RequestProcessor for Struts. This allows application developers to pre process web requests, without the need for extending the Struts RequestProcessor. This module shows how to do this with help of an example that builds Struts-Chain, tweaks the chain-config.xml, installs the Chain RequestProcessor for Struts and writes a Command class that pre processes a web request.

What's Inside

Back to module list

Module 14: Working with the Logging and Discovery Components

Commons Logging is a wrapper library that acts as a conduit between an application and its logging apparatus. It does not provide a logging infrastructure of its own, other than a console writer, but acts as a channel which allows the plugging in of any logging API. Commons Discovery is another utility that facilitates the discovery of implementations of pluggable interfaces using the Service Provider Interface architecture (SPI). The underlying discovery pattern used in Commons Discovery is used in Commons Logging as well.

This module covers both these components with an emphasis on explaining the basics. Commons Logging is generally well understood, but poorly implemented. This module shows the best way to implement it by stepping through its discovery mechanism and shows how to tweak its settings. Commons Discovery is explained with the help of simple examples that show how it can be used to locate implementations of an interface.

What's Inside

Back to module list