X hits on this document

PDF document

Bart Calder, Bill Shannon - page 17 / 21





17 / 21


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

and components.

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.

Viewer Only

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

Document info
Document views43
Page views43
Page last viewedMon Oct 24 14:36:26 UTC 2016