KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3  * Copyright 2001-2004 The Apache Software Foundation.
4
5  *
6
7  * Licensed under the Apache License, Version 2.0 (the "License");
8
9  * you may not use this file except in compliance with the License.
10
11  * You may obtain a copy of the License at
12
13  *
14
15  * http://www.apache.org/licenses/LICENSE-2.0
16
17  *
18
19  * Unless required by applicable law or agreed to in writing, software
20
21  * distributed under the License is distributed on an "AS IS" BASIS,
22
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
25  * See the License for the specific language governing permissions and
26
27  * limitations under the License.
28
29  */

30
31 package org.jboss.axis.message;
32
33
34 import org.jboss.axis.Constants;
35 import org.jboss.axis.encoding.Callback;
36 import org.jboss.axis.encoding.CallbackTarget;
37 import org.jboss.axis.encoding.DeserializationContext;
38 import org.jboss.axis.encoding.Deserializer;
39 import org.xml.sax.Attributes JavaDoc;
40 import org.xml.sax.SAXException JavaDoc;
41
42 import javax.xml.namespace.QName JavaDoc;
43
44
45 /**
46  * Build a Fault body element.
47  *
48  * @author Sam Ruby (rubys@us.ibm.com)
49  * @author Glen Daniels (gdaniels@apache.org)
50  * @author Tom Jordahl (tomj@macromedia.com)
51  */

52
53 public class SOAPFaultCodeBuilder extends SOAPHandler implements Callback
54
55 {
56
57    // Fault data
58

59    protected QName JavaDoc faultCode = null;
60
61    protected SOAPFaultCodeBuilder next = null;
62
63
64    public SOAPFaultCodeBuilder()
65    {
66
67    }
68
69
70    public QName JavaDoc getFaultCode()
71    {
72
73       return faultCode;
74
75    }
76
77
78    public SOAPFaultCodeBuilder getNext()
79    {
80
81       return next;
82
83    }
84
85
86    public SOAPHandler onStartChild(String JavaDoc namespace,
87
88                                    String JavaDoc name,
89
90                                    String JavaDoc prefix,
91
92                                    Attributes JavaDoc attributes,
93
94                                    DeserializationContext context)
95
96            throws SAXException JavaDoc
97
98    {
99
100
101       QName JavaDoc thisQName = new QName JavaDoc(namespace, name);
102
103       if (thisQName.equals(Constants.QNAME_FAULTVALUE_SOAP12))
104       {
105
106          Deserializer currentDeser = null;
107
108          currentDeser = context.getDeserializerForType(Constants.XSD_QNAME);
109
110          if (currentDeser != null)
111          {
112
113             currentDeser.registerValueTarget(new CallbackTarget(this, thisQName));
114
115          }
116
117          return (SOAPHandler)currentDeser;
118
119       }
120       else if (thisQName.equals(Constants.QNAME_FAULTSUBCODE_SOAP12))
121       {
122
123          return (next = new SOAPFaultCodeBuilder());
124
125       }
126       else
127
128          return null;
129
130    }
131
132
133
134    /*
135
136     * Defined by Callback.
137
138     * This method gets control when the callback is invoked.
139
140     * @param is the value to set.
141
142     * @param hint is an Object that provide additional hint information.
143
144     */

145
146    public void setValue(Object JavaDoc value, Object JavaDoc hint)
147    {
148
149       QName JavaDoc thisQName = (QName JavaDoc)hint;
150
151       if (thisQName.equals(Constants.QNAME_FAULTVALUE_SOAP12))
152       {
153
154          faultCode = (QName JavaDoc)value;
155
156       }
157
158    }
159
160 }
161
162
Popular Tags