org.apache.cocoon.matching
Interface PreparableMatcher

All Superinterfaces:
Matcher

public interface PreparableMatcher
extends Matcher

A matcher that can prepare patterns during sitemap setup for faster match at request time. This is also a regular matcher, meaning the sitemap can decide either to prepare the pattern or to match with a request-time evaluated pattern (for {..} substitution).

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

Field Summary
 
Fields inherited from interface org.apache.cocoon.matching.Matcher
ROLE
 
Method Summary
 Map preparedMatch(Object preparedPattern, Map objectModel, Parameters parameters)
          Matches the prepared pattern against some values in the object model (most often the Request) and returns a Map object with replacements for wildcards contained in the pattern.
 Object preparePattern(String pattern)
          Prepares a pattern in a form that allows faster match.
 
Methods inherited from interface org.apache.cocoon.matching.Matcher
match
 

Method Detail

preparePattern

public Object preparePattern(String pattern)
                      throws PatternException
Prepares a pattern in a form that allows faster match. For example, a regular expression matcher can precompile the expression and return the corresponding object. This method is called once for each pattern used with a particular matcher class. The returned value is then passed back as the preparedPattern parameter of preparedMatch(Object, Map, Parameters).

Parameters:
pattern - The pattern to prepare. Depending on the implementation the pattern can contain wildcards or regular expressions.
Returns:
an optimized representation of the pattern.
Throws:
PatternException - if the pattern couldn't be prepared.

preparedMatch

public Map preparedMatch(Object preparedPattern,
                         Map objectModel,
                         Parameters parameters)
                  throws PatternException
Matches the prepared pattern against some values in the object model (most often the Request) and returns a Map object with replacements for wildcards contained in the pattern.

Parameters:
preparedPattern - The preparedPattern to match against, as returned by preparePattern(String).
objectModel - The Map with objects of the calling environment which can be used to select values this matchers matches against.
Returns:
a Map object with replacements for wildcards/regular-expressions contained in the pattern. If the return value is null there was no match.
Throws:
PatternException


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