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 javax.xml.transform.Result;
20: import javax.xml.transform.sax.SAXResult;
21:
22: import org.apache.axiom.om.OMException;
23: import org.apache.axiom.soap.SOAPFactory;
24: import org.apache.axiom.soap.SOAPHeaderBlock;
25: import org.springframework.ws.soap.SoapHeaderElement;
26:
27: /** Axiom-specific version of <code>org.springframework.ws.soap.SoapHeaderHeaderElement</code>. */
28: class AxiomSoapHeaderElement extends AxiomSoapElement implements
29: SoapHeaderElement {
30:
31: public AxiomSoapHeaderElement(SOAPHeaderBlock axiomHeaderBlock,
32: SOAPFactory axiomFactory) {
33: super (axiomHeaderBlock, axiomFactory);
34: }
35:
36: public String getActorOrRole() {
37: return getAxiomHeaderBlock().getRole();
38: }
39:
40: public void setActorOrRole(String role) {
41: getAxiomHeaderBlock().setRole(role);
42: }
43:
44: public boolean getMustUnderstand() {
45: return getAxiomHeaderBlock().getMustUnderstand();
46: }
47:
48: public void setMustUnderstand(boolean mustUnderstand) {
49: getAxiomHeaderBlock().setMustUnderstand(mustUnderstand);
50: }
51:
52: public Result getResult() {
53: try {
54: return new SAXResult(new AxiomContentHandler(
55: getAxiomHeaderBlock()));
56: } catch (OMException ex) {
57: throw new AxiomSoapHeaderException(ex);
58: }
59:
60: }
61:
62: public String getText() {
63: return getAxiomHeaderBlock().getText();
64: }
65:
66: public void setText(String content) {
67: getAxiomHeaderBlock().setText(content);
68: }
69:
70: protected SOAPHeaderBlock getAxiomHeaderBlock() {
71: return (SOAPHeaderBlock) getAxiomElement();
72: }
73:
74: }
|