初识 Apache Commons jar 包

长篇预警 ,要有耐心才能看下去

1.1. 开篇

      在Java的世界,有很多(成千上万)开源的框架,有成功的,也有不那么成功的,有声名显赫的,也有默默无闻的。在我看来,成功而默默无闻的那些框架值得我们格外的尊敬和关注,Jakarta Commons就是这样的一个框架。如果你至少参与了一个中型规模的Java项目,那么我想有超过一大半的机会你都接触和使用到了Jakarta Commons,不管你自己有没有察觉。就我所知,除了Apache Jakarta其他许多开源框架之外,不少所谓的商业框架其实内部有些模块是借用Commons的,甚至有一些完全就是对Commons的类进行了简单的封装。如果真的没有接触过也不要紧,当你看到它时,你自然会被它的简单而强大所吸引。

      要提高Java编程水平,一条可以走的路就是学习优秀的开源框架。这又要分两个层面:应用层面和源码层面。

          从应用来说,开源的框架大都可以给你带来生产力和/或代码质量的大幅提升;

          从源码来说,Java开源框架,尤其是那些大型的优秀的框架,其源码对广大Java爱好者来说都是一笔巨大的财富,你可以从中学到许多课本上学不到的东西:编码习惯、代码组织、注释、文档、如何用Java解决实际问题、特定问题的算法,等等。而这些对于我们的作为软件开发者的实际工作而言,相当有意义。

      熟悉Jakarta Commons的朋友可能会觉得现在是不是有点过时,因为有很多功能在J2SE 5.0中已经包含了。其实这个问题看你怎么去看,一方面,J2SE 5.0毕竟是刚出现不久的Java版本,实际应用中,很多时候我们需要把代码兼容等级维持在1.3或者1.4,所以很多5.0的功能我们暂时还不能放开手脚去使用;另一方面,鉴于Jakarta在一定程度上反映了一线Java开发人员的实际需求,而目前5.0已经采纳了其中许多特性,我们当然也有理由相信未来的Java版本还会继续参照Jakarta Commons的内容。有这么一套开发源码、免费使用、商业友好的优秀API作为Java自带API的补充,何乐而不为呢?

我打算在近期陆续做一些Jakarta Commons的学习笔记放上来,供大家参考。

有关Jakarta的最新动态和详细信息,可以参考:https://commons.apache.org/


1.2.简介

Apache Commons是一个非常有用的工具包,解决各种实际的通用问题
现在最新的jar 包是 

Welcome to Apache Commons

    Apache Commons is an Apache project focused on all aspects of reusable Java components.

     Apache Commons是一个Apache项目,专注于可重用Java组件的所有方面。


The Apache Commons project is composed of three parts:  Apache Commons项目由三部分组成:

  • The Commons Proper - A repository of reusable Java components.  可重用Java组件的存储库。
  • The Commons Sandbox - A workspace for Java component development.    用于Java组件开发的工作区。 
  • The Commons Dormant - A repository of components that are currently inactive.    当前停止开发的组件库。

    You may also read our charter, which spells out the goals of the project in greater detail.

    您还可以阅读我们的章程,其中详细说明了项目的目标。

      The Apache Commons source code repositories are writable for all ASF committers. While Apache Commons is a Commit-Then-Review community, we would consider it polite and helpful for contributors to announce their intentions and plans on the dev mailing list before committing code. All contributors should read our contributing guidelines. We accept patches as SVN diff files uploaded to the Apache bugtracker or as pull request via our github mirrors.

      所有ASF提交者都可以编写Apache Commons源代码存储库。虽然Apache Commons是一个提交后检查的社区,但是我们认为,在提交代码之前,贡献者应该在dev邮件列表上宣布他们的意图和计划,这是礼貌的,也是有帮助的。所有贡献者都应该阅读我们的贡献指南。我们接受补丁作为SVN diff文件上传到Apache bugtracker或通过我们的github镜像拉请求。

