X hits on this document

PDF document

Bart Calder, Bill Shannon - page 11 / 21





11 / 21

Primary Framework Interfaces

InputStreams. The DataHandler also constructs a DataSource for consumers that request it. The DataContentHandler mechanism is extended to also allow conversion from Objects to InputStreams.

The following code is an example of a data base front end using the JAF, which provides query results in terms of objects.


  • *

    Get the viewer to view my query results:

*/ Component getQueryViewer(QueryObject qo) throws Exception {

String mime_type = qo.getType(); Object q_result = qo.getResultObject(); DataHandler my_dh = new DataHandler(q_result

, mime type);


return (Component)my_dh.getCommand(“view”). getCommandObject(my_dh, null));


6.0 Primary Framework Interfaces

This section describes interfaces required to implement the JAF architecture introduced in Section Three.


The DataSource Interface

The DataSource interface is used by the DataHandler (and possibly other classes elsewhere) to access the underlying data. The DataSource object encapsulates the underlying data object in a class that abstracts the underlying data storage and typing mechanism, and presents its consumers with a common data access interface.

The JAF provides DataSource implementations that support file systems and URLs. Application system vendors can use the DataSource interface to implement their own specialized DataSource classes to support IMAP servers, object databases, or other sources.

There is a one-to-one correspondence between underlying data items (files for instance) and DataSource objects. Also note that the class that implements the DataSource interface is responsible for typing the data. To manage a file system, a DataSource can use a simple mechanism such as a file extension to type data, while a DataSource that supports incoming web-based data can actually examine the data stream to determine its type.

6.2 The DataHandler Class

The DataHandler class encapsulates a Data object, and provides methods which act on that data.

11 of 21

Document info
Document views87
Page views87
Page last viewedMon Jan 23 12:51:22 UTC 2017