org.apache.cocoon.matching
Class AbstractWildcardMatcher

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.matching.AbstractPreparableMatcher
          extended byorg.apache.cocoon.matching.AbstractWildcardMatcher
All Implemented Interfaces:
LogEnabled, Matcher, PreparableMatcher, ThreadSafe
Direct Known Subclasses:
CachingWildcardMatcher, WildcardHeaderMatcher, WildcardHostMatcher, WildcardMatcher, WildcardParameterMatcher, WildcardRequestAttributeMatcher, WildcardRequestParameterMatcher, WildcardSessionAttributeMatcher, WildcardURIMatcher

public abstract class AbstractWildcardMatcher
extends AbstractPreparableMatcher
implements ThreadSafe

Base class for wildcard matchers

Version:
CVS $Id: AbstractWildcardMatcher.java 30941 2004-07-29 19:56:58Z vgritsenko $
Author:
Sylvain Wallez

Field Summary
 
Fields inherited from interface org.apache.cocoon.matching.Matcher
ROLE
 
Constructor Summary
AbstractWildcardMatcher()
           
 
Method Summary
protected abstract  String getMatchString(Map objectModel, Parameters parameters)
          Get the string to test against the wildcard expression.
 Map preparedMatch(Object preparedPattern, Map objectModel, Parameters parameters)
          Match the prepared pattern against the result of getMatchString(Map, Parameters).
 Object preparePattern(String pattern)
          Compile the pattern in an int[].
 
Methods inherited from class org.apache.cocoon.matching.AbstractPreparableMatcher
match
 
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

AbstractWildcardMatcher

public AbstractWildcardMatcher()
Method Detail

preparePattern

public Object preparePattern(String pattern)
Compile the pattern in an int[].

Specified by:
preparePattern in interface PreparableMatcher
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.

preparedMatch

public Map preparedMatch(Object preparedPattern,
                         Map objectModel,
                         Parameters parameters)
                  throws PatternException
Match the prepared pattern against the result of getMatchString(Map, Parameters).

Specified by:
preparedMatch in interface PreparableMatcher
Parameters:
preparedPattern - The preparedPattern to match against, as returned by PreparableMatcher.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

getMatchString

protected abstract String getMatchString(Map objectModel,
                                         Parameters parameters)
Get the string to test against the wildcard expression. To be defined by concrete subclasses.



Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.