Apache Commons Proper   

      Commons Proper is dedicated to one principal goal: creating and maintaining reusable Java components. The Commons Proper is a place for collaboration and sharing, where developers from throughout the Apache community can work together on projects to be shared by the Apache projects and Apache users.

      Commons Proper致力于一个主要目标:创建和维护可重用的Java组件。Commons Proper是一个协作和共享的场所,整个Apache社区的开发人员可以共同协作Apache项目和Apache用户共享的项目。

      Commons developers will make an effort to ensure that their components have minimal dependencies on other libraries, so that these components can be deployed easily. In addition, Commons components will keep their interfaces as stable as possible, so that Apache users (including other Apache projects) can implement these components without having to worry about changes in the future.

      Commons开发人员将努力确保他们的组件对其他库具有最小的依赖性,以便可以轻松地部署这些组件。此外,Commons组件将使其接口尽可能保持稳定,以便Apache用户(包括其他Apache项目)可以实现这些组件,而无需担心将来的更改。

      This article gives an overview of (some of) the components which can be found here.

      文章 给出了(一些),它可以在这里找到的组件的概述。

      We welcome participation from all that are interested, at all skill levels. Coding, documentation and testing are all critical parts of the software development process. If you are interested in participating in any of these aspects, please join us!

      我们欢迎所有感兴趣的,不同技术水平的人参加。编码、文档和测试都是软件开发过程的关键部分。如果你有兴趣参与其中任何一个方面,请加入我们!

      

Components Description Latest Version Released
BCEL Byte Code Engineering Library - analyze, create, and manipulate Java class files

字节代码工程库 - 分析,创建和操作Java类文件
6.2 2017-11-08
BeanUtils Easy-to-use wrappers around the Java reflection and introspection APIs.

Commons-BeanUtils 提供对 Java 反射和自省API的包装
1.9.3 2016-09-26
BSF Bean Scripting Framework - interface to scripting languages, including JSR-223

Bean Scripting Framework - 脚本语言的接口,包括JSR-223
3.1 2010-06-24
Chain Chain of Responsibility pattern implemention.
Chain 提供实现组织复杂的处理流程的“责任链模式”.    
1.2 2008-06-02
CLI Command Line arguments parser.
CLI 提供针对命令行参数,选项,选项组,强制选项等的简单API.
1.4 2017-03-09
Codec General encoding/decoding algorithms (for example phonetic, base64, URL).

Codec 包含一些通用的编码解码算法。包括一些语音编码器, Hex, Base64, 以及URL encoder.  
1.11 2017-10-20
Collections Extends or augments the Java Collections Framework.

Commons-Collections 提供一个类包来扩展和增加标准的 Java Collection框架
4.1 2015-11-27
Compress Defines an API for working with tar, zip and bzip2 files.

定义用于处理tar,zip和bzip2文件的API。
1.17 2018-06-03
Configuration Reading of configuration/preferences files in various formats.

Commons-Configuration 工具对各种各式的配置和参考文件提供读取帮助.
2.2 2017-10-12
Crypto A cryptographic library optimized with AES-NI wrapping Openssl or JCE algorithm implementations.

使用AES-NI优化的加密库包装Openssl或JCE算法实现。
1.0.0 2016-07-22
CSV Component for reading and writing comma separated value files.

用于读写逗号分隔值文件的组件。
1.5 2017-09-03
Daemon Alternative invocation mechanism for unix-daemon-like java code.

一种 unix-daemon-like java 代码的替代机制 
1.0.15 2013-04-03
DBCP Database connection pooling services.

Commons-DBCP 提供数据库连接池服务
2.3.0 2018-05-12
DbUtils JDBC helper library.

DbUtils 是一个 JDBC helper 类库,完成数据库任务的简单的资源清除代码.
1.7 2017-07-20
Digester XML-to-Java-object mapping utility.

Commons-Digester 是一个 XML-Java对象的映射工具,用于解析 XML配置文件.
3.2 2011-12-13
Email Library for sending e-mail from Java.

用于从Java发送电子邮件的库。
1.5 2017-08-01
Exec API for dealing with external process execution and environment management in Java.

