org.apache.cocoon.matching
Class AbstractRegexpMatcher

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.matching.AbstractPreparableMatcher
              |
              +--org.apache.cocoon.matching.AbstractRegexpMatcher
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.logger.Loggable, Matcher, PreparableMatcher, org.apache.avalon.framework.thread.ThreadSafe
Direct Known Subclasses:
RegexpHeaderMatcher, RegexpHostMatcher, RegexpParameterMatcher, RegexpRequestAttributeMatcher, RegexpRequestParameterMatcher, RegexpSessionAttributeMatcher, RegexpURIMatcher

public abstract class AbstractRegexpMatcher
extends AbstractPreparableMatcher
implements org.apache.avalon.framework.thread.ThreadSafe

Base class for all matchers using a regular expression pattern.

Version:
CVS $Id: AbstractRegexpMatcher.java,v 1.5.2.3 2002/07/15 14:42:49 cziegeler Exp $
Author:
Giacomo Pati, Berin Loritsch, Sylvain Wallez

Fields inherited from interface org.apache.cocoon.matching.Matcher
ROLE
 
Constructor Summary
AbstractRegexpMatcher()
           
 
Method Summary
protected abstract  java.lang.String getMatchString(java.util.Map objectModel, org.apache.avalon.framework.parameters.Parameters parameters)
          Get the string to test against the regular expression.
 java.util.Map preparedMatch(java.lang.Object preparedPattern, java.util.Map objectModel, org.apache.avalon.framework.parameters.Parameters parameters)
          Match the prepared pattern against the value returned by getMatchString(Map, Parameters).
 java.lang.Object preparePattern(java.lang.String pattern)
          Compile the pattern in a org.apache.regexp.REProgram.
 
Methods inherited from class org.apache.cocoon.matching.AbstractPreparableMatcher
match
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRegexpMatcher

public AbstractRegexpMatcher()
Method Detail

preparePattern

public java.lang.Object preparePattern(java.lang.String pattern)
                                throws PatternException
Compile the pattern in a org.apache.regexp.REProgram.
Following copied from interface: org.apache.cocoon.matching.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.
Throws:
a - PatternException if the pattern couldn't be prepared.

preparedMatch

public java.util.Map preparedMatch(java.lang.Object preparedPattern,
                                   java.util.Map objectModel,
                                   org.apache.avalon.framework.parameters.Parameters parameters)
Match the prepared pattern against the value returned by getMatchString(Map, Parameters).
Following copied from interface: org.apache.cocoon.matching.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.

getMatchString

protected abstract java.lang.String getMatchString(java.util.Map objectModel,
                                                   org.apache.avalon.framework.parameters.Parameters parameters)
Get the string to test against the regular expression. To be defined by concrete subclasses.


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.