KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > treeprocessor > SimpleParentProcessingNode


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;
17
18 import org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode;
19 import org.apache.cocoon.components.treeprocessor.ProcessingNode;
20
21 import org.apache.cocoon.environment.Environment;
22
23 /**
24  * @author <a HREF="mailto:sylvain@apache.org">Sylvain Wallez</a>
25  * @version $Id: SimpleParentProcessingNode.java 157144 2005-03-11 20:13:26Z vgritsenko $
26  */

27 public abstract class SimpleParentProcessingNode extends AbstractParentProcessingNode {
28
29     /** The childrens of this matcher */
30     protected ProcessingNode[] children;
31
32     public void setChildren(ProcessingNode[] children) {
33         this.children = children;
34     }
35
36     /**
37      * Boolean method with returns true if this Node has children
38      * and false otherwise.
39      *
40      * @return boolean true if has children.
41      */

42     public boolean hasChildren() {
43         return this.children != null && this.children.length > 0;
44     }
45
46     /**
47      * Define common invoke behavior here
48      */

49     public boolean invoke(Environment env, InvokeContext context) throws Exception JavaDoc {
50         // Inform the pipeline (if available) that we have come across
51
// a possible branch point
52
if (context.pipelineIsSet() && hasChildren()) {
53             context.getProcessingPipeline().informBranchPoint();
54         }
55
56         // processing not yet complete, so return false
57
return false;
58     }
59 }
60
Popular Tags