SlideShare a Scribd company logo
JavaBeans Activation Framework
                    (version 1.1)
                     ejlp12@gmail.com




Jan 2012
The Spec said…


With the 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.
JAF


JSR-925
Latest spec version is 1.1
It’s an old spec - released on April 2006
It’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 at
http://www.oracle.com/technetwork/java/jaf-1-150219.pdf
API 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 type

Source: JAF Specification v1.1
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
InputStream or OutputStream
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 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
  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 (RFC 1524)
Command list available from a MIME Type is stored in CommandInfo object
CommandObject interface


Interface to be implemented by JavaBeans components that are Activation
Framework 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
MimeBodyPart 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);
...
JAF in use


Another 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

More Related Content

What's hot

Niranjan mule esb
Niranjan mule esbNiranjan mule esb
Niranjan mule esb
niranjan1234567
 
Mule overview
Mule overviewMule overview
Mule overview
Praneethchampion
 
Srilekha mule esb
Srilekha mule esbSrilekha mule esb
Srilekha mule esb
srilekha2820
 
Dataweave
DataweaveDataweave
Dataweave
krishashi
 
Mule message structure and varibles scopes
Mule message structure and varibles scopesMule message structure and varibles scopes
Mule message structure and varibles scopes
Ramakrishna kapa
 
Mule Expression Transformer
Mule Expression TransformerMule Expression Transformer
Mule Expression Transformer
Ankush Sharma
 
Impact of Restful Web Architecture on Performance and Scalability
Impact of Restful Web Architecture on Performance and ScalabilityImpact of Restful Web Architecture on Performance and Scalability
Impact of Restful Web Architecture on Performance and Scalability
Sanchit Gera
 
Ashok mule esb
Ashok mule esbAshok mule esb
Ashok mule esb
askumar037
 
Sai mule esb batch
Sai mule esb batchSai mule esb batch
Sai mule esb batch
saikiran6423
 
Mule esb kranthi
Mule esb kranthiMule esb kranthi
Mule esb kranthi
kranthikumar1210
 
Mule slides
Mule slides Mule slides
Mule slides
naveenkodumuri12
 
Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questions
TechieVarsity
 
Mule execution
Mule executionMule execution
Mule execution
Praneethchampion
 

What's hot (15)

Niranjan mule esb
Niranjan mule esbNiranjan mule esb
Niranjan mule esb
 
Mule overview
Mule overviewMule overview
Mule overview
 
Srilekha mule esb
Srilekha mule esbSrilekha mule esb
Srilekha mule esb
 
Dataweave
DataweaveDataweave
Dataweave
 
Mule message structure and varibles scopes
Mule message structure and varibles scopesMule message structure and varibles scopes
Mule message structure and varibles scopes
 
Day7
Day7Day7
Day7
 
Mule Expression Transformer
Mule Expression TransformerMule Expression Transformer
Mule Expression Transformer
 
Microsoft data access components
Microsoft data access componentsMicrosoft data access components
Microsoft data access components
 
Impact of Restful Web Architecture on Performance and Scalability
Impact of Restful Web Architecture on Performance and ScalabilityImpact of Restful Web Architecture on Performance and Scalability
Impact of Restful Web Architecture on Performance and Scalability
 
Ashok mule esb
Ashok mule esbAshok mule esb
Ashok mule esb
 
Sai mule esb batch
Sai mule esb batchSai mule esb batch
Sai mule esb batch
 
Mule esb kranthi
Mule esb kranthiMule esb kranthi
Mule esb kranthi
 
Mule slides
Mule slides Mule slides
Mule slides
 
Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questions
 
Mule execution
Mule executionMule execution
Mule execution
 

Viewers also liked

JBoss Data Virtualization (JDV) Sample Physical Deployment Architecture
JBoss Data Virtualization (JDV) Sample Physical Deployment ArchitectureJBoss Data Virtualization (JDV) Sample Physical Deployment Architecture
JBoss Data Virtualization (JDV) Sample Physical Deployment Architecture
ejlp12
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
ejlp12
 
