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