14 of 21
Writing Beans for the Framework
We are attempting to limit the amount of extra baggage that needs to be implemented beyond ‘generic’ Beans. In many cases, JavaBeans™ components that weren’t developed with knowledge of the framework can be used. The JAF exploits the existing features of JavaBeans™ and the JDK™, and defines as few additional interfaces and policies as possible.
We expect that viewers/editors will be bound to data via a simple registry mechanism similar in function to a .mailcap file. In addition, mailcap format files may be bundled with components, allowing additional packages to be added at runtime.
Our viewers/editors and related classes and files are encapsulated into JAR files, as is the preferred method for JavaBeans™. The JAF does not restrict the choice of classes used to implement a JAF-aware ‘viewer’ Beans, beyond those expected of well-behaved Beans.
A viewer Bean that communicates directly with a JAF DataHandler should implement the CommandObject interface. This interface is small and easy to implement. However, Beans can still use standard Serialization and Externalization methods available in JDK 1.1 and later versions.
The JAF expects applications and viewer Beans to implement storage tasks via the DataSource object. However; it is possible to use Externalization. A JAF-aware application can implement the following storage mechanism:
= new ObjectOutputStream( data handler.getOutputStream());
_ my externalizable bean.writeExternal(oos);
The basic format for packaging of the Viewer/Editors is the JAR file as described in the JavaBeans™ Specification. This format allows the convenient packaging of collections of files that are related to a particular Bean or applet. For more information concerning integration points, see Section 8.
7.7 Container Support
The JAF is designed to be flexible enough to support the needs of a variety of applications. The JAF expects these applications to provide the appropriate containers and life cycle support for these Beans. Beans written for the framework should be compatible with the guidelines in the JavaBeans™ documentation and should be tested