WebSphere Application Server Topology Options
WebSphere Application Server Topology OptionsWebSphere Application Server Topology Options
WebSphere Application Server Topology Options
ejlp12
 
GSM/UMTS network architecture tutorial (Indonesia)
GSM/UMTS network architecture tutorial (Indonesia)GSM/UMTS network architecture tutorial (Indonesia)
GSM/UMTS network architecture tutorial (Indonesia)
ejlp12
 
Linux container & docker
Linux container & dockerLinux container & docker
Linux container & docker
ejlp12
 
WebSphere Application Server Information Resources
WebSphere Application Server Information ResourcesWebSphere Application Server Information Resources
WebSphere Application Server Information Resources
ejlp12
 
BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?
BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?
BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?
Guido Schmutz
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobile
ejlp12
 
Arah pengembangan core network architecture (Indonesia)
Arah pengembangan core network architecture (Indonesia)Arah pengembangan core network architecture (Indonesia)
Arah pengembangan core network architecture (Indonesia)ejlp12
 
IBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparisonIBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparison
ejlp12
 
WebSphere Application Server Family (Editions Comparison)
WebSphere Application Server Family (Editions Comparison)WebSphere Application Server Family (Editions Comparison)
WebSphere Application Server Family (Editions Comparison)
ejlp12
 
Apps with Apache Cordova and Phonegap
Apps with Apache Cordova and PhonegapApps with Apache Cordova and Phonegap
Apps with Apache Cordova and Phonegap
Christian Grobmeier
 
BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)
ejlp12
 
Agile & SCRUM
Agile & SCRUMAgile & SCRUM
Agile & SCRUMejlp12
 
Websphere Application Server V8.5
Websphere Application Server V8.5Websphere Application Server V8.5
Websphere Application Server V8.5
IBM WebSphereIndia
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
Java Usergroup Berlin-Brandenburg
 
IBM WebSphere Application Server (Clustering) Concept
IBM WebSphere Application Server (Clustering) ConceptIBM WebSphere Application Server (Clustering) Concept
IBM WebSphere Application Server (Clustering) Concept
ejlp12
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
ejlp12
 
Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)
ejlp12
 
Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0
Bryan Basham
 

Viewers also liked (20)

JBoss Data Virtualization (JDV) Sample Physical Deployment Architecture
JBoss Data Virtualization (JDV) Sample Physical Deployment ArchitectureJBoss Data Virtualization (JDV) Sample Physical Deployment Architecture
JBoss Data Virtualization (JDV) Sample Physical Deployment Architecture
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
 
WebSphere Application Server Topology Options
WebSphere Application Server Topology OptionsWebSphere Application Server Topology Options
WebSphere Application Server Topology Options
 
GSM/UMTS network architecture tutorial (Indonesia)
GSM/UMTS network architecture tutorial (Indonesia)GSM/UMTS network architecture tutorial (Indonesia)
GSM/UMTS network architecture tutorial (Indonesia)
 
Linux container & docker
Linux container & dockerLinux container & docker
Linux container & docker
 
WebSphere Application Server Information Resources
WebSphere Application Server Information ResourcesWebSphere Application Server Information Resources
WebSphere Application Server Information Resources
 
BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?
BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?
BPMN, BPEL, ESB or maybe Java? What should I use to implement my project?
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobile
 
Arah pengembangan core network architecture (Indonesia)
Arah pengembangan core network architecture (Indonesia)Arah pengembangan core network architecture (Indonesia)
Arah pengembangan core network architecture (Indonesia)
 
IBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparisonIBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparison
 
WebSphere Application Server Family (Editions Comparison)
WebSphere Application Server Family (Editions Comparison)WebSphere Application Server Family (Editions Comparison)
WebSphere Application Server Family (Editions Comparison)
 
Apps with Apache Cordova and Phonegap
Apps with Apache Cordova and PhonegapApps with Apache Cordova and Phonegap
Apps with Apache Cordova and Phonegap
 
BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)BPEL, BPEL vs ESB (Integration)
BPEL, BPEL vs ESB (Integration)
 
Agile & SCRUM
Agile & SCRUMAgile & SCRUM
Agile & SCRUM
 
Websphere Application Server V8.5
Websphere Application Server V8.5Websphere Application Server V8.5
Websphere Application Server V8.5
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
 
IBM WebSphere Application Server (Clustering) Concept
IBM WebSphere Application Server (Clustering) ConceptIBM WebSphere Application Server (Clustering) Concept
IBM WebSphere Application Server (Clustering) Concept
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)
 
Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0
 

Similar to Introduction to JavaBeans Activation Framework v1.1

Java New Evolution
Java New EvolutionJava New Evolution
Java New EvolutionAllan Huang
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
Kumar
 
Answer ado.net pre-exam2018
Answer ado.net pre-exam2018Answer ado.net pre-exam2018
Answer ado.net pre-exam2018
than sare
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
Trisha Gee
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
Trisha Gee
 
Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2
Mindsmapped Consulting
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2
javatrainingonline
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
suranisaunak
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
Jason Townsend, MBA
 
Dev212 Comparing Net And Java The View From 2006
Dev212 Comparing  Net And Java  The View From 2006Dev212 Comparing  Net And Java  The View From 2006
Dev212 Comparing Net And Java The View From 2006kkorovkin
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
kanchanmahajan23
 
NiFi - First approach
NiFi - First approachNiFi - First approach
NiFi - First approach
Mickael Cassy
 
EJB 2
EJB 2EJB 2
RIA Data and Security, 2007
RIA Data and Security, 2007RIA Data and Security, 2007
RIA Data and Security, 2007
Evgenios Skitsanos
 
Servlet basics
Servlet basicsServlet basics
Servlet basics
Santosh Dhoundiyal
 
WIT UNIT-5.pdf
WIT UNIT-5.pdfWIT UNIT-5.pdf
WIT UNIT-5.pdf
jashmithakakavakam
 

Similar to Introduction to JavaBeans Activation Framework v1.1 (20)

J2EE
J2EEJ2EE
J2EE
 
Spring 2
Spring 2Spring 2
Spring 2
 
Java New Evolution
Java New EvolutionJava New Evolution
Java New Evolution
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
 
Answer ado.net pre-exam2018
Answer ado.net pre-exam2018Answer ado.net pre-exam2018
Answer ado.net pre-exam2018
 
Name services
Name servicesName services
Name services
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
 
Name Services
Name Services Name Services
Name Services
 
Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
Dev212 Comparing Net And Java The View From 2006
Dev212 Comparing  Net And Java  The View From 2006Dev212 Comparing  Net And Java  The View From 2006
Dev212 Comparing Net And Java The View From 2006
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
 
NiFi - First approach
NiFi - First approachNiFi - First approach
NiFi - First approach
 
EJB 2
EJB 2EJB 2
EJB 2
 
RIA Data and Security, 2007
RIA Data and Security, 2007RIA Data and Security, 2007
RIA Data and Security, 2007
 
Servlet basics
Servlet basicsServlet basics
Servlet basics
 
WIT UNIT-5.pdf
WIT UNIT-5.pdfWIT UNIT-5.pdf
WIT UNIT-5.pdf
 

More from ejlp12

Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and image
ejlp12
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dump
ejlp12
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
ejlp12
 
BPMN Introduction
BPMN IntroductionBPMN Introduction
BPMN Introduction
ejlp12
 
IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction
ejlp12
 
PMP Training - 11 project risk management
PMP Training - 11 project risk managementPMP Training - 11 project risk management
PMP Training - 11 project risk managementejlp12
 
PMP Training - 10 project communication management
PMP Training - 10 project communication managementPMP Training - 10 project communication management
PMP Training - 10 project communication managementejlp12
 
