21 |
|
|
22 |
package nongnu.cashews.language.grounding; |
package nongnu.cashews.language.grounding; |
23 |
|
|
24 |
|
import java.io.Serializable; |
25 |
|
|
26 |
|
import java.util.LinkedList; |
27 |
import java.util.List; |
import java.util.List; |
28 |
|
|
29 |
import javax.xml.namespace.QName; |
import javax.xml.namespace.QName; |
35 |
* @author Andrew John Hughes (gnu_andrew@member.fsf.org) |
* @author Andrew John Hughes (gnu_andrew@member.fsf.org) |
36 |
*/ |
*/ |
37 |
public class SoapMessage |
public class SoapMessage |
38 |
|
implements Serializable |
39 |
{ |
{ |
40 |
|
|
41 |
/** |
/** |
52 |
*/ |
*/ |
53 |
private List<MessagePart> parts; |
private List<MessagePart> parts; |
54 |
|
|
55 |
|
/** |
56 |
|
* Constructs a new SOAP message. |
57 |
|
*/ |
58 |
|
private SoapMessage() |
59 |
|
{ |
60 |
|
parts = new LinkedList<MessagePart>(); |
61 |
|
} |
62 |
|
|
63 |
|
/** |
64 |
|
* Constructs a new SOAP message with the specified qualified |
65 |
|
* name, constructed from the supplied namespace URI and |
66 |
|
* local part. |
67 |
|
* |
68 |
|
* @param namespaceURI the namespace URI of this SOAP message's name. |
69 |
|
* @param localPart the local part of this SOAP message's name. |
70 |
|
*/ |
71 |
|
public SoapMessage(String namespaceURI, String localPart) |
72 |
|
{ |
73 |
|
this(); |
74 |
|
setName(new QName(namespaceURI, localPart)); |
75 |
|
} |
76 |
|
|
77 |
|
/** |
78 |
|
* Constructs a new SOAP message with the specified qualified |
79 |
|
* name, constructed from the supplied namespace URI, local part |
80 |
|
* and prefix. |
81 |
|
* |
82 |
|
* @param namespaceURI the namespace URI of this SOAP message's name. |
83 |
|
* @param localPart the local part of this SOAP message's name. |
84 |
|
* @param prefix the prefix of this SOAP message's name. |
85 |
|
*/ |
86 |
|
public SoapMessage(String namespaceURI, String localPart, String prefix) |
87 |
|
{ |
88 |
|
this(); |
89 |
|
setName(namespaceURI, localPart, prefix); |
90 |
|
} |
91 |
|
|
92 |
|
/** |
93 |
|
* Constructs a new SOAP message with the specified name. |
94 |
|
* |
95 |
|
* @param name the name of this SOAP message. |
96 |
|
*/ |
97 |
|
public SoapMessage(QName name) |
98 |
|
{ |
99 |
|
this(); |
100 |
|
setName(name); |
101 |
|
} |
102 |
|
|
103 |
|
/** |
104 |
|
* Sets the qualified name of this SOAP message to that constructed |
105 |
|
* from the supplied namespace URI and local part. |
106 |
|
* |
107 |
|
* @param namespaceURI the namespace URI of this SOAP message's name. |
108 |
|
* @param localPart the local part of this SOAP message's name. |
109 |
|
*/ |
110 |
|
public void setName(String namespaceURI, String localPart) |
111 |
|
{ |
112 |
|
setName(new QName(namespaceURI, localPart)); |
113 |
|
} |
114 |
|
|
115 |
|
/** |
116 |
|
* Sets the qualified name of this SOAP message to that constructed |
117 |
|
* from the supplied namespace URI, local part and prefix. |
118 |
|
* |
119 |
|
* @param namespaceURI the namespace URI of this SOAP message's name. |
120 |
|
* @param localPart the local part of this SOAP message's name. |
121 |
|
* @param prefix the prefix of this SOAP message's name. |
122 |
|
*/ |
123 |
|
public void setName(String namespaceURI, String localPart, String prefix) |
124 |
|
{ |
125 |
|
setName(new QName(namespaceURI, localPart, prefix)); |
126 |
|
} |
127 |
|
|
128 |
|
/** |
129 |
|
* Sets the name of this SOAP message to that specified. |
130 |
|
* |
131 |
|
* @param name the name of this SOAP message. |
132 |
|
*/ |
133 |
|
public void setName(QName name) |
134 |
|
{ |
135 |
|
this.name = name; |
136 |
|
} |
137 |
|
|
138 |
|
/** |
139 |
|
* Adds a new part to the SOAP message. |
140 |
|
* |
141 |
|
* @param part the new part to add. |
142 |
|
*/ |
143 |
|
public boolean addPart(MessagePart part) |
144 |
|
{ |
145 |
|
if (part == null) |
146 |
|
return false; |
147 |
|
parts.add(part); |
148 |
|
return true; |
149 |
|
} |
150 |
|
|
151 |
|
/** |
152 |
|
* Retrieves the qualified name of this SOAP message. |
153 |
|
* |
154 |
|
* @return the qualified name of this SOAP message. |
155 |
|
*/ |
156 |
|
public QName getName() |
157 |
|
{ |
158 |
|
return name; |
159 |
|
} |
160 |
|
|
161 |
|
/** |
162 |
|
* Returns a <code>String</code> representation of this SOAP message. |
163 |
|
* |
164 |
|
* @return a textual representation. |
165 |
|
*/ |
166 |
|
public String toString() |
167 |
|
{ |
168 |
|
return getClass().getName() + |
169 |
|
"[name=" + |
170 |
|
name + |
171 |
|
",parts=" + |
172 |
|
parts + |
173 |
|
"]"; |
174 |
|
} |
175 |
|
|
176 |
} |
} |
177 |
|
|