1 karl 1.79 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.21 //
|
3 karl 1.69 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.64 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.69 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.72 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.79 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.21 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.48 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.21 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 karl 1.79 //
|
21 kumpf 1.48 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.21 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.48 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_XmlWriter_h
35 #define Pegasus_XmlWriter_h
36
37 #include <iostream>
38 #include <Pegasus/Common/Config.h>
|
39 kumpf 1.53 #include <Pegasus/Common/InternalException.h>
|
40 kumpf 1.55 #include <Pegasus/Common/ArrayInternal.h>
|
41 mike 1.21 #include <Pegasus/Common/String.h>
|
42 kumpf 1.41 #include <Pegasus/Common/CIMObject.h>
43 #include <Pegasus/Common/CIMClass.h>
44 #include <Pegasus/Common/CIMInstance.h>
45 #include <Pegasus/Common/CIMProperty.h>
46 #include <Pegasus/Common/CIMMethod.h>
47 #include <Pegasus/Common/CIMParameter.h>
48 #include <Pegasus/Common/CIMQualifier.h>
49 #include <Pegasus/Common/CIMQualifierDecl.h>
50 #include <Pegasus/Common/CIMValue.h>
|
51 kumpf 1.44 #include <Pegasus/Common/CIMObjectPath.h>
|
52 mike 1.22 #include <Pegasus/Common/CIMPropertyList.h>
|
53 kumpf 1.29 #include <Pegasus/Common/CIMParamValue.h>
|
54 kumpf 1.59 #include <Pegasus/Common/Message.h>
|
55 kumpf 1.49 #include <Pegasus/Common/Linkage.h>
|
56 kumpf 1.78 #include <Pegasus/Common/ContentLanguageList.h>
57 #include <Pegasus/Common/AcceptLanguageList.h>
|
58 mike 1.75 #include <Pegasus/Common/Buffer.h>
|
59 mike 1.76 #include <Pegasus/Common/StrLit.h>
|
60 kumpf 1.86 #include <Pegasus/Common/XmlGenerator.h>
|
61 mike 1.21
62 PEGASUS_NAMESPACE_BEGIN
63
|
64 kumpf 1.86 class PEGASUS_COMMON_LINKAGE XmlWriter : public XmlGenerator
|
65 mike 1.21 {
66 public:
67
|
68 kumpf 1.28 static void appendLocalNameSpacePathElement(
|
69 david.dillard 1.77 Buffer& out,
70 const CIMNamespaceName& nameSpace);
|
71 mike 1.21
|
72 kumpf 1.28 static void appendNameSpacePathElement(
|
73 david.dillard 1.77 Buffer& out,
74 const String& host,
75 const CIMNamespaceName& nameSpace);
|
76 mike 1.21
|
77 kumpf 1.28 static void appendClassNameElement(
|
78 david.dillard 1.77 Buffer& out,
79 const CIMName& className);
|
80 mike 1.21
|
81 kumpf 1.28 static void appendInstanceNameElement(
|
82 david.dillard 1.77 Buffer& out,
83 const CIMObjectPath& instanceName);
|
84 kumpf 1.26
|
85 kumpf 1.28 static void appendClassPathElement(
|
86 david.dillard 1.77 Buffer& out,
87 const CIMObjectPath& classPath);
|
88 mike 1.21
|
89 kumpf 1.28 static void appendInstancePathElement(
|
90 david.dillard 1.77 Buffer& out,
91 const CIMObjectPath& instancePath);
|
92 mike 1.21
|
93 kumpf 1.28 static void appendLocalClassPathElement(
|
94 david.dillard 1.77 Buffer& out,
95 const CIMObjectPath& classPath);
|
96 mike 1.21
|
97 kumpf 1.28 static void appendLocalInstancePathElement(
|
98 david.dillard 1.77 Buffer& out,
99 const CIMObjectPath& instancePath);
|
100 mike 1.21
|
101 kumpf 1.29 static void appendLocalObjectPathElement(
|
102 david.dillard 1.77 Buffer& out,
103 const CIMObjectPath& objectPath);
|
104 kumpf 1.39
105 static void appendValueElement(
|
106 mike 1.75 Buffer& out,
|
107 kumpf 1.39 const CIMValue& value);
108
109 static void printValueElement(
110 const CIMValue& value,
111 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
|
112 kumpf 1.29
|
113 kumpf 1.41 static void appendValueObjectWithPathElement(
|
114 mike 1.75 Buffer& out,
|
115 kumpf 1.47 const CIMObject& objectWithPath);
|
116 kumpf 1.41
117 static void appendValueReferenceElement(
|
118 mike 1.75 Buffer& out,
|
119 kumpf 1.44 const CIMObjectPath& reference,
|
120 kumpf 1.41 Boolean putValueWrapper);
121
122 static void printValueReferenceElement(
|
123 kumpf 1.44 const CIMObjectPath& reference,
|
124 kumpf 1.41 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
125
126 static void appendValueNamedInstanceElement(
|
127 mike 1.75 Buffer& out,
|
128 kumpf 1.45 const CIMInstance& namedInstance);
|
129 kumpf 1.41
|
130 kumpf 1.40 static void appendClassElement(
|
131 mike 1.75 Buffer& out,
|
132 kumpf 1.40 const CIMConstClass& cimclass);
133
134 static void printClassElement(
135 const CIMConstClass& cimclass,
136 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
137
138 static void appendInstanceElement(
|
139 mike 1.75 Buffer& out,
|
140 kumpf 1.40 const CIMConstInstance& instance);
141
142 static void printInstanceElement(
143 const CIMConstInstance& instance,
|
144 kumpf 1.41 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
145
146 static void appendObjectElement(
|
147 mike 1.75 Buffer& out,
|
148 kumpf 1.41 const CIMConstObject& object);
149
150 static void appendPropertyElement(
|
151 mike 1.75 Buffer& out,
|
152 kumpf 1.41 const CIMConstProperty& property);
153
154 static void printPropertyElement(
155 const CIMConstProperty& property,
156 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
157
158 static void appendMethodElement(
|
159 mike 1.75 Buffer& out,
|
160 kumpf 1.41 const CIMConstMethod& method);
161
162 static void printMethodElement(
163 const CIMConstMethod& method,
164 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
165
166 static void appendParameterElement(
|
167 mike 1.75 Buffer& out,
|
168 kumpf 1.41 const CIMConstParameter& parameter);
169
170 static void printParameterElement(
171 const CIMConstParameter& parameter,
172 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
173
174 static void appendParamValueElement(
|
175 mike 1.75 Buffer& out,
|
176 kumpf 1.41 const CIMParamValue& paramValue);
177
178 static void printParamValueElement(
179 const CIMParamValue& paramValue,
180 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
181
182 static void appendQualifierElement(
|
183 mike 1.75 Buffer& out,
|
184 kumpf 1.41 const CIMConstQualifier& qualifier);
185
186 static void printQualifierElement(
187 const CIMConstQualifier& qualifier,
188 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
189
190 static void appendQualifierDeclElement(
|
191 mike 1.75 Buffer& out,
|
192 kumpf 1.41 const CIMConstQualifierDecl& qualifierDecl);
193
194 static void printQualifierDeclElement(
195 const CIMConstQualifierDecl& qualifierDecl,
|
196 kumpf 1.40 PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
197
|
198 kumpf 1.42 static void appendQualifierFlavorEntity(
|
199 mike 1.75 Buffer& out,
|
200 kumpf 1.52 const CIMFlavor & flavor);
|
201 kumpf 1.42
|
202 kumpf 1.43 static void appendScopeElement(
|
203 mike 1.75 Buffer& out,
|
204 kumpf 1.51 const CIMScope & scope);
|
205 kumpf 1.43
|
206 kumpf 1.28 static void appendMethodCallHeader(
|
207 david.dillard 1.77 Buffer& out,
208 const char* host,
209 const CIMName& cimMethod,
210 const String& cimObject,
211 const String& authenticationHeader,
212 HttpMethod httpMethod,
|
213 kumpf 1.78 const AcceptLanguageList& acceptLanguages,
214 const ContentLanguageList& contentLanguages,
|
215 david.dillard 1.77 Uint32 contentLength);
|
216 mike 1.21
|
217 w.white 1.68 static void appendMethodResponseHeader(
|
218 mike 1.75 Buffer& out,
|
219 w.white 1.68 HttpMethod httpMethod,
|
220 kumpf 1.78 const ContentLanguageList& contentLanguages,
|
221 w.white 1.68 Uint32 contentLength,
|
222 david.dillard 1.77 Uint64 serverResponseTime = 0);
|
223 w.white 1.68
|
224 kumpf 1.34 static void appendHttpErrorResponseHeader(
|
225 david.dillard 1.77 Buffer& out,
226 const String& status,
227 const String& cimError = String::EMPTY,
228 const String& errorDetail = String::EMPTY);
|
229 kumpf 1.34
|
230 kumpf 1.28 static void appendUnauthorizedResponseHeader(
|
231 david.dillard 1.77 Buffer& out,
|
232 kumpf 1.28 const String& content);
|
233 mike 1.21
|
234 gerarda 1.63 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
235 static void appendOKResponseHeader(
|
236 david.dillard 1.77 Buffer& out,
|
237 gerarda 1.63 const String& content);
238 #endif
|
239 kumpf 1.86
|
240 karl 1.83 static void appendParamTypeAndEmbeddedObjAttrib(
241 Buffer& out,
242 const CIMType& type);
|
243 gerarda 1.63
|
244 kumpf 1.26 static void appendReturnValueElement(
|
245 david.dillard 1.77 Buffer& out,
246 const CIMValue& value);
|
247 kumpf 1.26
248 static void appendBooleanIParameter(
|
249 david.dillard 1.77 Buffer& out,
250 const char* name,
251 Boolean flag);
|
252 mike 1.21
|
253 kumpf 1.26 static void appendStringIParameter(
|
254 david.dillard 1.77 Buffer& out,
255 const char* name,
256 const String& str);
|
257 mike 1.21
|
258 kumpf 1.26 static void appendClassNameIParameter(
|
259 david.dillard 1.77 Buffer& out,
260 const char* name,
261 const CIMName& className);
|
262 mike 1.21
|
263 kumpf 1.26 static void appendInstanceNameIParameter(
|
264 david.dillard 1.77 Buffer& out,
265 const char* name,
266 const CIMObjectPath& instanceName);
|
267 mike 1.21
|
268 kumpf 1.26 static void appendObjectNameIParameter(
|
269 david.dillard 1.77 Buffer& out,
270 const char* name,
271 const CIMObjectPath& objectName);
|
272 mike 1.21
|
273 kumpf 1.26 static void appendClassIParameter(
|
274 david.dillard 1.77 Buffer& out,
275 const char* name,
276 const CIMConstClass& cimClass);
|
277 mike 1.21
|
278 kumpf 1.26 static void appendInstanceIParameter(
|
279 david.dillard 1.77 Buffer& out,
280 const char* name,
281 const CIMConstInstance& instance);
|
282 mike 1.21
|
283 kumpf 1.26 static void appendNamedInstanceIParameter(
|
284 david.dillard 1.77 Buffer& out,
285 const char* name,
286 const CIMInstance& namedInstance) ;
|
287 mike 1.22
|
288 kumpf 1.26 static void appendPropertyNameIParameter(
|
289 david.dillard 1.77 Buffer& out,
290 const CIMName& propertyName);
|
291 mike 1.21
|
292 kumpf 1.26 static void appendPropertyValueIParameter(
|
293 david.dillard 1.77 Buffer& out,
294 const char* name,
295 const CIMValue& value);
|
296 mike 1.21
|
297 kumpf 1.26 static void appendPropertyListIParameter(
|
298 david.dillard 1.77 Buffer& out,
299 const CIMPropertyList& propertyList);
|
300 mike 1.21
|
301 kumpf 1.26 static void appendQualifierDeclarationIParameter(
|
302 david.dillard 1.77 Buffer& out,
303 const char* name,
304 const CIMConstQualifierDecl& qualifierDecl);
|
305 kumpf 1.34
|
306 mike 1.75 static Buffer formatHttpErrorRspMessage(
|
307 david.dillard 1.77 const String& status,
308 const String& cimError = String::EMPTY,
309 const String& errorDetail = String::EMPTY);
|
310 mike 1.21
|
311 mike 1.75 static Buffer formatSimpleMethodReqMessage(
|
312 david.dillard 1.77 const char* host,
313 const CIMNamespaceName& nameSpace,
314 const CIMObjectPath& path,
315 const CIMName& methodName,
316 const Array<CIMParamValue>& parameters,
317 const String& messageId,
|
318 kumpf 1.59 HttpMethod httpMethod,
|
319 chuck 1.62 const String& authenticationHeader,
|
320 kumpf 1.78 const AcceptLanguageList& httpAcceptLanguages,
321 const ContentLanguageList& httpContentLanguages);
|
322 mike 1.21
|
323 david.dillard 1.77 static Buffer formatSimpleMethodRspMessage(
324 const CIMName& methodName,
|
325 w.white 1.68 const String& messageId,
326 HttpMethod httpMethod,
|
327 kumpf 1.78 const ContentLanguageList& httpContentLanguages,
|
328 david.dillard 1.77 const Buffer& body,
329 Uint64 serverResponseTime,
330 Boolean isFirst = true,
331 Boolean isLast = true);
|
332 mike 1.21
|
333 mike 1.75 static Buffer formatSimpleMethodErrorRspMessage(
|
334 david.dillard 1.77 const CIMName& methodName,
335 const String& messageId,
|
336 kumpf 1.59 HttpMethod httpMethod,
|
337 david.dillard 1.77 const CIMException& cimException);
|
338 kumpf 1.27
|
339 mike 1.75 static Buffer formatSimpleIMethodReqMessage(
|
340 david.dillard 1.77 const char* host,
341 const CIMNamespaceName& nameSpace,
342 const CIMName& iMethodName,
343 const String& messageId,
|
344 kumpf 1.59 HttpMethod httpMethod,
|
345 mike 1.22 const String& authenticationHeader,
|
346 kumpf 1.78 const AcceptLanguageList& httpAcceptLanguages,
347 const ContentLanguageList& httpContentLanguages,
|
348 david.dillard 1.77 const Buffer& body);
|
349 mike 1.21
|
350 david.dillard 1.77 static Buffer formatSimpleIMethodRspMessage(
351 const CIMName& iMethodName,
|
352 mike 1.21 const String& messageId,
|
353 kumpf 1.59 HttpMethod httpMethod,
|
354 kumpf 1.78 const ContentLanguageList& httpContentLanguages,
|
355 david.dillard 1.77 const Buffer& body,
356 Uint64 serverResponseTime,
357 Boolean isFirst = true,
358 Boolean isLast = true);
|
359 mike 1.21
|
360 mike 1.75 static Buffer formatSimpleIMethodErrorRspMessage(
|
361 david.dillard 1.77 const CIMName& iMethodName,
362 const String& messageId,
|
363 kumpf 1.59 HttpMethod httpMethod,
|
364 david.dillard 1.77 const CIMException& cimException);
|
365 mike 1.22
|
366 kumpf 1.61 static void appendInstanceEParameter(
|
367 david.dillard 1.77 Buffer& out,
368 const char* name,
369 const CIMInstance& instance);
|
370 kumpf 1.61
|
371 kumpf 1.26 static void appendEMethodRequestHeader(
|
372 david.dillard 1.77 Buffer& out,
|
373 kumpf 1.38 const char* requestUri,
|
374 david.dillard 1.77 const char* host,
375 const CIMName& cimMethod,
|
376 kumpf 1.59 HttpMethod httpMethod,
|
377 mike 1.22 const String& authenticationHeader,
|
378 kumpf 1.78 const AcceptLanguageList& acceptLanguages,
379 const ContentLanguageList& contentLanguages,
|
380 david.dillard 1.77 Uint32 contentLength);
|
381 mike 1.22
|
382 kumpf 1.26 static void appendEMethodResponseHeader(
|
383 david.dillard 1.77 Buffer& out,
|
384 kumpf 1.59 HttpMethod httpMethod,
|
385 kumpf 1.78 const ContentLanguageList& contentLanguages,
|
386 david.dillard 1.77 Uint32 contentLength);
|
387 mike 1.22
|
388 mike 1.75 static Buffer formatSimpleEMethodReqMessage(
|
389 kumpf 1.38 const char* requestUri,
|
390 david.dillard 1.77 const char* host,
391 const CIMName& eMethodName,
392 const String& messageId,
393 HttpMethod httpMethod,
394 const String& authenticationHeader,
|
395 kumpf 1.78 const AcceptLanguageList& httpAcceptLanguages,
396 const ContentLanguageList& httpContentLanguages,
|
397 david.dillard 1.77 const Buffer& body);
|
398 mike 1.22
|
399 mike 1.75 static Buffer formatSimpleEMethodRspMessage(
|
400 david.dillard 1.77 const CIMName& eMethodName,
|
401 mike 1.22 const String& messageId,
|
402 kumpf 1.59 HttpMethod httpMethod,
|
403 kumpf 1.78 const ContentLanguageList& httpContentLanguages,
|
404 david.dillard 1.77 const Buffer& body);
|
405 kumpf 1.27
|
406 mike 1.75 static Buffer formatSimpleEMethodErrorRspMessage(
|
407 david.dillard 1.77 const CIMName& eMethodName,
408 const String& messageId,
|
409 kumpf 1.59 HttpMethod httpMethod,
|
410 david.dillard 1.77 const CIMException& cimException);
|
411 mike 1.22
|
412 kumpf 1.26 static String getNextMessageId();
|
413 mike 1.21
|
414 kumpf 1.57 /** Converts the given CIMKeyBinding type to one of the following:
|
415 kumpf 1.50 "boolean", "string", or "numeric"
416 */
|
417 kumpf 1.57 static const char* keyBindingTypeToString (CIMKeyBinding::Type type);
|
418 kumpf 1.50
|
419 mike 1.21 private:
|
420 kumpf 1.28
421 static void _appendMessageElementBegin(
|
422 david.dillard 1.77 Buffer& out,
423 const String& messageId);
424 static void _appendMessageElementEnd(
425 Buffer& out);
|
426 kumpf 1.28
|
427 mike 1.75 static void _appendSimpleReqElementBegin(Buffer& out);
428 static void _appendSimpleReqElementEnd(Buffer& out);
|
429 kumpf 1.28
430 static void _appendMethodCallElementBegin(
|
431 david.dillard 1.77 Buffer& out,
432 const CIMName& name);
433
|
434 kumpf 1.28 static void _appendMethodCallElementEnd(
|
435 david.dillard 1.77 Buffer& out);
|
436 kumpf 1.28
437 static void _appendIMethodCallElementBegin(
|
438 david.dillard 1.77 Buffer& out,
439 const CIMName& name);
440 static void _appendIMethodCallElementEnd(
441 Buffer& out);
|
442 kumpf 1.28
443 static void _appendIParamValueElementBegin(
|
444 david.dillard 1.77 Buffer& out,
445 const char* name);
446 static void _appendIParamValueElementEnd(
447 Buffer& out);
|
448 kumpf 1.28
|
449 mike 1.75 static void _appendSimpleRspElementBegin(Buffer& out);
450 static void _appendSimpleRspElementEnd(Buffer& out);
|
451 kumpf 1.28
452 static void _appendMethodResponseElementBegin(
|
453 david.dillard 1.77 Buffer& out,
454 const CIMName& name);
455 static void _appendMethodResponseElementEnd(
456 Buffer& out);
|
457 kumpf 1.28
458 static void _appendIMethodResponseElementBegin(
|
459 david.dillard 1.77 Buffer& out,
460 const CIMName& name);
461 static void _appendIMethodResponseElementEnd(
462 Buffer& out);
|
463 kumpf 1.28
464 static void _appendErrorElement(
|
465 david.dillard 1.77 Buffer& out,
466 const CIMException& cimException);
|
467 kumpf 1.28
|
468 mike 1.75 static void _appendIReturnValueElementBegin(Buffer& out);
469 static void _appendIReturnValueElementEnd(Buffer& out);
|
470 kumpf 1.28
|
471 mike 1.75 static void _appendSimpleExportReqElementBegin(Buffer& out);
472 static void _appendSimpleExportReqElementEnd(Buffer& out);
|
473 kumpf 1.28
474 static void _appendEMethodCallElementBegin(
|
475 david.dillard 1.77 Buffer& out,
476 const CIMName& name);
477
|
478 kumpf 1.28 static void _appendEMethodCallElementEnd(
|
479 david.dillard 1.77 Buffer& out);
|
480 kumpf 1.61
481 static void _appendEParamValueElementBegin(
|
482 david.dillard 1.77 Buffer& out,
483 const char* name);
484 static void _appendEParamValueElementEnd(
485 Buffer& out);
|
486 kumpf 1.28
|
487 mike 1.75 static void _appendSimpleExportRspElementBegin(Buffer& out);
488 static void _appendSimpleExportRspElementEnd(Buffer& out);
|
489 kumpf 1.28
490 static void _appendEMethodResponseElementBegin(
|
491 david.dillard 1.77 Buffer& out,
492 const CIMName& name);
493
|
494 kumpf 1.28 static void _appendEMethodResponseElementEnd(
|
495 david.dillard 1.77 Buffer& out);
|
496 mike 1.21
|
497 kumpf 1.85 XmlWriter();
|
498 mike 1.21 };
499
|
500 kumpf 1.54
|
501 mike 1.21 PEGASUS_NAMESPACE_END
502
503 #endif /* Pegasus_XmlWriter_h */
|