HOME

TheInfoList



OR:

Within
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, Jakarta Activation (JAF; formerly JavaBeans Activation Framework) is a
Jakarta EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web serv ...
API that enables developers to:JavaBeans Activation Framework
Retrieved 2020-03-30. * 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 In computing based on the Java Platform, JavaBeans is a technology developed by Sun Microsystems and released in 1996, as part of JDK 1.1. The 'beans' of JavaBeans are classes that encapsulate one or more objects into a single standardized objec ...
that implement actions associated with some kind of data. Originally an extension API, it was available as a standard API in
Java SE Java Platform, Standard Edition (Java SE) is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE). The platform uses Ja ...
(from Java SE 6 on) and
Java EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web serv ...
, but was removed in Java SE 11.


DataSource Interface

* 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 Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email messages to support text in character sets other than ASCII, as well as attachments of audio, video, images, and application programs. Message ...
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

import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.internet.*; import javax.mail.*; ... // Create a message. MimeMessage message = new MimeMessage(session); ... // Create the Multipart to be added the parts to Multipart multipart= new MimeMultipart(); // Create and fill the first text message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText("Body"); multipart.addBodyPart(mbp); // Create a file attachment and fill as second message part mbp = new MimeBodyPart(); FileDataSource fds = new FileDataSource("C:\\attachment.zip"); mbp.setDataHandler(new DataHandler(fds)); mbp.setFileName(fds.getName()); multipart.addBodyPart(mbp); // Add the multipart to the message message.setContent(multipart); ...


References


External links

*
JSR 925: JavaBeans Activation Framework 1.2 Specification

Introduction to JavaBeans Activation Framework

Introductory presentation
* * Example also available in ''Java 6 New Features: A Tutorial'' book, chapter-13 {{Jakarta EE Java (programming language)