1 16 package org.apache.cocoon.components.treeprocessor.sitemap; 17 18 import org.apache.avalon.framework.configuration.Configuration; 19 import org.apache.cocoon.components.treeprocessor.AbstractProcessingNodeBuilder; 20 import org.apache.cocoon.components.treeprocessor.LinkedProcessingNodeBuilder; 21 import org.apache.cocoon.components.treeprocessor.ProcessingNode; 22 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory; 23 24 import org.apache.cocoon.serialization.Serializer; 25 26 import java.util.Collection ; 27 import java.util.Map ; 28 29 34 35 public class SerializeNodeBuilder extends AbstractProcessingNodeBuilder 36 implements LinkedProcessingNodeBuilder { 37 38 private SerializeNode node; 39 40 private Collection views; 41 private Map pipelineHints; 42 43 44 protected boolean hasParameters() { 45 return true; 46 } 47 48 public ProcessingNode buildNode(Configuration config) throws Exception { 49 50 String type = this.treeBuilder.getTypeForStatement(config, Serializer.ROLE + "Selector"); 51 52 this.views = ((SitemapLanguage)this.treeBuilder).getViewsForStatement(Serializer.ROLE, type, config); 53 this.pipelineHints = ((SitemapLanguage)this.treeBuilder).getHintsForStatement(Serializer.ROLE, type, config); 54 55 this.node = new SerializeNode( 56 type, 57 VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager), 58 VariableResolverFactory.getResolver(config.getAttribute("mime-type", null), this.manager), 59 config.getAttributeAsInteger("status-code", -1) 60 ); 61 this.node.setPipelineHints(this.pipelineHints); 62 return this.treeBuilder.setupNode(node, config); 63 } 64 65 public void linkNode() throws Exception { 66 this.node.setViews( 67 ((SitemapLanguage)this.treeBuilder).getViewNodes(this.views) 68 ); 69 } 70 } 71 | Popular Tags |