X hits on this document

PDF document

Bart Calder, Bill Shannon - page 16 / 21





16 / 21

16 of 21


Framework Integration Points

You’ve chosen the MIME type “application/x-wombat” to describe your Wombat file format, and you’ve chosen the filename extension “.wom” to be used by files containing Wombats.

To integrate with the framework, you’ll need some simple wrappers for your WombatBean for each command you want to implement. For example, for a Print command wrapper you can write the following code:

public class WombatPrintBean extends WombatBean { public WombatPrintBean() { super(); initPrinting();



You will need to create a mailcap file that lists the MIME type “application/x-wombat” and user visible commands that are supported by your WombatBean. Your WombatBean wrappers will be listed as the objects supporting each of these commands.

application/x-wombat; ; x-java-view=com.foo.WombatViewBean; \ x-java-edit=com.foo.WombatEditBean; \ x-java-print=com.foo.WombatPrintBean

You’ll also need to create a mime.types file with an entry: type=application/x-wombat desc=”Wombat” exts=wom

All of these components are packaged in a JAR file:

META-INF/mailcap META-INF/mime.types com/foo/WombatBean.class com/foo/WombatEditBean.class com/foo/WombatViewBean.class

Because everything is built into one Bean, and because no third party programmatic access to your Wombat objects is required, there’s no need for a DataContentHandler. Your WombatBean can therefore implement the Externalizable interface instead; and use its methods to read and write your Wombat files. The DataHandler can call the Externalizable methods when appropriate.


Your Wombat Editor product has really taken off, and you’re now adding significant new functionality and flexibility to your Wombat Editor. It’s no longer feasible to put everything into one giant Bean. Instead, you’ve broken the product into a number of Beans and other components:

  • A WombatViewer Bean that can be used to quickly view a Wombat in read-only mode.

  • A WombatEditor Bean that is heavier than the WombatViewer, but also allows editing.

Document info
Document views77
Page views77
Page last viewedThu Jan 19 19:22:24 UTC 2017