46

I am unable to understand the purpose of JAF (Java Activation Framework). Please explain it to me in simple terms, or point me towards information.

The Java Mail API is using JAF. It looks like the JAF is used to find the supporting data types of an object. But I couldn't understand.

Please teach me!

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Manoj
  • 5,707
  • 19
  • 56
  • 86

3 Answers3

56

The JavaBeans Activation Framework is a library for abstracting the operating system specific bindings/mappings between file types and applications that deal with them. This can be based on MIME types and/or file extensions. It's really nothing more than that.

Open up Windows explorer and right click on a file. Various actions may be there (eg Open, Edit, Play). What actions are associated with the file is associated with the file extension on Windows. JAF is a portable version of that. It's mainly intended for desktop applications to be able to interact with whatever programs can be used with files on that computer.

Jesper
  • 202,709
  • 46
  • 318
  • 350
cletus
  • 616,129
  • 168
  • 910
  • 942
  • Thank you for explaining this; Wrapping my head around Oracle docs at times requires mental gymnastics. – Mushy Jun 17 '16 at 13:47
12

It's actually the JavaBeans Activation Framework and I think the docs explain it well:

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). For example, if a browser obtained a JPEG image, this framework would enable the browser to identify that stream of data as an JPEG image, and from that type, the browser could locate and instantiate an object that could manipulate, or view that image.

What parts of this paragraph are not clear to you?

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • You mean, if the stream of data is from JPEG, JAF will form an object of type JPEG to manipulate it.right? So in java mail api, it depends on JAF for the same purpose?Thanks. – Manoj Jun 21 '10 at 14:20
  • @Manoj, right -- JAF can internally use the "arbitrary piece of data"'s content-type, file extension, or whatever, to infer the type and instantiate the proper kind of Bean to operate on the data. – Alex Martelli Jun 21 '10 at 15:06
  • 2
    I think at times the Oracle docs so highly abstract concepts when as developers we are used to dealing with concrete semantics that it takes a second or third read. Even so, asking someone to lay it out in simplest terms. – Mushy Jun 17 '16 at 13:50
  • Seems like Tika. – Travis Spencer Jun 03 '17 at 15:37
5

OT: there is similar functionality in JDK7 (although certainly cannot be considered as full replacement)

Tomáš Záluský
  • 10,735
  • 2
  • 36
  • 64