Apache Commons
Apache Commons is a project of the Apache Software Foundation with the objective ofcreatinggeneral class libraries for the Java programminglanguage. Since the libraries are under the Apache License Version 2.0 , they can also be used in commercial projects. The focus is on independence from other libraries and functions relevant to servers. Before the foundation was restructured, the libraries were developed under the name Jakarta Commons .
structuring
Since the project consists of a large number of individual libraries, which are limited to a very limited field of tasks, these are differentiated within the project according to their degree of maturity. Libraries that have achieved proper status are an official part of the Commons. Projects that are already functional but do not yet meet the necessary criteria are managed in the sandbox . All other libraries that are still in the design or their care is not guaranteed to be as Dormant (Engl. Dormant) categorized.
The Apache Commons contains the following official (proper) components :
category | Components |
---|---|
Web |
|
XML | |
Utilities |
|
Conversions | |
Java API extensions |
|
General libraries
One of the most important libraries is "Commons Collections", which extends the Java Collections Framework with many helpful classes for managing data stocks. The "Commons Lang" library extends the basic functions of the java.lang package , which contains the basic Java classes, with many useful classes and their methods. With the help of “Commons Logging”, a uniform API for the various logging class libraries, such as log4j or java.util.logging, is created. Other general enhancements to the standard Java libraries include:
- Commons BeanUtils
- Commons CLI
- Commons Configuration
- Commons Math
Web application libraries
Some of the libraries are specially tailored for web applications to make it easier for developers to carry out frequently recurring tasks with little effort. Commons Net provides many well-known protocols such as FTP , POP3 or Telnet , while Commons FileUpload for servlets and web applications provides a simple mechanism for uploading files. The following list shows some other libraries of interest for web applications:
- Commons IO
- Commons Transaction
Commons HttpClient is no longer included , as this component was handed over to the superordinate Jakarta project in 2004 and has even been promoted to an independent top-level project since 2007.
XML processing libraries
Since Java Beans are often used on servers , Commons Betwixt offers a mapping of XML structures on Java Beans that is possible in both directions . Commons Digester specializes in the initialization of Java objects from XML data, while Commons Jelly enables the execution of an XML-based scripting language .
Libraries for database access
Apache Commons DB-Utils offers extensions and simplifications for accessing databases using Java Database Connectivity (JDBC). For example, it enables the data supplied from the database to be automatically converted into JavaBeans or automatically closes the database connections. This reduces the necessary database access code to the essential parts, making it easier to understand and maintain.
Opening a database connection can take a long time (sometimes several seconds). This is why most programs access database connection pools which hold several database connections and do not close the connections at the end of transactions, but keep them open for further database access. Apache Commons DBCP offers a pool of database connections based on the Apache Commons Pool, which manages the pool itself.
literature
- Henrik Hörning, Reidar Hörning, Torsten Curdt: Jakarta Commons . 1st edition. Software & Support, 2004, ISBN 3-935042-60-4 (367 pages).
- Timothy O'Brien: Jakarta Commons Cookbook . 1st edition. O'Reilly Media, Inc., 2004, ISBN 0-596-00706-X (400 pages).
- Christian Gross: Applied Software Engineering Using Apache Jakarta Commons . 1st edition. Charles River Media, 2003, ISBN 1-58450-246-0 (350 pages).