org.apache.cocoon.matching
Class MountTableMatcher

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.matching.MountTableMatcher
All Implemented Interfaces:
org.apache.cocoon.matching.Matcher, Parameterizable, Serviceable, ThreadSafe

public class MountTableMatcher
extends org.apache.cocoon.util.AbstractLogEnabled
implements org.apache.cocoon.matching.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-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>
 
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}"/>
   </map:match>
 

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"/>
   </map:matcher>
 

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.

Version:
$Id: MountTableMatcher.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
 
Fields inherited from interface org.apache.cocoon.matching.Matcher
ROLE
 
Constructor Summary
MountTableMatcher()
           
 
Method Summary
 Map match(String pattern, Map objectModel, Parameters parameters)
           
 void parameterize(Parameters params)
           
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MountTableMatcher

public MountTableMatcher()
Method Detail

service

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

parameterize

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

match

public Map match(String pattern,
                 Map objectModel,
                 Parameters parameters)
          throws org.apache.cocoon.sitemap.PatternException
Specified by:
match in interface org.apache.cocoon.matching.Matcher
Throws:
org.apache.cocoon.sitemap.PatternException


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.