1 16 package org.apache.cocoon.matching; 17 18 import org.apache.avalon.framework.configuration.Configurable; 19 import org.apache.avalon.framework.configuration.Configuration; 20 import org.apache.avalon.framework.configuration.ConfigurationException; 21 import org.apache.avalon.framework.parameters.Parameters; 22 23 import java.util.Map ; 24 25 37 public class RegexpParameterMatcher extends AbstractRegexpMatcher 38 implements Configurable 39 { 40 private String defaultParam; 41 42 public void configure(Configuration config) throws ConfigurationException { 43 this.defaultParam = config.getChild("parameter-name").getValue(null); 44 } 45 46 protected String getMatchString(Map objectModel, Parameters parameters) { 47 48 String paramName = parameters.getParameter("parameter-name", this.defaultParam); 49 if (paramName == null) { 50 getLogger().warn("No parameter name given. FAILING"); 51 return null; 52 } 53 54 String result = parameters.getParameter(paramName, null); 55 if (result == null) { 56 getLogger().debug("Parameter '" + paramName + "' not set."); 57 } 58 59 return result; 60 } 61 } 62 | Popular Tags |