|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
AttributedURI.java | 50% | 88.2% | 83.3% | 81.5% |
|
1 |
/*
|
|
2 |
* Copyright 1999-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 |
*/
|
|
17 |
|
|
18 |
package org.apache.axis.message.addressing;
|
|
19 |
|
|
20 |
import org.apache.axis.message.addressing.util.TextExtractor;
|
|
21 |
|
|
22 |
import org.apache.axis.types.URI;
|
|
23 |
|
|
24 |
import javax.xml.soap.SOAPEnvelope;
|
|
25 |
import javax.xml.soap.SOAPHeader;
|
|
26 |
import javax.xml.soap.SOAPElement;
|
|
27 |
import javax.xml.soap.SOAPHeaderElement;
|
|
28 |
import javax.xml.soap.Name;
|
|
29 |
import javax.xml.namespace.QName;
|
|
30 |
|
|
31 |
import java.util.Iterator;
|
|
32 |
import java.util.List;
|
|
33 |
import java.util.ArrayList;
|
|
34 |
|
|
35 |
import org.w3c.dom.Element;
|
|
36 |
import org.w3c.dom.Document;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Java content class for AttributedURI complex type.
|
|
40 |
* <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 105)
|
|
41 |
* <p>
|
|
42 |
* <pre>
|
|
43 |
* <complexType name="AttributedURI">
|
|
44 |
* <simpleContent>
|
|
45 |
* <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
|
|
46 |
* </extension>
|
|
47 |
* </simpleContent>
|
|
48 |
* </complexType>
|
|
49 |
* </pre>
|
|
50 |
*
|
|
51 |
* @author Davanum Srinivas (dims@yahoo.com)
|
|
52 |
*/
|
|
53 |
public class AttributedURI extends URI { |
|
54 |
|
|
55 |
/**
|
|
56 |
* Constructor AttributedURI
|
|
57 |
*
|
|
58 |
* @param uri
|
|
59 |
*/
|
|
60 | 96 |
public AttributedURI(URI uri) {
|
61 | 96 |
super(uri);
|
62 |
} |
|
63 |
|
|
64 |
/**
|
|
65 |
* Constructor Address
|
|
66 |
*
|
|
67 |
* @param uri
|
|
68 |
* @throws MalformedURIException
|
|
69 |
*/
|
|
70 | 4 |
public AttributedURI(String uri) throws MalformedURIException { |
71 | 4 |
this(new URI(uri)); |
72 |
} |
|
73 |
|
|
74 |
/**
|
|
75 |
* Constructor AttributedURI
|
|
76 |
*/
|
|
77 | 0 |
public AttributedURI() {
|
78 |
} |
|
79 |
|
|
80 |
/**
|
|
81 |
* Constructor AttributedURI
|
|
82 |
*
|
|
83 |
* @param el
|
|
84 |
* @throws Exception
|
|
85 |
*/
|
|
86 | 58 |
public AttributedURI(SOAPHeaderElement el)
|
87 |
throws Exception {
|
|
88 | 58 |
super(new URI(TextExtractor.getText(el))); |
89 |
} |
|
90 |
|
|
91 |
/**
|
|
92 |
* append DOM node to parent
|
|
93 |
*
|
|
94 |
* @param parent
|
|
95 |
*/
|
|
96 | 15 |
public void append(Element parent, String elementName) { |
97 | 15 |
Document doc = parent.getOwnerDocument(); |
98 | 15 |
Element child = doc.createElementNS(Constants.NS_URI_ADDRESSING_DEFAULT, elementName); |
99 | 15 |
child.appendChild(doc.createTextNode(toString())); |
100 | 15 |
parent.appendChild(child); |
101 |
} |
|
102 |
|
|
103 | 42 |
protected SOAPHeaderElement toSOAPHeaderElement(SOAPEnvelope env,
|
104 |
String actorURI, |
|
105 |
String name) |
|
106 |
throws Exception {
|
|
107 | 42 |
if (name == null) { |
108 | 0 |
throw new IllegalArgumentException("A null value for the name parameter is not allowed."); |
109 |
} |
|
110 | 42 |
Name nm = env.createName(name, |
111 |
Constants.NS_PREFIX_ADDRESSING, |
|
112 |
Constants.NS_URI_ADDRESSING_DEFAULT); |
|
113 | 42 |
SOAPHeader header = env.getHeader(); |
114 | 42 |
if (header == null) { |
115 | 0 |
header = env.addHeader(); |
116 |
} |
|
117 |
|
|
118 |
// add the new header element
|
|
119 | 42 |
SOAPHeaderElement headerElement = header.addHeaderElement(nm); |
120 | 42 |
headerElement.setActor(actorURI); |
121 | 42 |
headerElement.addTextNode(toString()); |
122 | 42 |
return headerElement;
|
123 |
} |
|
124 |
|
|
125 |
} |
|
126 |
|
|
127 |
|
|
128 |
|
|