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.axiom;
18:
19: import org.apache.axiom.om.OMException;
20: import org.apache.axiom.soap.SOAPFactory;
21: import org.apache.axiom.soap.SOAPFault;
22: import org.apache.axiom.soap.SOAPFaultDetail;
23: import org.apache.axiom.soap.SOAPFaultRole;
24: import org.apache.axiom.soap.SOAPProcessingException;
25: import org.springframework.ws.soap.SoapFault;
26: import org.springframework.ws.soap.SoapFaultDetail;
27:
28: /** @author Arjen Poutsma */
29: abstract class AxiomSoapFault extends AxiomSoapElement implements
30: SoapFault {
31:
32: protected AxiomSoapFault(SOAPFault axiomFault,
33: SOAPFactory axiomFactory) {
34: super (axiomFault, axiomFactory);
35: }
36:
37: public String getFaultActorOrRole() {
38: SOAPFaultRole faultRole = getAxiomFault().getRole();
39: return faultRole != null ? faultRole.getRoleValue() : null;
40: }
41:
42: public void setFaultActorOrRole(String actor) {
43: try {
44: SOAPFaultRole axiomFaultRole = getAxiomFactory()
45: .createSOAPFaultRole(getAxiomFault());
46: axiomFaultRole.setRoleValue(actor);
47: } catch (SOAPProcessingException ex) {
48: throw new AxiomSoapFaultException(ex);
49: }
50:
51: }
52:
53: public SoapFaultDetail getFaultDetail() {
54: try {
55: SOAPFaultDetail axiomFaultDetail = getAxiomFault()
56: .getDetail();
57: return axiomFaultDetail != null ? new AxiomSoapFaultDetail(
58: axiomFaultDetail, getAxiomFactory()) : null;
59: } catch (OMException ex) {
60: throw new AxiomSoapFaultException(ex);
61: }
62:
63: }
64:
65: public SoapFaultDetail addFaultDetail() {
66: try {
67: SOAPFaultDetail axiomFaultDetail = getAxiomFactory()
68: .createSOAPFaultDetail(getAxiomFault());
69: return new AxiomSoapFaultDetail(axiomFaultDetail,
70: getAxiomFactory());
71: } catch (OMException ex) {
72: throw new AxiomSoapFaultException(ex);
73: }
74:
75: }
76:
77: protected SOAPFault getAxiomFault() {
78: return (SOAPFault) getAxiomElement();
79: }
80:
81: }
|