1 mike 1.21 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.48 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
|
4 mike 1.22 // The Open Group, Tivoli Systems
|
5 mike 1.21 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 kumpf 1.48 // 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 mike 1.21 // 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 kumpf 1.48 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mike 1.21 // 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 kumpf 1.48 // 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 mike 1.21 // 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 mike 1.22 // Modified By:
27 // Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
28 // Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
29 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
30 kumpf 1.45 // Carol Ann Krug Graves, Hewlett-Packard Company
31 // (carolann_graves@hp.com)
|
32 mike 1.21 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
35 #ifndef Pegasus_XmlWriter_h
36 #define Pegasus_XmlWriter_h
37
38 #include <iostream>
39 #include <Pegasus/Common/Config.h>
|
40 mday 1.58.2.1 #include <Pegasus/Common/Exception.h>
41 #include <Pegasus/Common/Array.h>
|
42 mike 1.21 #include <Pegasus/Common/String.h>
43 #include <Pegasus/Common/Indentor.h>
|
44 kumpf 1.41 #include <Pegasus/Common/CIMObject.h>
45 #include <Pegasus/Common/CIMClass.h>
46 #include <Pegasus/Common/CIMInstance.h>
47 #include <Pegasus/Common/CIMProperty.h>
48 #include <Pegasus/Common/CIMMethod.h>
49 #include <Pegasus/Common/CIMParameter.h>
50 #include <Pegasus/Common/CIMQualifier.h>
51 #include <Pegasus/Common/CIMQualifierDecl.h>
52 #include <Pegasus/Common/CIMValue.h>
|
53 kumpf 1.44 #include <Pegasus/Common/CIMObjectPath.h>
|
54 mike 1.22 #include <Pegasus/Common/CIMPropertyList.h>
|
55 kumpf 1.29 #include <Pegasus/Common/CIMParamValue.h>
|
56 kumpf 1.49 #include <Pegasus/Common/Linkage.h>
|
57 mike 1.21
58 PEGASUS_NAMESPACE_BEGIN
59
60 class PEGASUS_COMMON_LINKAGE XmlWriter
61 {
62 public:
63
|
64 mday 1.58.2.1 static void append(Array<Sint8>& out, Char16 x);
|
65 mike 1.21
66 static void append(Array<Sint8>& out, char x)
67 {
68 append(out, Char16(x));
69 }
70
|
71 kumpf 1.39 static void append(Array<Sint8>& out, Boolean x);
72
|
73 kumpf 1.26 static void append(Array<Sint8>& out, Uint32 x);
74
|
75 kumpf 1.39 static void append(Array<Sint8>& out, Sint32 x);
76
77 static void append(Array<Sint8>& out, Uint64 x);
78
79 static void append(Array<Sint8>& out, Sint64 x);
80
81 static void append(Array<Sint8>& out, Real64 x);
82
|
83 kumpf 1.26 static void append(Array<Sint8>& out, const char* str);
|
84 mike 1.21
|
85 kumpf 1.26 static void append(Array<Sint8>& out, const String& str);
|
86 mike 1.21
|
87 kumpf 1.26 static void append(Array<Sint8>& out, const Indentor& x);
|
88 mike 1.21
|
89 mday 1.58.2.1 static void appendSpecial(Array<Sint8>& out, Char16 x);
|
90 mike 1.21
91 static void appendSpecial(Array<Sint8>& out, char x);
92
|
93 kumpf 1.26 static void appendSpecial(Array<Sint8>& out, const char* str);
|
94 mike 1.21
|
95 kumpf 1.26 static void appendSpecial(Array<Sint8>& out, const String& str);
|
96 mike 1.21
|
97 kumpf 1.28 static void appendLocalNameSpacePathElement(
|
98 mike 1.21 Array<Sint8>& out,
|
99 mday 1.58.2.1 const String& nameSpace);
|
100 mike 1.21
|
101 kumpf 1.28 static void appendNameSpacePathElement(
102 Array<Sint8>& out,
103 const String& host,
|
104 mday 1.58.2.1 const String& nameSpace);
|
105 mike 1.21
|
106 kumpf 1.28 static void appendClassNameElement(
|
107 kumpf 1.26 Array<Sint8>& out,
|
108 mday 1.58.2.1 const String& className);
|
109 mike 1.21
|
110 kumpf 1.28 static void appendInstanceNameElement(
|
111 kumpf 1.26 Array<Sint8>& out,
|
112 kumpf 1.44 const CIMObjectPath& instanceName);
|
113 kumpf 1.26
|
114 kumpf 1.28 static void appendClassPathElement(
|
115 kumpf 1.26 Array<Sint8>& out,
|
116 kumpf 1.44 const CIMObjectPath& classPath);
|
117 mike 1.21
|
118 kumpf 1.28 static void appendInstancePathElement(
|
119 kumpf 1.26 Array<Sint8>& out,
|
120 kumpf 1.44 const CIMObjectPath& instancePath);
|
121 mike 1.21
|
122 kumpf 1.28 static void appendLocalClassPathElement(
|
123 kumpf 1.26 Array<Sint8>& out,
|
124 kumpf 1.44 const CIMObjectPath& classPath);
|
125 mike 1.21
|
126 kumpf 1.28 static void appendLocalInstancePathElement(
|
127 kumpf 1.26 Array<Sint8>& out,
|
128 kumpf 1.44 const CIMObjectPath& instancePath);
|
129 mike 1.21
|
130 kumpf 1.29 static void appendLocalObjectPathElement(
131 Array<Sint8>& out,
|
132 kumpf 1.44 const CIMObjectPath& objectPath);
|
133 kumpf 1.39
134 static void appendValueElement(
135 Array<Sint8>& out,
136 const CIMValue& value);
137
138 static void printValueElement(
139 const CIMValue& value,
140 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
|
141 kumpf 1.29
|
142 kumpf 1.41 static void appendValueObjectWithPathElement(
143 Array<Sint8>& out,
|
144 kumpf 1.47 const CIMObject& objectWithPath);
|
145 kumpf 1.41
146 static void appendValueReferenceElement(
147 Array<Sint8>& out,
|
148 kumpf 1.44 const CIMObjectPath& reference,
|
149 kumpf 1.41 Boolean putValueWrapper);
150
151 static void printValueReferenceElement(
|
152 kumpf 1.44 const CIMObjectPath& reference,
|
153 kumpf 1.41 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
154
155 static void appendValueNamedInstanceElement(
156 Array<Sint8>& out,
|
157 kumpf 1.45 const CIMInstance& namedInstance);
|
158 kumpf 1.41
|
159 kumpf 1.40 static void appendClassElement(
160 Array<Sint8>& out,
161 const CIMConstClass& cimclass);
162
163 static void printClassElement(
164 const CIMConstClass& cimclass,
165 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
166
167 static void appendInstanceElement(
168 Array<Sint8>& out,
169 const CIMConstInstance& instance);
170
171 static void printInstanceElement(
172 const CIMConstInstance& instance,
|
173 kumpf 1.41 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
174
175 static void appendObjectElement(
176 Array<Sint8>& out,
177 const CIMConstObject& object);
178
179 static void appendPropertyElement(
180 Array<Sint8>& out,
181 const CIMConstProperty& property);
182
183 static void printPropertyElement(
184 const CIMConstProperty& property,
185 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
186
187 static void appendMethodElement(
188 Array<Sint8>& out,
189 const CIMConstMethod& method);
190
191 static void printMethodElement(
192 const CIMConstMethod& method,
193 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
194 kumpf 1.41
195 static void appendParameterElement(
196 Array<Sint8>& out,
197 const CIMConstParameter& parameter);
198
199 static void printParameterElement(
200 const CIMConstParameter& parameter,
201 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
202
203 static void appendParamValueElement(
204 Array<Sint8>& out,
205 const CIMParamValue& paramValue);
206
207 static void printParamValueElement(
208 const CIMParamValue& paramValue,
209 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
210
211 static void appendQualifierElement(
212 Array<Sint8>& out,
213 const CIMConstQualifier& qualifier);
214
215 kumpf 1.41 static void printQualifierElement(
216 const CIMConstQualifier& qualifier,
217 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
218
219 static void appendQualifierDeclElement(
220 Array<Sint8>& out,
221 const CIMConstQualifierDecl& qualifierDecl);
222
223 static void printQualifierDeclElement(
224 const CIMConstQualifierDecl& qualifierDecl,
|
225 kumpf 1.40 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
226
|
227 kumpf 1.42 static void appendQualifierFlavorEntity(
228 Array<Sint8>& out,
|
229 mday 1.58.2.1 Uint32 flavor);
|
230 kumpf 1.42
|
231 kumpf 1.43 static void appendScopeElement(
232 Array<Sint8>& out,
|
233 mday 1.58.2.1 Uint32 scope);
|
234 kumpf 1.43
|
235 kumpf 1.28 static void appendMethodCallHeader(
|
236 kumpf 1.26 Array<Sint8>& out,
|
237 kumpf 1.28 const char* host,
|
238 mday 1.58.2.1 const char* cimMethod,
|
239 kumpf 1.28 const String& cimObject,
240 const String& authenticationHeader,
241 Uint32 contentLength);
|
242 mike 1.21
|
243 kumpf 1.28 static void appendMethodResponseHeader(
|
244 mike 1.21 Array<Sint8>& out,
|
245 kumpf 1.28 Uint32 contentLength);
|
246 mike 1.21
|
247 kumpf 1.34 static void appendHttpErrorResponseHeader(
248 Array<Sint8>& out,
249 const String& status,
250 const String& cimError = String::EMPTY,
|
251 kumpf 1.35 const String& errorDetail = String::EMPTY);
|
252 kumpf 1.34
|
253 kumpf 1.28 static void appendUnauthorizedResponseHeader(
|
254 kumpf 1.26 Array<Sint8>& out,
|
255 kumpf 1.28 const String& content);
|
256 mike 1.21
|
257 kumpf 1.26 static void appendReturnValueElement(
258 Array<Sint8>& out,
259 const CIMValue& value);
260
261 static void appendBooleanIParameter(
|
262 mike 1.21 Array<Sint8>& out,
|
263 kumpf 1.26 const char* name,
|
264 mike 1.21 Boolean flag);
265
|
266 kumpf 1.26 static void appendStringIParameter(
|
267 mike 1.21 Array<Sint8>& out,
|
268 kumpf 1.26 const char* name,
|
269 mike 1.21 const String& str);
270
|
271 kumpf 1.26 static void appendQualifierNameIParameter(
272 Array<Sint8>& out,
273 const char* name,
274 const String& qualifierName);
275
276 static void appendClassNameIParameter(
|
277 mike 1.21 Array<Sint8>& out,
|
278 kumpf 1.26 const char* name,
|
279 mday 1.58.2.1 const String& className);
|
280 mike 1.21
|
281 kumpf 1.26 static void appendInstanceNameIParameter(
|
282 mike 1.21 Array<Sint8>& out,
|
283 kumpf 1.26 const char* name,
|
284 kumpf 1.44 const CIMObjectPath& instanceName);
|
285 mike 1.21
|
286 kumpf 1.26 static void appendObjectNameIParameter(
|
287 mike 1.21 Array<Sint8>& out,
|
288 kumpf 1.26 const char* name,
|
289 kumpf 1.44 const CIMObjectPath& objectName);
|
290 mike 1.21
|
291 kumpf 1.26 static void appendClassIParameter(
|
292 mike 1.21 Array<Sint8>& out,
|
293 kumpf 1.26 const char* name,
294 const CIMConstClass& cimClass);
|
295 mike 1.21
|
296 kumpf 1.26 static void appendInstanceIParameter(
|
297 mike 1.21 Array<Sint8>& out,
|
298 kumpf 1.26 const char* name,
|
299 mike 1.21 const CIMConstInstance& instance);
300
|
301 kumpf 1.26 static void appendNamedInstanceIParameter(
|
302 mike 1.22 Array<Sint8>& out,
|
303 kumpf 1.26 const char* name,
|
304 mday 1.46 const CIMInstance& namedInstance) ;
|
305 mike 1.22
|
306 kumpf 1.26 static void appendPropertyNameIParameter(
|
307 mike 1.21 Array<Sint8>& out,
|
308 mday 1.58.2.1 const String& propertyName);
|
309 mike 1.21
|
310 kumpf 1.26 static void appendPropertyValueIParameter(
|
311 mike 1.21 Array<Sint8>& out,
|
312 kumpf 1.26 const char* name,
313 const CIMValue& value);
|
314 mike 1.21
|
315 kumpf 1.26 static void appendPropertyListIParameter(
|
316 mike 1.21 Array<Sint8>& out,
|
317 kumpf 1.26 const CIMPropertyList& propertyList);
|
318 mike 1.21
|
319 kumpf 1.26 static void appendQualifierDeclarationIParameter(
|
320 mike 1.21 Array<Sint8>& out,
|
321 kumpf 1.26 const char* name,
322 const CIMConstQualifierDecl& qualifierDecl);
|
323 kumpf 1.34
324 static Array<Sint8> formatHttpErrorRspMessage(
325 const String& status,
326 const String& cimError = String::EMPTY,
|
327 kumpf 1.35 const String& errorDetail = String::EMPTY);
|
328 mike 1.21
|
329 kumpf 1.26 static Array<Sint8> formatSimpleMethodReqMessage(
330 const char* host,
|
331 mday 1.58.2.1 const String& nameSpace,
|
332 kumpf 1.44 const CIMObjectPath& path,
|
333 mday 1.58.2.1 const char* methodName,
|
334 kumpf 1.29 const Array<CIMParamValue>& parameters,
|
335 kumpf 1.26 const String& messageId,
|
336 kumpf 1.29 const String& authenticationHeader);
|
337 mike 1.21
|
338 kumpf 1.26 static Array<Sint8> formatSimpleMethodRspMessage(
|
339 mday 1.58.2.1 const char* methodName,
|
340 kumpf 1.26 const String& messageId,
341 const Array<Sint8>& body);
|
342 mike 1.21
|
343 kumpf 1.27 static Array<Sint8> formatSimpleMethodErrorRspMessage(
|
344 mday 1.58.2.1 const String& methodName,
|
345 kumpf 1.27 const String& messageId,
|
346 kumpf 1.36 const CIMException& cimException);
|
347 kumpf 1.27
|
348 mike 1.22 static Array<Sint8> formatSimpleIMethodReqMessage(
|
349 mike 1.21 const char* host,
|
350 mday 1.58.2.1 const String& nameSpace,
351 const char* iMethodName,
|
352 mike 1.22 const String& messageId,
353 const String& authenticationHeader,
|
354 mike 1.21 const Array<Sint8>& body);
355
|
356 kumpf 1.26 static Array<Sint8> formatSimpleIMethodRspMessage(
|
357 mday 1.58.2.1 const char* iMethodName,
|
358 mike 1.21 const String& messageId,
359 const Array<Sint8>& body);
360
|
361 kumpf 1.27 static Array<Sint8> formatSimpleIMethodErrorRspMessage(
|
362 mday 1.58.2.1 const String& iMethodName,
|
363 mike 1.22 const String& messageId,
|
364 kumpf 1.36 const CIMException& cimException);
|
365 mike 1.22
|
366 kumpf 1.26 static void appendEMethodRequestHeader(
367 Array<Sint8>& out,
|
368 kumpf 1.38 const char* requestUri,
|
369 mike 1.22 const char* host,
|
370 mday 1.58.2.1 const char* cimMethod,
|
371 mike 1.22 const String& authenticationHeader,
|
372 kumpf 1.26 Uint32 contentLength);
|
373 mike 1.22
|
374 kumpf 1.26 static void appendEMethodResponseHeader(
375 Array<Sint8>& out,
376 Uint32 contentLength);
|
377 mike 1.22
|
378 kumpf 1.26 static Array<Sint8> formatSimpleEMethodReqMessage(
|
379 kumpf 1.38 const char* requestUri,
|
380 mike 1.22 const char* host,
|
381 mday 1.58.2.1 const char* eMethodName,
|
382 mike 1.22 const String& messageId,
|
383 kumpf 1.26 const String& authenticationHeader,
|
384 mike 1.22 const Array<Sint8>& body);
385
|
386 kumpf 1.26 static Array<Sint8> formatSimpleEMethodRspMessage(
|
387 mday 1.58.2.1 const char* eMethodName,
|
388 mike 1.22 const String& messageId,
389 const Array<Sint8>& body);
|
390 kumpf 1.27
391 static Array<Sint8> formatSimpleEMethodErrorRspMessage(
|
392 mday 1.58.2.1 const String& eMethodName,
|
393 kumpf 1.27 const String& messageId,
|
394 kumpf 1.36 const CIMException& cimException);
|
395 mike 1.22
|
396 kumpf 1.26 static void indentedPrint(
397 PEGASUS_STD(ostream)& os,
398 const char* text,
399 Uint32 indentChars = 2);
|
400 mike 1.22
|
401 kumpf 1.26 static String getNextMessageId();
|
402 mike 1.21
403 private:
|
404 kumpf 1.28
405 static void _appendMessageElementBegin(
406 Array<Sint8>& out,
407 const String& messageId);
408 static void _appendMessageElementEnd(
409 Array<Sint8>& out);
410
411 static void _appendSimpleReqElementBegin(Array<Sint8>& out);
412 static void _appendSimpleReqElementEnd(Array<Sint8>& out);
413
414 static void _appendMethodCallElementBegin(
415 Array<Sint8>& out,
|
416 mday 1.58.2.1 const char* name);
|
417 kumpf 1.28 static void _appendMethodCallElementEnd(
418 Array<Sint8>& out);
419
420 static void _appendIMethodCallElementBegin(
421 Array<Sint8>& out,
|
422 mday 1.58.2.1 const char* name);
|
423 kumpf 1.28 static void _appendIMethodCallElementEnd(
424 Array<Sint8>& out);
425
426 static void _appendIParamValueElementBegin(
427 Array<Sint8>& out,
428 const char* name);
429 static void _appendIParamValueElementEnd(
430 Array<Sint8>& out);
431
432 static void _appendSimpleRspElementBegin(Array<Sint8>& out);
433 static void _appendSimpleRspElementEnd(Array<Sint8>& out);
434
435 static void _appendMethodResponseElementBegin(
436 Array<Sint8>& out,
|
437 mday 1.58.2.1 const char* name);
|
438 kumpf 1.28 static void _appendMethodResponseElementEnd(
439 Array<Sint8>& out);
440
441 static void _appendIMethodResponseElementBegin(
442 Array<Sint8>& out,
|
443 mday 1.58.2.1 const char* name);
|
444 kumpf 1.28 static void _appendIMethodResponseElementEnd(
445 Array<Sint8>& out);
446
447 static void _appendErrorElement(
448 Array<Sint8>& out,
|
449 kumpf 1.36 const CIMException& cimException);
|
450 kumpf 1.28
451 static void _appendIReturnValueElementBegin(Array<Sint8>& out);
452 static void _appendIReturnValueElementEnd(Array<Sint8>& out);
453
454 static void _appendSimpleExportReqElementBegin(Array<Sint8>& out);
455 static void _appendSimpleExportReqElementEnd(Array<Sint8>& out);
456
457 static void _appendEMethodCallElementBegin(
458 Array<Sint8>& out,
|
459 mday 1.58.2.1 const char* name);
|
460 kumpf 1.28 static void _appendEMethodCallElementEnd(
461 Array<Sint8>& out);
462
463 static void _appendSimpleExportRspElementBegin(Array<Sint8>& out);
464 static void _appendSimpleExportRspElementEnd(Array<Sint8>& out);
465
466 static void _appendEMethodResponseElementBegin(
467 Array<Sint8>& out,
|
468 mday 1.58.2.1 const char* name);
|
469 kumpf 1.28 static void _appendEMethodResponseElementEnd(
470 Array<Sint8>& out);
|
471 mike 1.21
472 XmlWriter() { }
473 };
474
475 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
476 Array<Sint8>& out,
477 const char* x);
478
479 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, char x);
480
|
481 mday 1.58.2.1 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x);
|
482 mike 1.21
483 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
484 Array<Sint8>& out,
485 const String& x);
486
487 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
488 Array<Sint8>& out,
489 const Indentor& x);
490
491 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
492 Array<Sint8>& out,
493 const Array<Sint8>& x);
494
495 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
496 Array<Sint8>& out,
497 Uint32 x);
|
498 kumpf 1.54
|
499 mike 1.21 PEGASUS_NAMESPACE_END
500
501 #endif /* Pegasus_XmlWriter_h */
|