Writing Beans for the Framework
The CommandMap Interface
Once the DataHandler has a MIME type describing the content, it can query the CommandMap for the operations, or commands that are available for that data type. The application requests commands available through the DataHandler and specifies a command on that list. The DataHandler uses the CommandMap to retrieve the Bean associated with that command. Some or all of the command map is stored in some ‘common’ place, like a .mailcap (RFC 1524) file. Other more complex implementations can be distributed, or can provide licensing or authentication features.
6.5 The CommandInfo Class
The CommandInfo class is used to represent commands in an underlying registry. From a CommandInfo object, an application can instantiate the Bean or request the verb (command) it describes.
6.6 The CommandObject Interface
Beans designed specifically for use with the JAF Architecture should implement the CommandObject interface. This interface provides direct access to DataHandler methods and notifies a JAF-aware Bean which verb was used to call it. Upon instantiation, the Bean takes a string specifying a user-selected command verb, and the DataHandler object managing the target data. The DataHandler takes a DataSource object, which provides an input stream linked to that data, and a string specifying the data type.
6.7 The DataContentHandlerFactory
Like the ContentHandler factory in the java.net package, the DataContentHandlerFactory is an interface that allows developers to write objects that map MIME types to DataContentHandlers. The interface is extremely simple, in order to allow developers as much design and implementation freedom as possible.
7.0 Writing Beans for the Framework
This section describes the specification of well-behaved JAF-aware Bean viewers. Note that this proposal assumes the reader is comfortable with the JavaBeans™ Specification. Developers intending to implement viewer Beans for the JAF should be familiar with JavaBeans™ concepts and architecture.
Make the implementation of viewers and editors as simple as implementing Beans. That is, require low cost of entry to be a good citizen.
Allow developers to have a certain amount of flexibility in their implementations.
13 of 21