views:

182

answers:

2

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!

+4  A: 

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.

cletus
Thanks for your response.
Manoj
+3  A: 

It's actually the Java*Beans* 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
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
@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
Thank you very much
Manoj