用于在Java中处理外部流程执行和环境管理的API。
1.3 2014-11-06
FileUpload File upload capability for your servlets and web applications.

FileUpload 使得在你可以在应用和Servlet中容易的加入强大和高性能的文件上传能力
1.3.3 2017-06-13
Functor A functor is a function that can be manipulated as an object, or an object representing a single, generic function.

仿函数是可以作为对象操作的函数,或者是表示单个通用函数的对象。
1.0 2011-??-??
Geometry Space and coordinates.

空间和坐标。
1.0 2018-??-??
Imaging (previously called Sanselan) A pure-Java image library.

纯Java图像库。
0.97-incubator 2009-02-20
IO Collection of I/O utilities.
IO 是一个 I/O 工具集
2.6 2017-10-15
JCI Java Compiler Interface

Java编译器接口
1.1 2013-10-14
JCS Java Caching System

Java缓存系统
2.2 2017-08-02
Jelly XML based scripting and processing engine.

Jelly是一个基于 XML 的脚本和处理引擎。 Jelly 借鉴了 JSP 定指标签,Velocity, Cocoon和Xdoclet中的脚本引擎的许多优点。
Jelly 可以用在命令行, Ant 或者 Servlet之中。
1.0.1 2017-09-27
Jexl Expression language which extends the Expression Language of the JSTL.

Jexl是一个表达式语言,通过借鉴来自于Velocity的经验扩展了JSTL定义的表达式语言。.
3.1 2017-04-14
JXPath Utilities for manipulating Java Beans using the XPath syntax.

Commons-JXPath 提供了使用Xpath语法操纵符合Java类命名规范的 JavaBeans的工具。
也支持 maps, DOM 和其他对象模型。.
1.3 2008-08-14
Lang Provides extra functionality for classes in java.lang.

Commons-Lang 提供了许多许多通用的工具类集,提供了一些java.lang中类的扩展功能
3.6 2017-06-08
Logging Wrapper around a variety of logging API implementations.

Commons-Logging 是一个各种 logging API实现的包裹类.
1.2 2014-07-11
Math Lightweight, self-contained mathematics and statistics components.

Math 是一个轻量的,自包含的数学和统计组件,解决了许多非常通用但没有及时出现在Java标准语言中的实践问题.
3.5 2015-04-17
Net Collection of network utilities and protocol implementations.

Net 是一个网络工具集,基于 NetComponents 代码,包括 FTP 客户端等等。
3.6 2017-02-15
Numbers Number types (complex, quaternion, fraction) and utilities (arrays, combinatorics).

数字类型(复数,四元数,分数)和实用程序(数组,组合数学)。
1.0 2017-??-??
OGNL An Object-Graph Navigation Language

对象图导航语言
4.0 2013-??-??
Pool Generic object pooling component.

Commons-Pool 提供了通用对象池接口,一个用于创建模块化对象池的工具包,以及通常的对象池实现.
2.5.0 2017-12-19
Proxy Library for creating dynamic proxies.

用于创建动态代理的库。
1.0 2008-02-28
RDF Common implementation of RDF 1.1 that could be implemented by systems on the JVM.

可以由JVM上的系统实现的RDF 1.1的通用实现。
0.3.0-incubating 2016-11-15
RNG Implementations of random numbers generators.

随机数发生器的实现
1.0 2016-12-13
SCXML An implementation of the State Chart XML specification aimed at creating and maintaining a Java SCXML engine.
It is capable of executing a state machine defined using a SCXML document, and abstracts out the environment interfaces.

旨在创建和维护Java SCXML引擎的State Chart XML规范的实现。
它能够执行使用SCXML文档定义的状态机,并抽象出环境接口。
0.9 2008-12-01
Statistics Statistics.
统计。
0.1 ????-??-??
Text Apache Commons Text is a library focused on algorithms working on strings.

Apache Commons Text是一个专注于处理字符串的算法的库。
1.3 2018-03-21
Validator Framework to define validators and validation rules in an xml file.

