I wrote a little goodie that hopefully will be very helpful to all of us: the MountTableMatcher. This is a matcher that manages a "mount table", allowing to add subsitemaps to a Cocoon application without modifying the main sitemap.
This is especially useful for two purposes:
- to mount external directories into Cocoon (demos, prototypes, projects) without having to change the main Cocoon sitemap. This allows these mounts to "survive" a update to a more recent version of Cocoon (e.g. "cvs update; build clean webapp").
- to mount the _source_ of Cocoon samples instead of their copy placed in build/webapp by the build process. This avoids many of the hassles related to editing a copy of the sources, often leading to sync problems.
The mount table is an xml file which as a format similar to the <map:mount> syntax:
<mount-table>
<mount uri-prefix="foo" src="file://path/to/foo/directory/"/>
<mount uri-prefix="bar/baz" src="file://path/to/bar-baz/directory/"/>
</mount-table>
Usage is straightforward:
<map:match type="mount-table" pattern="path/to/mount-table.xml">
<map:mount uri-prefix="{uri-prefix}" src="{src}"/>
</map:match>The main samples sitemap now uses a mount table located at the root of the Cocoon directory. It is not present by default (and ignored silently), but a "mount-table.xml.sample" is provided that just needs to be copied to "mount-table.xml".
Enjoy, Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com
