8 of 21
Using The Framework
externalization, or can implement the CommandObject interface to allow the typed data to be passed to it.
The JAF defines the CommandMap interface, which provides a flexible and extensible framework for the CommandMap. The CommandMap interface allows developers to develop their own solutions for discovering which commands are available on the system. A possible implementation can access the ‘types registry’ on the platform or use a server-based solution. The JAF provides a simple default solution based on RFC 1524 (.mailcap) like functionality. See “Deliverables” below.
3.4 The Command Object Interface
Beans extend the CommandObject interface in order to interact with JAF services. JAF- aware JavaBeans™ components can directly access their DataSource and DataHandler objects in order to retrieve the data type and to act on the data.
4.0 Using The Framework
We intend to make this infrastructure widely available for any Java™ Application that needs this functionality. The ‘canonical’ consumer of this framework accesses it through the DataHandler (although the major subsystems are designed to also operate independently). An underlying DataSource object is associated with the DataHandler when the DataHandler class is constructed.
The DataHandler retrieves the data typing information from the DataSource or gets the data type directly from the constructor.
Once this initialization step is complete, a list of commands that can be performed on the data item can be accessed from the DataHandler.
When an application issues a request for this list, the DataHandler uses the MIME data type specifier returned to request a list of available commands from the CommandMap object. The CommandMap has knowledge of available commands (implemented as Beans) and their supported data types. The CommandMap returns a subset of the full list of all commands based on the requested MIME type and the semantics of the CommandMap implementation, to the DataHandler.
When the application wishes to apply a command to some data, it is accomplished through the appropriate DataHandler interface, which uses the CommandMap to retrieve the appropriate Bean that is used to operate on the data. The container (user of the framework) makes the association between the data and the Bean.
5.0 Usage Scenarios
This scenario uses the example of a hypothetical file viewer application in order to illustrate the normal flow of tasks involved when implementing the JAF. The file viewer is similar to the Windows Explorer utility. When launched, it presents the user with a