Class MountTableMatcher

  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.matching.MountTableMatcher
All Implemented Interfaces:
Component, LogEnabled, Parameterizable, Serviceable, ThreadSafe, Matcher

public class MountTableMatcher
extends AbstractLogEnabled
implements Matcher, ThreadSafe, Serviceable, Parameterizable

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 prototypes and demos where installing a separate instance of Cocoon is overkill.

The mount table is an xml file which has a format similar to the map:mount syntax:

     <mount uri-prefix="foo" src="file://path/to/foo/directory/"/>
     <mount uri-prefix="bar/baz" src="file://path/to/bar-baz/directory/"/>
The matcher will scan the mount table for an "uri-prefix" value matching the beginning of the current request URI, and if found, succeed and populate the "src" and "uri-prefix" sitemap variables.

Usage in the sitemap is therefore as follows:

   <map:match type="mount-table" pattern="path/to/mount-table.xml">
     <map:mount uri-prefix="{uri-prefix}" src="{src}"/>

This matcher accepts a single configuration parameter, indicating if missing mount tables should be silently ignored (defaults is false, meaning "don't ignore"):

   <map:matcher type="mount-table" src="org.apache.cocoon.matching.MountTableMatcher">
     <map:parameter name="ignore-missing-tables" value="true"/>

This configuration is used in the main sitemap of Cocoon samples, to allow users to define their own mount table, but not fail if it does not exist.

$Id: MountTableMatcher.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Sylvain Wallez

Field Summary
Fields inherited from interface org.apache.cocoon.matching.Matcher
Constructor Summary
Method Summary
 Map match(String pattern, Map objectModel, Parameters parameters)
          Matches the pattern against some Request values and returns a Map object with replacements for wildcards contained in the pattern.
 void parameterize(Parameters params)
 void service(ServiceManager manager)
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MountTableMatcher()
Method Detail


public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable


public void parameterize(Parameters params)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable


public Map match(String pattern,
                 Map objectModel,
                 Parameters parameters)
          throws PatternException
Description copied from interface: Matcher
Matches the pattern against some Request values and returns a Map object with replacements for wildcards contained in the pattern.

Specified by:
match in interface Matcher
pattern - The pattern to match against. Depending on the implementation the pattern can contain wildcards or regular expressions.
objectModel - The Map with object of the calling environment which can be used to select values this matchers matches against.
Map The returned Map object with replacements for wildcards/regular-expressions contained in the pattern. If the return value is null there was no match.

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.