• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introduction to JavaBeans Activation Framework v1.1
 

Introduction to JavaBeans Activation Framework v1.1

on

  • 5,214 views

JavaBeans Activation Framework standard extension, developers who use Java technology can take advantage of standard services to ...

JavaBeans Activation Framework standard extension, developers who use Java technology can take advantage of standard services to
-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 said operation(s).

The API doc said: It is used by the JavaMail API to manage MIME data. But actually, it is more general purpose.


Statistics

Views

Total Views
5,214
Views on SlideShare
5,214
Embed Views
0

Actions

Likes
1
Downloads
38
Comments
1

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • i don't know how to thank you soooo much for your amazing effort and today i have exam at chapter after 8 hours please pray for me , and i am study from your material , i like it and you make it clear but i would be happy if we get in touch , this is email address mahmoudhermes@gmail.com and my facebook account on mahmoudhermes@hotmail.com , i am from egypt and i wish that we can communicate :)
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introduction to JavaBeans Activation Framework v1.1 Introduction to JavaBeans Activation Framework v1.1 Presentation Transcript

    • JavaBeans Activation Framework (version 1.1) ejlp12@gmail.comJan 2012
    • The Spec said…With the JavaBeans Activation Framework standard extension, developerswho use Java technology can take advantage of standard services to 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 said operation(s).The API doc said: It is used by the JavaMail API to manage MIME data.But actually, it is more general purpose.
    • JAFJSR-925Latest spec version is 1.1It’s an old spec - released on April 2006It’s originally an extension API Now available as standard API in Java SE 6 and Java EE 5 Has only one package javax.activation (4 interfaces, 13 classes)Spec document can be seen online athttp://www.oracle.com/technetwork/java/jaf-1-150219.pdfAPI documentation
    • JAF architecture Major components on the JAF architecture Encapsulates an object that contains data, and that can return both • a stream providing data access, and • a string defining the MIME type describing the data. Beans extend the CommandObject interface in order to interact with JAF services • Allows consumers of its interfaces to determine the provides a consistent interface ‘commands’ available on a particular MIME type between JAF-aware clients and • An interface to retrieve an object that can operate other subsystems on an object of a particular MIME typeSource: JAF Specification v1.1
    • DataSource InterfaceProvides access to an arbitrary collection of dataGet name of the data, data-type name (content type), and the data itself asInputStream or OutputStreamTwo 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 implementation javax.mail.internet.MimePartDataSource
    • 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 accessedDataFlavor is a data format as would appear on a clipboard, during drag anddrop, or in a file system
    • CommandMap classAn abstract class provides an interface to a registry of command objectsavailable in the systemDeveloper develop their own implementation or use MailcapCommandMap class that implements a CommandMap whose configuration is based on mailcap files (RFC 1524)Command list available from a MIME Type is stored in CommandInfo object
    • CommandObject interfaceInterface to be implemented by JavaBeans components that are ActivationFramework awareSimple interface with one method: setCommandContext(String verb, DataHandler dh)
    • Example: Compose an e-mail with attachmentimport 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 toMultipart multipart= new MimeMultipart();// Create and fill the first text message partMimeBodyPart mbp = new MimeBodyPart(); mbp.setText(Body);multipart.addBodyPart(mbp);// Create a file attachment and fill as second message partMimeBodyPart 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 messagemessage.setContent(multipart);...
    • JAF in useAnother example of JAF in use: REST easy with the JavaBeans Activation Framework http://www.javaworld.com/javaworld/jw-10-2007/jw-10-resteasy.html Example also available in Java 6™ New Features: A Tutorial book, chapter-13 ISBN 0-9752128-8-5 Other presentation deck: http://www.hilbertinc.com/whitepapers/JAF.pdf
    • Thank You