This article has multiple issues. Please help or discuss these issues on the talk page. (Learn how and when to remove these template messages)
This article relies too much on references to primary sources. Please improve this by adding secondary or tertiary sources.(June 2008) (Learn how and when to remove this template message)
This article provides insufficient context for those unfamiliar with the subject. Please help by providing more context for the reader.(October 2009) (Learn how and when to remove this template message)
The topic of this article may not meet Wikipedia's general notability guideline. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to be merged, redirected, or deleted. Find sources: – ···scholar·JSTOR(September 2010) (Learn how and when to remove this template message)
This article may be in need of reorganization to comply with Wikipedia's layout guidelines. Please help by to make improvements to the overall structure.(September 2019) (Learn how and when to remove this template message)
This article is in list format but may read better as prose. You can help by , if appropriate. Editing help is available.(April 2021)
(Learn how and when to remove this template message)
Jakarta Activation (JAF; formerly JavaBeans Activation Framework) is a Jakarta EE API that enables developers to:[1]
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 the operation(s).
It also enables developers to dynamically register types of arbitrary data and actions associated with particular kinds of data. Additionally, it enables a program to dynamically provide or retrieve JavaBeans that implement actions associated with some kind of data. Originally an extension API, it was available as a standard API in Java SE (from Java SE 6 on) and Java EE, but was removed in Java SE 11.
Provides access to an arbitrary collection of data
Get name of the data, data-type name (content type), and the data itself as Input Stream or Output Stream
Two implementation classes provided
URLDataSource simplifies the handling of data described by URLs
FileDataSource simple DataSource object that encapsulates a file provides data typing services -> delegated to a FileTypeMap object.
Other implementations
javax.mail.internet.MimePartDataSource
javax.mail.util.ByteArrayDataSource
DataContentHandler interface[]
Convert the object to a byte stream and write it to the output stream
Convert streams in to objects
Used to get object/data which can be transferred
Uses java.awt.datatransfer.DataFlavor to indicate the data that can be accessed. DataFlavor is a data format as would appear on a clipboard, during drag and drop, or in a file system.
CommandMap class[]
An abstract class provides an interface to a registry of command objects available in the system
Developer develop their own implementation or use
MailcapCommandMap class that implements a CommandMap whose configuration is based on mailcap files (1524)
Command list available from a MIME Type is stored in CommandInfo object.
CommandObject interface[]
Interface to be implemented by JavaBeans components that are ActivationFramework aware
Simple interface with one method:
setCommandContext(String verb, DataHandler dh)
Example: Compose an e-mail with attachment[]
importjavax.activation.DataHandler;importjavax.activation.FileDataSource;importjavax.mail.internet.*;importjavax.mail.*;...// Create a message.MimeMessagemessage=newMimeMessage(session);...// Create the Multipart to be added the parts toMultipartmultipart=newMimeMultipart();// Create and fill the first text message partMimeBodyPartmbp=newMimeBodyPart();mbp.setText("Body");multipart.addBodyPart(mbp);// Create a file attachment and fill as second message partMimeBodyPartmbp=newMimeBodyPart();FileDataSourcefds=newFileDataSource("C:\\attachment.zip");mbp.setDataHandler(newDataHandler(fds));mbp.setFileName(fds.getName());multipart.addBodyPart(mbp);// Add the multipart to the messagemessage.setContent(multipart);...