The Java Activation Framework ( JAF ) is a standard extension that can be used by Beans that work with many external data types, such as media retrieved from files and streams. It is essentially a generalized content/protocol handler mechanism for Java Beans. The JAF is an extensible set of classes that wrap arbitrary, raw data sources to provide access to their data as streams or objects, identify the MIME type of the data, and enumerate a registered set of “commands” for operating on the data.
The JAF provides two primary interfaces:
DataSource
and DataHandler
.
The DataSource
acts something like the protocol
handlers we discussed in Chapter 12. It wraps the
data source and determines a MIME type for the data stream. The
DataHandler
acts something like a content handler,
except that it provides a great deal more than access to the data. A
DataHandler
is constructed to wrap a
DataSource
and interpret the data in different
forms. It also provides a list of command operations that can be used
to access the data. DataHandler
also implements
the java.awt.datatransfer.Transferable
interface,
allowing data to be passed among application components in a well
defined way.
You can grab the latest JAF from Sun at http://java.sun.com/beans/glasgow/jaf.html.
Get Learning Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.