1.         The JAF is a data typing and registry technology that is a Standard Extension to the Java Platform.
2.         The JAF implements the following services:
       It determines the type of arbitrary data.
       It encapsulates access to data.
       It discovers the operations available on a particular type of data.
       It instantiates the software component that corresponds to the desired operation on a particular piece of data.
4.         javax.activation.DataHandler: provides a consistent interface between JAF-aware clients and other subsystems. The DataHandler class encapsulates a Data object, and provides methods which act on that data.
       The DataHandler can be instantiate with an object or a DataSource. The content is available through the DataHandler can be either an InputStream or an object in the Java.
5.         javax.activation.DataSource: encapsulates and object that contains data, and that can return both a stream providing data access, and a string defining the MIME type describing the data. The DataSource interface is used by DataHandler to access the underlying data. JAF includes two DataSource class implementations: FileDataSource & URLDataSource.
6.         javax.activation.DataContentHandler: extend the capabilities of the DataHandler’s implementation of the Transferable interface. The DataContentHandler interface is implemented by classes that are used by the DataHandler to convert InputStreams into object and vice versa. A DataHandler carries the content body and provides methods the client uses to handle the content.
       DataSource, DataHandler, DataContentHandler一起构成了Command设计模式的实现,DataSource为Command, 客户端产生DataSource实例,通过构造函数传递给DataHandler。但调用DataHandler方法时(例如getContent()),DataHandler在调用DataContentHandler实现类的相应方法并将DataSource实例作为参数传入(例如getContent(DataSource ds)),最后DataContentHandler的实现类在调用DataSource实例的相应方法进行处理。
7.         javax.activation.DataContentHandlerFactory: The interface defines a factory for DataContentHandler. DataContentHandlerFactory, DataContentHandler, DataHandler一起构成了Simple Factory设计模式的实现。
8.         javax.activation.CommandMap: provides a service that allows consumers of its interfaces to determine the ‘commands’ available on a particular MIME type as well as an interface to retrieve an object that can operate on an object of a particular MIME type(effectively a component registry).
       Javax.activation.MailCapCommandMap: implements a CommandMap whose configuration is based on mailcap files.
9.         javax.activation.CommandInfo: is used by CommandMap implementations to describe the results of command requests. The getCommandObject() is mostly useful. 通过DataHandler.getCommand(String cmdName)得到相应的CommandInfo,然后通过DataHandler.getBean(CommandInfo ci)得到相应的CommandObject.
10.     javax.activation.CommandObject: the interface which is been implemented when beans want to interact with JAF Services.
11.     The Transferable interface’s functionality can be extended via objects implementing the DataContentHandler interface, and then made available to the DataHandler either by a DataContentHandlerFactory object, or via a CommandMap.
个人分类: 学习笔记
想对作者说点什么? 我来说一句


2011年10月15日 3.01MB 下载


2009年01月15日 2.59MB 下载