简介

JAF,即为JavaBeans Activation Framework的缩写。
Mail API 的所有版本都需要 JavaBeans Activation Framework 来支持任意数据块的输入及相应处理。功能似乎不多,但目前许多浏览器和邮件工具中都能找到这种基本的 MIME 型支持。activation.jar 文件就是JAF的框架jar包。
JAF是一个专用的数据处理框架,它用于封装数据,并为应用程序提供访问和操作数据的接口。JAF的主要作用在于让java应用程序知道如何对一个数据源进行查看、编辑和打印等操作。
对于通过JAF封装的数据,应用程序通过JAF提供的接口可以完成如下功能:
1、访问数据源中的数据.
2、获知数据源的数据类型.
3、获知可对数据进行的各种操作.
4、用户对数据执行某种操作时,自动创建执行该操作的软件部件的实例对象.
javaMail API可以利用JAF从某种数据源中读取数据和获知数据的MIME类型,并用这些数据生成MIME消息中的消息体和消息类型。

 

JAF的设计目的

The JavaBeans Activation Framework is a library for abstracting the operating system specific bindings/mappings between file types and applications that deal with them. This can be based on MIME types and/or file extensions. It's really nothing more than that.

Open up Windows explorer and right click on a file. Various actions may be there (eg Open, Edit, Play). What actions are associated with the file is associated with the file extension on Windows. JAF is a portable version of that. It's mainly intended for desktop applications to be able to interact with whatever programs can be used with files on that computer.

(如翻译有误,请指正)

JAF是这样一个框架:常常人们使用不同的程序来处理不同的文件类型,程序与文件类型之间的关系的绑定或映射在不同操作系统有可能不同。针对这种OS的特定操作将其抽象出来,从而开发者不需要去考虑这种差异。这就是该框架的主要作用。这可以基于MIME类型和/或文件的扩展名。

打开Windows资源管理器右键点击一个文件。各种动作可能会存在(如打开,编辑,播放)。文件扩展名决定了该文件有哪些关联操作。 JAF是一个便携式版本的。它的主要目的是用于桌面应用程序,使之能够决定使用何种程序来处理该计算机上的文件。

JAF字面上翻译为javabeans激活框架。也有翻译成“活化”。

With the JavaBeans Activation Framework standard extension, developers who use Java technology can take advantage of standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and to instantiate the appropriate bean to perform said operation(s). For example, if a browser obtained a JPEG image, this framework would enable the browser to identify that stream of data as an JPEG image, and from that type, the browser could locate and instantiate an object that could manipulate, or view that image.

The JavaBeans Activation Framework is implemented as a standard extension. Sun provides a royalty-free reference implementation of the JAF software, in binary form, that developers can use to develop JAF technology-enabled applications for any platform that supports version 1.4 or later of the Java 2 Standard Edition. Sun's reference implementation of the JAF standard extension is available for download below.

参考文章:

发表评论