1 mike 1.21 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.21.2.1 // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 mike 1.21 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
|
26 kumpf 1.21.2.1 // Modified By:
27 // Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
|
28 mike 1.21 //
|
29 kumpf 1.21.2.6 // Nag Boranna, Hewlett-Packard Company(nagaraja_boranna@hp.com)
30 //
|
31 mike 1.21 //%/////////////////////////////////////////////////////////////////////////////
32
33 #ifndef Pegasus_XmlWriter_h
34 #define Pegasus_XmlWriter_h
35
36 #include <iostream>
37 #include <Pegasus/Common/Config.h>
38 #include <Pegasus/Common/Exception.h>
39 #include <Pegasus/Common/Array.h>
40 #include <Pegasus/Common/String.h>
41 #include <Pegasus/Common/Indentor.h>
42 #include <Pegasus/Common/CIMReference.h>
43
44 PEGASUS_NAMESPACE_BEGIN
45
46 class CIMConstQualifierDecl;
47 class CIMConstClass;
48 class CIMConstInstance;
49
50 class PEGASUS_COMMON_LINKAGE XmlWriter
51 {
52 mike 1.21 public:
53
54 static void append(Array<Sint8>& out, Char16 x);
55
56 static void append(Array<Sint8>& out, char x)
57 {
58 append(out, Char16(x));
59 }
60
61 static void append(Array<Sint8>& out, const char* x);
62
63 static void append(Array<Sint8>& out, const String& x);
64
65 static void append(Array<Sint8>& out, Uint32 x);
66
67 static void appendSpecial(Array<Sint8>& out, Char16 x);
68
69 static void appendSpecial(Array<Sint8>& out, char x);
70
71 static void appendSpecial(Array<Sint8>& out, const char* x);
72
73 mike 1.21 static void appendSpecial(Array<Sint8>& out, const String& x);
74
75 static void append(Array<Sint8>& out, const Indentor& x);
76
77 static void appendLocalNameSpaceElement(
78 Array<Sint8>& out,
79 const String& nameSpace);
80
81 static void appendNameSpaceElement(
82 Array<Sint8>& out,
83 const String& nameSpace);
84
85 static Array<Sint8> formatGetHeader(
86 const char* documentPath);
87
88 static Array<Sint8> formatMPostHeader(
89 const char* host,
90 const char* cimOperation,
91 const char* cimMethod,
92 const String& cimObject,
|
93 kumpf 1.21.2.6 const String& authenticationHeader,
|
94 mike 1.21 const Array<Sint8>& content);
95
96 static Array<Sint8> formatMethodResponseHeader(
97 const Array<Sint8>& content);
98
99 static Array<Sint8> formatMessageElement(
100 const String& messageId,
101 const Array<Sint8>& body);
102
103 static Array<Sint8> formatSimpleReqElement(
104 const Array<Sint8>& body);
105
106 static Array<Sint8> formatSimpleRspElement(
107 const Array<Sint8>& body);
108
109 static Array<Sint8> formatIMethodCallElement(
110 const char* name,
111 const String& nameSpace,
112 const Array<Sint8>& iParamValues);
113
114 static Array<Sint8> formatIReturnValueElement(
115 mike 1.21 const Array<Sint8>& body);
116
117 static Array<Sint8> formatIMethodResponseElement(
118 const char* name,
119 const Array<Sint8>& iParamValues);
120
121 static Array<Sint8>& formatIParamValueElement(
122 Array<Sint8>& out,
123 const char* name,
124 const Array<Sint8>& body);
125
126 static Array<Sint8> formatErrorElement(
127 CIMStatusCode code,
128 const char* description);
129
130 static Array<Sint8>& appendBooleanParameter(
131 Array<Sint8>& out,
132 const char* parameterName,
133 Boolean flag);
134
|
135 kumpf 1.21.2.4 static Array<Sint8>& appendStringIParameter(
|
136 mike 1.21 Array<Sint8>& out,
137 const char* parameterName,
138 const String& str);
139
140 static Array<Sint8>& appendClassNameParameter(
141 Array<Sint8>& out,
142 const char* parameterName,
143 const String& className);
144
145 static Array<Sint8>& appendQualifierNameParameter(
146 Array<Sint8>& out,
147 const char* parameterName,
148 const String& qualifierName);
149
150 static Array<Sint8>& appendClassParameter(
151 Array<Sint8>& out,
152 const char* parameterName,
153 const CIMConstClass& cimClass);
154
155 static Array<Sint8>& appendInstanceNameParameter(
156 Array<Sint8>& out,
157 mike 1.21 const char* parameterName,
158 const CIMReference& instanceName);
159
160 static Array<Sint8>& appendInstanceParameter(
161 Array<Sint8>& out,
162 const char* parameterName,
163 const CIMConstInstance& instance);
164
165 static Array<Sint8>& appendQualifierDeclarationParameter(
166 Array<Sint8>& out,
167 const char* parameterName,
168 const CIMConstQualifierDecl& qualifierDecl);
169
170 static Array<Sint8>& appendClassNameElement(
171 Array<Sint8>& out,
172 const String& className);
173
174 static Array<Sint8>& appendInstanceNameElement(
175 Array<Sint8>& out,
176 const CIMReference& instanceName);
177
178 mike 1.21 static Array<Sint8>& appendPropertyNameParameter(
179 Array<Sint8>& out,
180 const String& propertyName);
181
|
182 kumpf 1.21.2.5 static Array<Sint8>& appendPropertyValueParameter(
183 Array<Sint8>& out,
184 const char* parameterName,
185 const CIMValue& value);
186
187 static Array<Sint8>& appendPropertyListParameter(
188 Array<Sint8>& out,
189 const Array<String>& propertyList);
190
|
191 mike 1.21 static Array<Sint8>& appendObjectNameParameter(
192 Array<Sint8>& out,
193 const char* name,
194 const CIMReference& objectName);
195
196 static void indentedPrint(
197 PEGASUS_STD(ostream)& os,
198 const char* text,
199 Uint32 indentChars = 2);
200
|
201 kumpf 1.21.2.4 static Array<Sint8> formatSimpleIMethodReqMessage(
|
202 mike 1.21 const char* host,
203 const String& nameSpace,
204 const char* iMethodName,
|
205 mike 1.21.2.2 const String& messageId,
|
206 kumpf 1.21.2.6 const String& authenticationHeader,
|
207 mike 1.21 const Array<Sint8>& body);
208
209 static Array<Sint8> formatSimpleRspMessage(
210 const char* iMethodName,
211 const String& messageId,
212 const Array<Sint8>& body);
213
214 static String getNextMessageId();
|
215 kumpf 1.21.2.3
|
216 kumpf 1.21.2.1 static Array<Sint8> formatSimpleIndicationReqMessage(
217 const char* host,
218 const char* iMethodName,
|
219 mike 1.21.2.2 const String& messageId,
|
220 kumpf 1.21.2.6 const String& authenticationHeader,
|
221 kumpf 1.21.2.1 const Array<Sint8>& body);
222
223 static Array<Sint8> formatEMethodCallElement(
224 const char* name,
225 const Array<Sint8>& iParamValues);
226
227 static Array<Sint8> formatMPostIndicationHeader(
228 const char* host,
229 const char* cimOperation,
230 const char* cimMethod,
|
231 kumpf 1.21.2.6 const String& authenticationHeader,
|
232 kumpf 1.21.2.1 const Array<Sint8>& content);
233
234 static Array<Sint8> formatSimpleExportReqElement(
235 const Array<Sint8>& body);
|
236 kumpf 1.21.2.3
237 static Array<Sint8> formatSimpleExportRspElement(
238 const Array<Sint8>& body);
239
240 static Array<Sint8> formatSimpleIndicationRspMessage(
241 const char* iMethodName,
242 const String& messageId,
243 const Array<Sint8>& body);
244
245 static Array<Sint8> formatEMethodResponseElement(
246 const char* name,
247 const Array<Sint8>& iParamValues);
248
249 static Array<Sint8> formatEMethodResponseHeader(
250 const Array<Sint8>& content);
|
251 kumpf 1.21.2.4
252 static Array<Sint8> formatSimpleMethodReqMessage(
253 const char* host,
254 const String& nameSpace,
255 const char* iMethodName,
256 const String& messageId,
|
257 kumpf 1.21.2.6 const String& authenticationHeader,
|
258 kumpf 1.21.2.4 const Array<Sint8>& body);
259
260 static Array<Sint8> formatMethodCallElement(
261 const char* name,
262 const String& nameSpace,
263 const Array<Sint8>& iParamValues);
264
265 static Array<Sint8> formatSimpleMethodRspMessage(
266 const char* iMethodName,
267 const String& messageId,
268 const Array<Sint8>& body);
269
270 static Array<Sint8> formatMethodResponseElement(
271 const char* name,
272 const Array<Sint8>& iParamValues);
273
274 static Array<Sint8>& appendStringParameter(
275 Array<Sint8>& out,
276 const char* parameterName,
277 const String& str);
278
279 kumpf 1.21.2.4 static Array<Sint8>& formatParamValueElement(
280 Array<Sint8>& out,
281 const char* name,
282 const Array<Sint8>& body);
283
284 static Array<Sint8> formatReturnValueElement(
285 const Array<Sint8>& body);
|
286 kumpf 1.21.2.6
287 static Array<Sint8> formatUnauthorizedResponseHeader(
288 const String& content);
|
289 mike 1.21
290 private:
291
292 XmlWriter() { }
293 };
294
295 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
296 Array<Sint8>& out,
297 const char* x);
298
299 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, char x);
300
301 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x);
302
303 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
304 Array<Sint8>& out,
305 const String& x);
306
307 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
308 Array<Sint8>& out,
309 const Indentor& x);
310 mike 1.21
311 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
312 Array<Sint8>& out,
313 const Array<Sint8>& x);
314
315 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
316 Array<Sint8>& out,
317 Uint32 x);
318
319 PEGASUS_NAMESPACE_END
320
321 #endif /* Pegasus_XmlWriter_h */
|