1 17 package org.apache.forrest.locationmap.lm; 18 19 import java.util.Map ; 20 21 import org.apache.avalon.framework.configuration.Configuration; 22 import org.apache.avalon.framework.configuration.ConfigurationException; 23 import org.apache.avalon.framework.service.ServiceManager; 24 import org.apache.cocoon.components.treeprocessor.InvokeContext; 25 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver; 26 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory; 27 import org.apache.cocoon.sitemap.PatternException; 28 29 38 public class LocationNode extends AbstractNode { 39 40 private final LocatorNode m_ln; 41 42 private VariableResolver m_src; 44 45 public LocationNode(final LocatorNode ln, final ServiceManager manager) { 46 super(manager); 47 m_ln = ln; 48 } 49 50 public void build(final Configuration configuration) throws ConfigurationException { 51 try { 52 m_src = VariableResolverFactory.getResolver( 53 configuration.getAttribute("src"), super.m_manager); 54 } catch (PatternException e) { 55 final String message = "Illegal pattern syntax at for location attribute 'src'" + 56 " at " + configuration.getLocation(); 57 throw new ConfigurationException(message,e); 58 } 59 } 60 61 64 public String locate(Map om, InvokeContext context) throws Exception { 65 return m_src.resolve(context, om); 66 } 67 68 } 69 | Popular Tags |