View Javadoc

1   /****************************************************************
2    * Licensed to the Apache Software Foundation (ASF) under one   *
3    * or more contributor license agreements.  See the NOTICE file *
4    * distributed with this work for additional information        *
5    * regarding copyright ownership.  The ASF licenses this file   *
6    * to you under the Apache License, Version 2.0 (the            *
7    * "License"); you may not use this file except in compliance   *
8    * with the License.  You may obtain a copy of the License at   *
9    *                                                              *
10   *   http://www.apache.org/licenses/LICENSE-2.0                 *
11   *                                                              *
12   * Unless required by applicable law or agreed to in writing,   *
13   * software distributed under the License is distributed on an  *
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15   * KIND, either express or implied.  See the License for the    *
16   * specific language governing permissions and limitations      *
17   * under the License.                                           *
18   ****************************************************************/
19  package org.apache.jsieve.util;
20  
21  import org.apache.jsieve.parser.generated.ASTargument;
22  import org.apache.jsieve.parser.generated.ASTarguments;
23  import org.apache.jsieve.parser.generated.ASTblock;
24  import org.apache.jsieve.parser.generated.ASTcommand;
25  import org.apache.jsieve.parser.generated.ASTcommands;
26  import org.apache.jsieve.parser.generated.ASTstart;
27  import org.apache.jsieve.parser.generated.ASTstring;
28  import org.apache.jsieve.parser.generated.ASTstring_list;
29  import org.apache.jsieve.parser.generated.ASTtest;
30  import org.apache.jsieve.parser.generated.ASTtest_list;
31  import org.apache.jsieve.parser.generated.SimpleNode;
32  
33  /**
34   * Presents a low level reporting view of a Sieve node tree.
35   * Familiarity with the 
36   * <a href='http://james.apache.org/jsieve/'>JSieve</a> implementation is assumed.
37   * Anyone requiring a high level view should see {@link SieveHandler}.
38   * 
39   * @see NodeTraverser
40   * @see SieveHandler
41   */
42  public interface NodeHandler {
43      
44      /**
45       * Starts a tree traversal.
46       * @throws HaltTraversalException
47       */
48      public void start() throws HaltTraversalException;
49      
50      /**
51       * Ends a tree traveral.
52       * @throws HaltTraversalException
53       */
54      public void end() throws HaltTraversalException;
55      
56      /**
57       * Starts traversal of given node.
58       * @param node not null
59       * @throws HaltTraversalException
60       */
61      public void start(SimpleNode node) throws HaltTraversalException;
62      
63      /**
64       * Ends traversal of given node.
65       * @param node not null
66       * @throws HaltTraversalException
67       */
68      public void end(SimpleNode node) throws HaltTraversalException;
69      
70      /**
71       * Starts traversal of given node.
72       * @param node not null
73       * @throws HaltTraversalException
74       */
75      public void start(ASTstart node) throws HaltTraversalException;
76      
77      /**
78       * Ends traversal of given node.
79       * @param node not null
80       * @throws HaltTraversalException
81       */
82      public void end(ASTstart node) throws HaltTraversalException;
83  
84      /**
85       * Starts traversal of given node.
86       * @param node not null
87       * @throws HaltTraversalException
88       */
89      public void start(ASTcommands node) throws HaltTraversalException;
90      
91      /**
92       * Ends traversal of given node.
93       * @param node not null
94       * @throws HaltTraversalException
95       */
96      public void end(ASTcommands node) throws HaltTraversalException;
97  
98      /**
99       * Starts traversal of given node.
100      * @param node not null
101      * @throws HaltTraversalException
102      */
103     public void start(ASTcommand node) throws HaltTraversalException;
104     
105     /**
106      * Ends traversal of given node.
107      * @param node not null
108      * @throws HaltTraversalException
109      */
110     public void end(ASTcommand node) throws HaltTraversalException;
111 
112     /**
113      * Starts traversal of given node.
114      * @param node not null
115      * @throws HaltTraversalException
116      */
117     public void start(ASTblock node) throws HaltTraversalException;
118     
119     /**
120      * Ends traversal of given node.
121      * @param node not null
122      * @throws HaltTraversalException
123      */
124     public void end(ASTblock node) throws HaltTraversalException;
125 
126     /**
127      * Starts traversal of given node.
128      * @param node not null
129      * @throws HaltTraversalException
130      */
131     public void start(ASTarguments node) throws HaltTraversalException;
132     
133     /**
134      * Ends traversal of given node.
135      * @param node not null
136      * @throws HaltTraversalException
137      */
138     public void end(ASTarguments node) throws HaltTraversalException;
139 
140     /**
141      * Starts traversal of given node.
142      * @param node not null
143      * @throws HaltTraversalException
144      */
145     public void start(ASTargument node) throws HaltTraversalException;
146     
147     /**
148      * Ends traversal of given node.
149      * @param node not null
150      * @throws HaltTraversalException
151      */
152     public void end(ASTargument node) throws HaltTraversalException;
153 
154     /**
155      * Starts traversal of given node.
156      * @param node not null
157      * @throws HaltTraversalException
158      */
159     public void start(ASTtest node) throws HaltTraversalException;
160     
161     /**
162      * Ends traversal of given node.
163      * @param node not null
164      * @throws HaltTraversalException
165      */
166     public void end(ASTtest node) throws HaltTraversalException;
167 
168     /**
169      * Starts traversal of given node.
170      * @param node not null
171      * @throws HaltTraversalException
172      */
173     public void start(ASTtest_list node) throws HaltTraversalException;
174     
175     /**
176      * Ends traversal of given node.
177      * @param node not null
178      * @throws HaltTraversalException
179      */
180     public void end(ASTtest_list node) throws HaltTraversalException;
181 
182     /**
183      * Starts traversal of given node.
184      * @param node not null
185      * @throws HaltTraversalException
186      */
187     public void start(ASTstring node) throws HaltTraversalException;
188     
189     /**
190      * Ends traversal of given node.
191      * @param node not null
192      * @throws HaltTraversalException
193      */
194     public void end(ASTstring node) throws HaltTraversalException;
195 
196     /**
197      * Starts traversal of given node.
198      * @param node not null
199      * @throws HaltTraversalException
200      */
201     public void start(ASTstring_list node) throws HaltTraversalException;
202     
203     /**
204      * Ends traversal of given node.
205      * @param node not null
206      * @throws HaltTraversalException
207      */
208     public void end(ASTstring_list node) throws HaltTraversalException;
209 }