Framework Integration Points
A WombatPrinter Bean that simply prints a Wombat.
A component that reads and writes Wombat files.
A Wombat class that encapsulates the Wombat data and is used by your other Beans
In addition, customers have demanded to be able to programmatically manipulate Wombats, independently from the visual viewer or editor Beans. You’ll need to create a DataContentHandler that can convert a byte stream to and from a Wombat object. When reading, the WombatDataContentHandler reads a byte stream and returns a new Wombat object. When writing, the WombatDataContentHandler takes a Wombat object and produces a corresponding byte stream. You’ll need to publish the API to the Wombat class.
The WombatDataContentHandler is delivered as a class and is designated as a DataContentHandler that can operate on Wombats in the mailcap file included in your JAR file.
Your mailcap file changes to list the appropriate Wombat Beans, which implement user commands:
application/x-wombat; ; x-java-View=com.foo.WombatViewBean; \
x-java-print=com.foo.WombatPrintBean; \ x-java-content-handler=com.foo.WombatDataContentHandler
Your Wombat Beans can continue to implement the Externalizable interface, and thus read and write Wombat byte streams. They are more likely to simply operate on Wombat objects directly. To find the Wombat object they’re being invoked to operate on, they implement the CommandObject interface. The setCommandContext method refers them to the corresponding DataHandler, from which they can invoke the getContent method, which will return a Wombat object (produced by the WombatData- ContentHandler).
All components are packaged in a JAR file.
The Wombat product has been wildly successful. The ViewAll Company has decided that it can produce a Wombat viewer that’s much faster than the WombatViewer Bean. Since they don’t want to depend on the presence of any Wombat components, their viewer must parse the Wombat file format, which they reverse engineered.
The ViewAll WombatViewerBean implements the Externalizable interface to read the Wombat data format.
ViewAll delivers an appropriate mailcap file: application/x-wombat; ; x-java-view=com.viewall.WombatViewer
and mime.types file:
17 of 21