01: /*
02: * Copyright 2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.springframework.ws.soap.saaj;
18:
19: import javax.xml.namespace.QName;
20: import javax.xml.soap.Detail;
21: import javax.xml.soap.SOAPException;
22: import javax.xml.soap.SOAPFault;
23:
24: import org.springframework.ws.soap.SoapFault;
25: import org.springframework.ws.soap.SoapFaultDetail;
26:
27: /**
28: * SAAJ-specific abstract base class of the <code>SoapFault</code> interface. Wraps a {@link javax.xml.soap.SOAPFault}.
29: *
30: * @author Arjen Poutsma
31: * @since 1.0.0
32: */
33: abstract class SaajSoapFault extends SaajSoapElement implements
34: SoapFault {
35:
36: protected SaajSoapFault(SOAPFault fault) {
37: super (fault);
38: }
39:
40: public QName getFaultCode() {
41: return getImplementation().getFaultCode(getSaajFault());
42: }
43:
44: protected SOAPFault getSaajFault() {
45: return (SOAPFault) getSaajElement();
46: }
47:
48: public SoapFaultDetail getFaultDetail() {
49: Detail saajDetail = getImplementation().getFaultDetail(
50: getSaajFault());
51: return saajDetail == null ? null : new SaajSoapFaultDetail(
52: saajDetail);
53: }
54:
55: public SoapFaultDetail addFaultDetail() {
56: try {
57: Detail saajDetail = getImplementation().addFaultDetail(
58: getSaajFault());
59: return new SaajSoapFaultDetail(saajDetail);
60: } catch (SOAPException ex) {
61: throw new SaajSoapFaultException(ex);
62: }
63: }
64: }
|