KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 1999-2004 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.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 import org.apache.cocoon.generation.Generator;
24
25 import java.util.Collection JavaDoc;
26 import java.util.Map JavaDoc;
27
28 /**
29  *
30  * @author <a HREF="mailto:sylvain@apache.org">Sylvain Wallez</a>
31  * @version CVS $Id: GenerateNodeBuilder.java 30932 2004-07-29 17:35:38Z vgritsenko $
32  */

33
34 public class GenerateNodeBuilder extends AbstractProcessingNodeBuilder
35   implements LinkedProcessingNodeBuilder {
36
37     private GenerateNode node;
38
39     private Collection JavaDoc views;
40     private Map JavaDoc pipelineHints;
41
42     public ProcessingNode buildNode(Configuration config) throws Exception JavaDoc {
43
44         String JavaDoc type = this.treeBuilder.getTypeForStatement(config, Generator.ROLE + "Selector");
45
46         this.views = ((SitemapLanguage)this.treeBuilder).getViewsForStatement(Generator.ROLE, type, config);
47         this.pipelineHints = ((SitemapLanguage)this.treeBuilder).getHintsForStatement(Generator.ROLE, type, config);
48
49         this.node = new GenerateNode(
50             type,
51             VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager)
52         );
53         this.node.setPipelineHints(this.pipelineHints);
54         return this.treeBuilder.setupNode(this.node, config);
55     }
56
57     public void linkNode() throws Exception JavaDoc {
58         this.node.setViews(
59             ((SitemapLanguage)this.treeBuilder).getViewNodes(this.views)
60         );
61     }
62 }
63
Popular Tags