PMP Training - 09 project human resource management
PMP Training - 09 project human resource managementPMP Training - 09 project human resource management
PMP Training - 09 project human resource managementejlp12
 
PMP Training - 08 project quality management
PMP Training - 08 project quality managementPMP Training - 08 project quality management
PMP Training - 08 project quality managementejlp12
 
PMP Training - 12 project procurement management
PMP Training - 12 project procurement managementPMP Training - 12 project procurement management
PMP Training - 12 project procurement managementejlp12
 
PMP Training - 07 project cost management
PMP Training - 07 project cost managementPMP Training - 07 project cost management
PMP Training - 07 project cost managementejlp12
 
PMP Training - 06 project time management2
PMP Training - 06 project time management2PMP Training - 06 project time management2
PMP Training - 06 project time management2ejlp12
 
PMP Training - 05 project scope management
PMP Training - 05 project scope managementPMP Training - 05 project scope management
PMP Training - 05 project scope managementejlp12
 
PMP Training - 04 project integration management
PMP Training - 04 project integration managementPMP Training - 04 project integration management
PMP Training - 04 project integration managementejlp12
 
PMP Training - 01 introduction to framework
PMP Training - 01 introduction to frameworkPMP Training - 01 introduction to framework
PMP Training - 01 introduction to frameworkejlp12
 

More from ejlp12 (15)

Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and image
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dump
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
BPMN Introduction
BPMN IntroductionBPMN Introduction
BPMN Introduction
 
IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction
 
PMP Training - 11 project risk management
PMP Training - 11 project risk managementPMP Training - 11 project risk management
PMP Training - 11 project risk management
 
PMP Training - 10 project communication management
PMP Training - 10 project communication managementPMP Training - 10 project communication management
PMP Training - 10 project communication management
 
PMP Training - 09 project human resource management
PMP Training - 09 project human resource managementPMP Training - 09 project human resource management
PMP Training - 09 project human resource management
 
PMP Training - 08 project quality management
PMP Training - 08 project quality managementPMP Training - 08 project quality management
PMP Training - 08 project quality management
 
PMP Training - 12 project procurement management
PMP Training - 12 project procurement managementPMP Training - 12 project procurement management
PMP Training - 12 project procurement management
 
PMP Training - 07 project cost management
PMP Training - 07 project cost managementPMP Training - 07 project cost management
PMP Training - 07 project cost management
 
PMP Training - 06 project time management2
PMP Training - 06 project time management2PMP Training - 06 project time management2
PMP Training - 06 project time management2
 
PMP Training - 05 project scope management
PMP Training - 05 project scope managementPMP Training - 05 project scope management
PMP Training - 05 project scope management
 
PMP Training - 04 project integration management
PMP Training - 04 project integration managementPMP Training - 04 project integration management
PMP Training - 04 project integration management
 
PMP Training - 01 introduction to framework
PMP Training - 01 introduction to frameworkPMP Training - 01 introduction to framework
PMP Training - 01 introduction to framework
 

Recently uploaded

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 

Recently uploaded (20)

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 

Introduction to JavaBeans Activation Framework v1.1

  • 1. JavaBeans Activation Framework (version 1.1) ejlp12@gmail.com Jan 2012
  • 2. The Spec said… With the 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.
  • 3. JAF JSR-925 Latest spec version is 1.1 It’s an old spec - released on April 2006 It’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 at http://www.oracle.com/technetwork/java/jaf-1-150219.pdf API documentation
  • 4. 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 type Source: JAF Specification v1.1
  • 5. 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 InputStream or OutputStream 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 implementation javax.mail.internet.MimePartDataSource
  • 6. 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
  • 7. 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 (RFC 1524) Command list available from a MIME Type is stored in CommandInfo object
  • 8. CommandObject interface Interface to be implemented by JavaBeans components that are Activation Framework aware Simple interface with one method: setCommandContext(String verb, DataHandler dh)
  • 9. 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 MimeBodyPart 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); ...
  • 10. JAF in use Another 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