JAF学习笔记

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.
3.        
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.
12.      
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值