SlideShare ist ein Scribd-Unternehmen logo
1 von 11
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

Weitere Àhnliche Inhalte

Was ist angesagt?

Srilekha mule esb
Srilekha mule esbSrilekha mule esb
Srilekha mule esbsrilekha2820
 
Dataweave
DataweaveDataweave
Dataweavekrishashi
 
Mule message structure and varibles scopes
Mule message structure and varibles scopesMule message structure and varibles scopes
Mule message structure and varibles scopesRamakrishna kapa
 
Mule Expression Transformer
Mule Expression TransformerMule Expression Transformer
Mule Expression TransformerAnkush 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 ScalabilitySanchit Gera
 
Ashok mule esb
Ashok mule esbAshok mule esb
Ashok mule esbaskumar037
 
Sai mule esb batch
Sai mule esb batchSai mule esb batch
Sai mule esb batchsaikiran6423
 
Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsTechieVarsity
 

Was ist angesagt? (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
 

Andere mochten auch

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 Architectureejlp12
 
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 Optionsejlp12
 
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 & dockerejlp12
 
WebSphere Application Server Information Resources
WebSphere Application Server Information ResourcesWebSphere Application Server Information Resources
WebSphere Application Server Information Resourcesejlp12
 
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 Mobileejlp12
 
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 comparisonejlp12
 
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 PhonegapChristian 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.5IBM WebSphereIndia
 
IBM WebSphere Application Server (Clustering) Concept
IBM WebSphere Application Server (Clustering) ConceptIBM WebSphere Application Server (Clustering) Concept
IBM WebSphere Application Server (Clustering) Conceptejlp12
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introductionejlp12
 
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.0Bryan Basham
 

Andere mochten auch (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
 

Ähnlich wie 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, XMLKumar
 
Answer ado.net pre-exam2018
Answer ado.net pre-exam2018Answer ado.net pre-exam2018
Answer ado.net pre-exam2018than sare
 
Name services
Name servicesName services
Name servicesRajendran N
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceTrisha 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
 
Name Services
Name Services Name Services
Name Services _AmmarAjmal_
 
Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2Mindsmapped Consulting
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2javatrainingonline
 
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 2003Jason 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
 
NiFi - First approach
NiFi - First approachNiFi - First approach
NiFi - First approachMickael Cassy
 
RIA Data and Security, 2007
RIA Data and Security, 2007RIA Data and Security, 2007
RIA Data and Security, 2007Evgenios Skitsanos
 

Ähnlich wie 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
 

Mehr von 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 imageejlp12
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dumpejlp12
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
BPMN Introduction
BPMN IntroductionBPMN Introduction
BPMN Introductionejlp12
 
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
 

Mehr von 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
 

KĂŒrzlich hochgeladen

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

KĂŒrzlich hochgeladen (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

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