KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > treeprocessor > sitemap > FlowNodeBuilder


1 /*
2  * Copyright 1999-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder;
21 import org.apache.cocoon.components.treeprocessor.ProcessingNode;
22
23 /**
24  * Builder of a {@link FlowNode} instance, corresponding to a
25  * <code>&lt;map:flow&gt;</code> element in the sitemap.
26  *
27  * @author <a HREF="mailto:ovidiu@apache.org">Ovidiu Predescu</a>
28  * @since September 13, 2002
29  * @version CVS $Id: FlowNodeBuilder.java 290409 2005-09-20 10:12:53Z sylvain $
30  */

31 public class FlowNodeBuilder extends AbstractParentProcessingNodeBuilder {
32
33     public ProcessingNode buildNode(Configuration config)
34     throws Exception JavaDoc {
35         String JavaDoc language = config.getAttribute("language", "javascript");
36         FlowNode node = new FlowNode(language);
37
38         if ( !this.treeBuilder.registerNode("flow", node) ) {
39             throw new ConfigurationException("Only one <map:flow> is allowed in a sitemap. Another one is declared at " +
40                     config.getLocation());
41         }
42         this.treeBuilder.setupNode(node, config);
43
44         buildChildNodesList(config);
45
46         return node;
47     }
48 }
49
Popular Tags