1 16 package org.apache.cocoon.components.treeprocessor.sitemap; 17 18 import org.apache.avalon.framework.configuration.Configuration; 19 import org.apache.avalon.framework.configuration.ConfigurationException; 20 import org.apache.avalon.framework.thread.ThreadSafe; 21 import org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder; 22 import org.apache.cocoon.components.treeprocessor.ProcessingNode; 23 24 29 30 public class ActionSetNodeBuilder extends AbstractParentProcessingNodeBuilder implements ThreadSafe { 31 32 33 public static final String IN_ACTION_SET = ActionSetNodeBuilder.class.getName() + "/inActionSet"; 34 35 public ProcessingNode buildNode(Configuration config) throws Exception { 36 37 String actionSetName = config.getAttribute("name"); 38 39 Configuration[] childrenConfig = config.getChildren(); 40 this.treeBuilder.setAttribute(IN_ACTION_SET, Boolean.TRUE); 42 43 ProcessingNode[] nodes = this.buildChildNodes(config); 45 46 String [] actions = new String [nodes.length]; 48 for (int i = 0; i < childrenConfig.length; i++) { 49 Configuration childConfig = childrenConfig[i]; 50 String name = childConfig.getName(); 51 52 if ("act".equals(name)) { 53 actions[i] = childConfig.getAttribute("action", null); 54 } else { 55 String msg = "Unknown element " + name + " in action-set at " + childConfig.getLocation(); 57 throw new ConfigurationException(msg); 58 } 59 } 60 61 ActionSetNode node = new ActionSetNode(actionSetName, nodes, actions); 62 this.treeBuilder.setupNode(node, config); 63 64 this.treeBuilder.setAttribute(IN_ACTION_SET, null); 66 67 return node; 68 } 69 } 70 | Popular Tags |