KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > message > SOAPFaultCodeBuilder


1 /*
2  * Copyright 2001-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.axis.message;
17
18 import org.apache.axis.Constants;
19 import org.apache.axis.encoding.Callback;
20 import org.apache.axis.encoding.CallbackTarget;
21 import org.apache.axis.encoding.DeserializationContext;
22 import org.apache.axis.encoding.Deserializer;
23 import org.xml.sax.Attributes JavaDoc;
24 import org.xml.sax.SAXException JavaDoc;
25
26 import javax.xml.namespace.QName JavaDoc;
27
28 /**
29  * Build a Fault body element.
30  *
31  * @author Sam Ruby (rubys@us.ibm.com)
32  * @author Glen Daniels (gdaniels@apache.org)
33  * @author Tom Jordahl (tomj@macromedia.com)
34  */

35 public class SOAPFaultCodeBuilder extends SOAPHandler implements Callback
36 {
37     // Fault data
38
protected QName JavaDoc faultCode = null;
39     protected SOAPFaultCodeBuilder next = null;
40
41     public SOAPFaultCodeBuilder() {
42     }
43
44     public QName JavaDoc getFaultCode() {
45         return faultCode;
46     }
47
48     public SOAPFaultCodeBuilder getNext() {
49         return next;
50     }
51
52     public SOAPHandler onStartChild(String JavaDoc namespace,
53                                     String JavaDoc name,
54                                     String JavaDoc prefix,
55                                     Attributes JavaDoc attributes,
56                                     DeserializationContext context)
57         throws SAXException JavaDoc
58     {
59
60         QName JavaDoc thisQName = new QName JavaDoc(namespace, name);
61         if (thisQName.equals(Constants.QNAME_FAULTVALUE_SOAP12)) {
62             Deserializer currentDeser = null;
63             currentDeser = context.getDeserializerForType(Constants.XSD_QNAME);
64             if (currentDeser != null) {
65                 currentDeser.registerValueTarget(new CallbackTarget(this, thisQName));
66             }
67             return (SOAPHandler)currentDeser;
68         } else if (thisQName.equals(Constants.QNAME_FAULTSUBCODE_SOAP12)) {
69             return (next = new SOAPFaultCodeBuilder());
70         } else
71             return null;
72     }
73
74     /*
75      * Defined by Callback.
76      * This method gets control when the callback is invoked.
77      * @param is the value to set.
78      * @param hint is an Object that provide additional hint information.
79      */

80     public void setValue(Object JavaDoc value, Object JavaDoc hint) {
81         QName JavaDoc thisQName = (QName JavaDoc)hint;
82         if (thisQName.equals(Constants.QNAME_FAULTVALUE_SOAP12)) {
83             faultCode = (QName JavaDoc)value;
84         }
85     }
86 }
87
Popular Tags