2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.shale.tiger.managed.rules;
19  
20  import org.apache.commons.digester.Rule;
21  import org.apache.shale.tiger.managed.config.NullValueHolder;
22  import org.xml.sax.Attributes;
23  
24  /***
25   * <p>Digester rule for processing a <code>&lt;null-value&gt;</code>
26   * element.</p>
27   */
28  public class NullValueRule extends Rule {
29  
30      /*** Creates a new instance of NullValueRule. */
31      public NullValueRule() {
32      }
33  
34      /***
35       * <p>Set the <code>nullValue</code> property on the containing
36       * <code>NullValueHolder</code>.</p>
37       *
38       * @param namespace Namespace URI of the matching element
39       * @param name Local name of the matching element
40       * @param attributes Attribute list of the matching element
41       *
42       * @exception Exception if a parsing error occurs
43       */
44      public void begin(String namespace, String name,
45                        Attributes attributes) throws Exception {
46  
47          NullValueHolder config = (NullValueHolder) digester.peek();
48          config.setNullValue(true);
49  
50      }
51  
52  
53      /***
54       * <p>No body processing for this element.</p>
55       *
56       * @param namespace Namespace URI of the matching element
57       * @param name Local name of the matching element
58       *
59       * @throws Exception if a parsing error occurs
60       */
61      public void body(String namespace, String name) throws Exception {
62      }
63  
64  
65      /***
66       * <p>No end processing for this element.</p>
67       *
68       * @param namespace Namespace URI of the matching element
69       * @param name Local name of the matching element
70       *
71       * @exception IllegalStateException if the popped object is not
72       *  of the correct type
73       * @exception Exception if a different error occurs
74       */
75      public void end(String namespace, String name) throws Exception {
76      }
77  
78  
79  }