The commons-validator提供了一个简单的,可扩展的框架来在一个XML文件中定义校验器 (校验方法)和校验规则。支持校验规则的和错误消息的国际化。
1.6 2017-02-21
VFS Virtual File System component for treating files, FTP, SMB, ZIP and such like as a single logical file system.

虚拟文件系统组件,用于将文件,FTP,SMB,ZIP等处理为单个逻辑文件系统。
2.2 2017-10-06
Weaver Provides an easy way to enhance (weave) compiled bytecode.

提供一种增强(编织)编译字节码的简便方法。
1.3 2016-10-18

The Commons Sandbox

      The Commons project also contains a workspace that is open to all Apache committers. It's a place to try out new ideas and prepare for inclusion into the Commons portion of the project or into another Apache project. Users are free to experiment with the components developed in the sandbox, but sandbox components will not necessarily be maintained, particularly in their current state.

      Commons项目还包含一个对所有Apache提交者开放的工作空间。这是一个尝试新想法并准备包含在项目的Commons部分或另一个Apache项目的地方。用户可以自由地尝试沙箱中开发的组件,但不一定要维护沙箱组件,特别是在当前状态下。

有关Sandbox组件,请参见此处

See here for Sandbox components.

The Commons Dormant

      These are Commons components that have been deemed inactive since they have seen little recent development activity. If you wish to use any of these components, you must build them yourselves. It is best to assume that these components will not be released in the near future.

      这些Commons组件被认为是非活动的,因为他们最近几乎没有看到开发活动。如果您想使用这些组件中的任何一个,您必须自己构建它们。最好假设这些组件不会在不久的将来发布。

请参阅此处了解休眠组件。


See here for Dormant components.

Where do I get releases?

The individual components have independent releases. Some releases for some components may be available only through the mirroring system. Some releases for some components (typically the older ones) are not available through the mirroring system.

      各个组件都有独立的版本。某些组件的某些版本只能通过镜像系统使用。某些组件(通常是较旧的组件)的某些版本无法通过镜像系统获得。

      有关特定下载内容,请参阅上面列出的各个网站,或使用“ 版本” 菜单选项。

See the individual websites listed above for the specific downloads, or use the Releases menu option.


How do I contribute, give feedback, fix bugs and so on?

我如何贡献,提供反馈,修复错误等等?

      The Commons project really needs and appreciates any contributions, including documentation help, source code and feedback.

      Commons项目确实需要并赞赏任何贡献,包括文档帮助,源代码和反馈。

  • Discussion occurs on the Commons mailing list.      讨论发生在 Commons邮件列表中
  • We have an IRC channel on freenode - join #apache-commons.          我们在freenode上有一个IRC频道 - 加入#apache-commons。
  • Access to the SVN commons/proper repository is available both online and with a svn client.        可以在线和使用 svn客户端 访问SVN 公共/适当的存储库 
  • Access to the SVN commons/sandbox repository is available both online and with a svn client.      
  • Access to the SVN commons/dormant repository is available both online and with a svn client.

Related Components @Apache   

 相关组件@Apache

      The Commons HttpClient project used to be a part of Commons, but is now part of Apache HttpComponents - see Jakarta Commons HttpClient

      Commons HttpClient项目曾经是Commons的一部分,但现在是Apache HttpComponents的一部分 - 请参阅 Jakarta Commons HttpClient


      最后:Jakarta Commons这个类库中非常重要的三个子项目:Commons Lang、Commons BeanUtils和Commons Collections,这些工具包在无数开源或商业框架中都可以找到,可以说应用范围非常广。

      当然,Jakarta Commons提供的API远不止我们提到的这些,除了上述三个核心项目之外,还有读取和映射XML文档的Digester/Betwixt、处理命令行参数的CLI、提供常用编码算法的Codec、用于读取多种格式的配置文件的Configuration、发送电子邮件的Email、上传文件的FileUpload、模拟HTTP客户端的HttpClient、处理日志的Logging等等等等,实在是相当的丰富。


参考: http://www.cnblogs.com/jimcsharp/p/8872144.html  

            https://commons.apache.org/

猜你喜欢

转载自blog.csdn.net/qq_30336433/article/details/81028533