org.apache.cocoon.selection
Class NamedPatternsSelector

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.selection.NamedPatternsSelector
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.Loggable, Selector, org.apache.avalon.framework.thread.ThreadSafe
Direct Known Subclasses:
BrowserSelector, HostSelector

public abstract class NamedPatternsSelector
extends org.apache.avalon.framework.logger.AbstractLoggable
implements org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.thread.ThreadSafe, Selector

Abstract class for selectors that select a value when it matches some patterns associated to the select expression.

Version:
CVS $Id: NamedPatternsSelector.java,v 1.5 2002/02/22 07:03:54 cziegeler Exp $
Author:
Sylvain Wallez
See Also:
BrowserSelector, HostSelector

Fields inherited from interface org.apache.cocoon.selection.Selector
ROLE
 
Constructor Summary
NamedPatternsSelector()
           
 
Method Summary
protected  boolean checkPatterns(java.lang.String expression, java.lang.String value)
          Checks if value is a substring of one of the patterns associated to expression
protected  void configure(org.apache.avalon.framework.configuration.Configuration conf, java.lang.String confName, java.lang.String nameAttr, java.lang.String valueAttr)
          Setup the association from expressions to a list of patterns.
 
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
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable
configure
 
Methods inherited from interface org.apache.cocoon.selection.Selector
select
 

Constructor Detail

NamedPatternsSelector

public NamedPatternsSelector()
Method Detail

configure

protected void configure(org.apache.avalon.framework.configuration.Configuration conf,
                         java.lang.String confName,
                         java.lang.String nameAttr,
                         java.lang.String valueAttr)
                  throws org.apache.avalon.framework.configuration.ConfigurationException
Setup the association from expressions to a list of patterns. The configuration should look like : <pre> <map:selector name="foo" src="..."> <confName nameAttr="expression" valueAttr="pattern"/> ... others (expression, pattern) associations ... </map:selector> </pre>
Parameters:
conf - the configuration
confName - the name of children of conf that will be used to build associations
nameAttr - the name of the attribute that holds the expression
valueAttr - the name of the attribute that holds the pattern

checkPatterns

protected boolean checkPatterns(java.lang.String expression,
                                java.lang.String value)
Checks if value is a substring of one of the patterns associated to expression
Parameters:
expression - the expression that is selected
value - the value to check
Returns:
true if value matches one of the patterns


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