(file) Return to XmlWriter.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

   1 martin 1.165 //%LICENSE////////////////////////////////////////////////////////////////
   2 martin 1.166 //
   3 martin 1.165 // 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.166 //
  10 martin 1.165 // 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.166 //
  17 martin 1.165 // The above copyright notice and this permission notice shall be included
  18              // in all copies or substantial portions of the Software.
  19 martin 1.166 //
  20 martin 1.165 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21 martin 1.166 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22 martin 1.165 // 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.166 //
  28 martin 1.165 //////////////////////////////////////////////////////////////////////////
  29 mike   1.23  //
  30              //%/////////////////////////////////////////////////////////////////////////////
  31              
  32 sage   1.49  #include <Pegasus/Common/Config.h>
  33 mike   1.23  #include <cstdlib>
  34              #include <cstdio>
  35 kumpf  1.46  #include "Constants.h"
  36 mike   1.23  #include "CIMClass.h"
  37 kumpf  1.55  #include "CIMClassRep.h"
  38 mike   1.23  #include "CIMInstance.h"
  39 kumpf  1.55  #include "CIMInstanceRep.h"
  40 kumpf  1.56  #include "CIMProperty.h"
  41              #include "CIMPropertyRep.h"
  42              #include "CIMMethod.h"
  43              #include "CIMMethodRep.h"
  44              #include "CIMParameter.h"
  45              #include "CIMParameterRep.h"
  46              #include "CIMParamValue.h"
  47              #include "CIMParamValueRep.h"
  48              #include "CIMQualifier.h"
  49              #include "CIMQualifierRep.h"
  50              #include "CIMQualifierDecl.h"
  51              #include "CIMQualifierDeclRep.h"
  52 kumpf  1.54  #include "CIMValue.h"
  53 mike   1.23  #include "XmlWriter.h"
  54 kumpf  1.44  #include "Tracer.h"
  55 sage   1.49  #include <Pegasus/Common/StatisticalData.h>
  56 david  1.92  #include "CommonUTF.h"
  57 mike   1.125 #include "Buffer.h"
  58 mike   1.127 #include "StrLit.h"
  59 mike   1.139 #include "IDFactory.h"
  60 marek  1.151 #include "StringConversion.h"
  61 mike   1.23  
  62              PEGASUS_NAMESPACE_BEGIN
  63              
  64 thilo.boehm 1.162 static StrLit _XmlWriterTypeStrings[] =
  65                   {
  66                       STRLIT("TYPE=\"boolean\""),   STRLIT("TYPE=\"uint8\""),
  67                       STRLIT("TYPE=\"sint8\""),     STRLIT("TYPE=\"uint16\""),
  68                       STRLIT("TYPE=\"sint16\""),    STRLIT("TYPE=\"uint32\""),
  69                       STRLIT("TYPE=\"sint32\""),    STRLIT("TYPE=\"uint64\""),
  70                       STRLIT("TYPE=\"sint64\""),    STRLIT("TYPE=\"real32\""),
  71                       STRLIT("TYPE=\"real64\""),    STRLIT("TYPE=\"char16\""),
  72                       STRLIT("TYPE=\"string\""),    STRLIT("TYPE=\"datetime\""),
  73                       STRLIT("TYPE=\"reference\""), STRLIT("TYPE=\"object\""),
  74                       STRLIT("TYPE=\"instance\"")
  75                   };
  76                   
  77 kumpf       1.29  //------------------------------------------------------------------------------
  78                   //
  79                   // appendLocalNameSpacePathElement()
  80                   //
  81                   //     <!ELEMENT LOCALNAMESPACEPATH (NAMESPACE+)>
  82                   //
  83                   //------------------------------------------------------------------------------
  84                   
  85                   void XmlWriter::appendLocalNameSpacePathElement(
  86 mike        1.125     Buffer& out,
  87 kumpf       1.80      const CIMNamespaceName& nameSpace)
  88 mike        1.23  {
  89 mike        1.126     out << STRLIT("<LOCALNAMESPACEPATH>\n");
  90 mike        1.23  
  91 david       1.103     char* nameSpaceCopy = strdup(nameSpace.getString().getCString());
  92 chuck       1.105 
  93 marek       1.140 #if !defined(PEGASUS_COMPILER_MSVC) && !defined(PEGASUS_OS_ZOS)
  94 keith.petley 1.91      char *last;
  95                        for (const char* p = strtok_r(nameSpaceCopy, "/", &last); p;
  96 kumpf        1.93           p = strtok_r(NULL, "/", &last))
  97 keith.petley 1.91  #else
  98 kumpf        1.76      for (const char* p = strtok(nameSpaceCopy, "/"); p; p = strtok(NULL, "/"))
  99 keith.petley 1.91  #endif
 100 mike         1.23      {
 101 david.dillard 1.131         out << STRLIT("<NAMESPACE NAME=\"") << p << STRLIT("\"/>\n");
 102 mike          1.23      }
 103 kumpf         1.96      free(nameSpaceCopy);
 104 mike          1.23  
 105 mike          1.126     out << STRLIT("</LOCALNAMESPACEPATH>\n");
 106 mike          1.23  }
 107                     
 108                     //------------------------------------------------------------------------------
 109                     //
 110 kumpf         1.29  // appendNameSpacePathElement()
 111                     //
 112                     //     <!ELEMENT NAMESPACEPATH (HOST,LOCALNAMESPACEPATH)>
 113                     //
 114                     //------------------------------------------------------------------------------
 115                     
 116                     void XmlWriter::appendNameSpacePathElement(
 117 mike          1.125     Buffer& out,
 118 kumpf         1.29      const String& host,
 119 kumpf         1.80      const CIMNamespaceName& nameSpace)
 120 kumpf         1.29  {
 121 kumpf         1.167     out << STRLIT("<NAMESPACEPATH>\n"
 122 thilo.boehm   1.162                   "<HOST>") << host << STRLIT("</HOST>\n");
 123 kumpf         1.29      appendLocalNameSpacePathElement(out, nameSpace);
 124 mike          1.126     out << STRLIT("</NAMESPACEPATH>\n");
 125 kumpf         1.29  }
 126                     
 127                     //------------------------------------------------------------------------------
 128                     //
 129                     // appendClassNameElement()
 130                     //
 131                     //     <!ELEMENT CLASSNAME EMPTY>
 132                     //     <!ATTLIST CLASSNAME
 133                     //              %CIMName;>
 134                     //
 135                     //------------------------------------------------------------------------------
 136                     
 137                     void XmlWriter::appendClassNameElement(
 138 mike          1.125     Buffer& out,
 139 kumpf         1.80      const CIMName& className)
 140 kumpf         1.29  {
 141 mike          1.126     out << STRLIT("<CLASSNAME NAME=\"") << className << STRLIT("\"/>\n");
 142 kumpf         1.29  }
 143                     
 144                     //------------------------------------------------------------------------------
 145                     //
 146                     // appendInstanceNameElement()
 147                     //
 148                     //    <!ELEMENT INSTANCENAME (KEYBINDING*|KEYVALUE?|VALUE.REFERENCE?)>
 149                     //    <!ATTLIST INSTANCENAME
 150                     //              %ClassName;>
 151                     //
 152                     //------------------------------------------------------------------------------
 153                     
 154                     void XmlWriter::appendInstanceNameElement(
 155 mike          1.125     Buffer& out,
 156 kumpf         1.59      const CIMObjectPath& instanceName)
 157 kumpf         1.29  {
 158 mike          1.126     out << STRLIT("<INSTANCENAME CLASSNAME=\"");
 159                         out << instanceName.getClassName() << STRLIT("\">\n");
 160 kumpf         1.29  
 161 mike          1.126     const Array<CIMKeyBinding>& keyBindings = instanceName.getKeyBindings();
 162 kumpf         1.29      for (Uint32 i = 0, n = keyBindings.size(); i < n; i++)
 163                         {
 164 mike          1.126         out << STRLIT("<KEYBINDING NAME=\"");
 165 kumpf         1.146         out << keyBindings[i].getName() << STRLIT("\">\n");
 166 kumpf         1.29  
 167 kumpf         1.79          if (keyBindings[i].getType() == CIMKeyBinding::REFERENCE)
 168 kumpf         1.29          {
 169 kumpf         1.59              CIMObjectPath ref = keyBindings[i].getValue();
 170 kumpf         1.56              appendValueReferenceElement(out, ref, true);
 171 kumpf         1.29          }
 172 kumpf         1.146         else
 173                             {
 174 mike          1.126             out << STRLIT("<KEYVALUE VALUETYPE=\"");
 175 kumpf         1.68              out << keyBindingTypeToString(keyBindings[i].getType());
 176 mike          1.126             out << STRLIT("\">");
 177 kumpf         1.29  
 178                                 // fixed the special character problem - Markus
 179                     
 180                                 appendSpecial(out, keyBindings[i].getValue());
 181 mike          1.126             out << STRLIT("</KEYVALUE>\n");
 182 kumpf         1.29          }
 183 mike          1.126         out << STRLIT("</KEYBINDING>\n");
 184 kumpf         1.29      }
 185 mike          1.126     out << STRLIT("</INSTANCENAME>\n");
 186 kumpf         1.29  }
 187                     
 188                     //------------------------------------------------------------------------------
 189                     //
 190                     // appendClassPathElement()
 191                     //
 192                     //     <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)>
 193                     //
 194                     //------------------------------------------------------------------------------
 195                     
 196                     void XmlWriter::appendClassPathElement(
 197 mike          1.125     Buffer& out,
 198 kumpf         1.59      const CIMObjectPath& classPath)
 199 kumpf         1.29  {
 200 mike          1.126     out << STRLIT("<CLASSPATH>\n");
 201 kumpf         1.29      appendNameSpacePathElement(out,
 202                                                    classPath.getHost(),
 203                                                    classPath.getNameSpace());
 204                         appendClassNameElement(out, classPath.getClassName());
 205 mike          1.126     out << STRLIT("</CLASSPATH>\n");
 206 kumpf         1.29  }
 207                     
 208                     //------------------------------------------------------------------------------
 209                     //
 210                     // appendInstancePathElement()
 211                     //
 212                     //     <!ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)>
 213                     //
 214                     //------------------------------------------------------------------------------
 215                     
 216                     void XmlWriter::appendInstancePathElement(
 217 mike          1.125     Buffer& out,
 218 kumpf         1.59      const CIMObjectPath& instancePath)
 219 kumpf         1.29  {
 220 mike          1.126     out << STRLIT("<INSTANCEPATH>\n");
 221 kumpf         1.29      appendNameSpacePathElement(out,
 222                                                    instancePath.getHost(),
 223                                                    instancePath.getNameSpace());
 224                         appendInstanceNameElement(out, instancePath);
 225 mike          1.126     out << STRLIT("</INSTANCEPATH>\n");
 226 kumpf         1.29  }
 227                     
 228                     //------------------------------------------------------------------------------
 229                     //
 230                     // appendLocalClassPathElement()
 231                     //
 232                     //     <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)>
 233                     //
 234                     //------------------------------------------------------------------------------
 235                     
 236                     void XmlWriter::appendLocalClassPathElement(
 237 mike          1.125     Buffer& out,
 238 kumpf         1.59      const CIMObjectPath& classPath)
 239 kumpf         1.29  {
 240 mike          1.126     out << STRLIT("<LOCALCLASSPATH>\n");
 241 kumpf         1.29      appendLocalNameSpacePathElement(out, classPath.getNameSpace());
 242                         appendClassNameElement(out, classPath.getClassName());
 243 mike          1.126     out << STRLIT("</LOCALCLASSPATH>\n");
 244 kumpf         1.29  }
 245                     
 246                     //------------------------------------------------------------------------------
 247                     //
 248                     // appendLocalInstancePathElement()
 249                     //
 250                     //     <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH, INSTANCENAME)>
 251                     //
 252                     //------------------------------------------------------------------------------
 253                     
 254                     void XmlWriter::appendLocalInstancePathElement(
 255 mike          1.125     Buffer& out,
 256 kumpf         1.59      const CIMObjectPath& instancePath)
 257 kumpf         1.29  {
 258 mike          1.126     out << STRLIT("<LOCALINSTANCEPATH>\n");
 259 kumpf         1.29      appendLocalNameSpacePathElement(out, instancePath.getNameSpace());
 260                         appendInstanceNameElement(out, instancePath);
 261 mike          1.126     out << STRLIT("</LOCALINSTANCEPATH>\n");
 262 kumpf         1.29  }
 263                     
 264                     //------------------------------------------------------------------------------
 265                     //
 266 kumpf         1.30  // appendLocalObjectPathElement()
 267                     //
 268 kumpf         1.31  //     If the reference refers to an instance, write a LOCALINSTANCEPATH;
 269                     //     otherwise write a LOCALCLASSPATH.
 270 kumpf         1.30  //
 271                     //------------------------------------------------------------------------------
 272                     
 273                     void XmlWriter::appendLocalObjectPathElement(
 274 mike          1.125     Buffer& out,
 275 kumpf         1.59      const CIMObjectPath& objectPath)
 276 kumpf         1.30  {
 277 kumpf         1.68      //
 278                         //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
 279                         //  distinguish instanceNames from classNames in every case
 280 david.dillard 1.121     //  The instanceName of a singleton instance of a keyless class has no
 281 kumpf         1.68      //  key bindings
 282                         //
 283                         if (objectPath.getKeyBindings ().size () != 0)
 284 kumpf         1.30      {
 285                             appendLocalInstancePathElement(out, objectPath);
 286                         }
 287                         else
 288                         {
 289                             appendLocalClassPathElement(out, objectPath);
 290                         }
 291                     }
 292                     
 293                     //------------------------------------------------------------------------------
 294                     //
 295 kumpf         1.54  // Helper functions for appendValueElement()
 296                     //
 297                     //------------------------------------------------------------------------------
 298                     
 299 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Boolean x)
 300 kumpf         1.54  {
 301                         XmlWriter::append(out, x);
 302                     }
 303                     
 304 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Uint8 x)
 305 kumpf         1.54  {
 306                         XmlWriter::append(out, Uint32(x));
 307                     }
 308                     
 309 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Sint8 x)
 310 kumpf         1.54  {
 311                         XmlWriter::append(out, Sint32(x));
 312                     }
 313                     
 314 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Uint16 x)
 315 kumpf         1.54  {
 316                         XmlWriter::append(out, Uint32(x));
 317                     }
 318                     
 319 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Sint16 x)
 320 kumpf         1.54  {
 321                         XmlWriter::append(out, Sint32(x));
 322                     }
 323                     
 324 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Uint32 x)
 325 kumpf         1.54  {
 326                         XmlWriter::append(out, x);
 327                     }
 328                     
 329 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Sint32 x)
 330 kumpf         1.54  {
 331                         XmlWriter::append(out, x);
 332                     }
 333                     
 334 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Uint64 x)
 335 kumpf         1.54  {
 336                         XmlWriter::append(out, x);
 337                     }
 338                     
 339 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Sint64 x)
 340 kumpf         1.54  {
 341                         XmlWriter::append(out, x);
 342                     }
 343                     
 344 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Real32 x)
 345 kumpf         1.54  {
 346 chuck         1.102     XmlWriter::append(out, x);
 347 kumpf         1.54  }
 348                     
 349 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, Real64 x)
 350 kumpf         1.54  {
 351                         XmlWriter::append(out, x);
 352                     }
 353                     
 354 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, const Char16& x)
 355 kumpf         1.54  {
 356                         XmlWriter::appendSpecial(out, x);
 357                     }
 358                     
 359 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, const String& x)
 360 kumpf         1.54  {
 361                         XmlWriter::appendSpecial(out, x);
 362                     }
 363                     
 364 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, const CIMDateTime& x)
 365 kumpf         1.54  {
 366 kumpf         1.136     // It is not necessary to use XmlWriter::appendSpecial(), because
 367                         // CIMDateTime values do not contain special characters.
 368                         out << x.toString();
 369 kumpf         1.54  }
 370                     
 371 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, const CIMObjectPath& x)
 372 kumpf         1.54  {
 373 kumpf         1.56      XmlWriter::appendValueReferenceElement(out, x, true);
 374 kumpf         1.54  }
 375                     
 376 mike          1.125 inline void _xmlWritter_appendValue(Buffer& out, const CIMObject& x)
 377 dave.sudlik   1.114 {
 378 dave.sudlik   1.120     String myStr = x.toString();
 379                         _xmlWritter_appendValue(out, myStr);
 380 dave.sudlik   1.114 }
 381                     
 382 mike          1.126 void _xmlWritter_appendValueArray(
 383                         Buffer& out, const CIMObjectPath* p, Uint32 size)
 384 kumpf         1.54  {
 385 mike          1.126     out << STRLIT("<VALUE.REFARRAY>\n");
 386 kumpf         1.54      while (size--)
 387                         {
 388 s.hills       1.99          _xmlWritter_appendValue(out, *p++);
 389 kumpf         1.54      }
 390 mike          1.126     out << STRLIT("</VALUE.REFARRAY>\n");
 391 kumpf         1.54  }
 392                     
 393                     template<class T>
 394 mike          1.125 void _xmlWritter_appendValueArray(Buffer& out, const T* p, Uint32 size)
 395 kumpf         1.54  {
 396 mike          1.126     out << STRLIT("<VALUE.ARRAY>\n");
 397 kumpf         1.54  
 398                         while (size--)
 399                         {
 400 mike          1.126         out << STRLIT("<VALUE>");
 401 s.hills       1.99          _xmlWritter_appendValue(out, *p++);
 402 mike          1.126         out << STRLIT("</VALUE>\n");
 403 kumpf         1.54      }
 404                     
 405 mike          1.126     out << STRLIT("</VALUE.ARRAY>\n");
 406 kumpf         1.54  }
 407                     
 408                     //------------------------------------------------------------------------------
 409                     //
 410                     // appendValueElement()
 411                     //
 412 kumpf         1.55  //    <!ELEMENT VALUE (#PCDATA)>
 413                     //    <!ELEMENT VALUE.ARRAY (VALUE*)>
 414                     //    <!ELEMENT VALUE.REFERENCE
 415                     //        (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|
 416                     //         INSTANCENAME)>
 417                     //    <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE*)>
 418                     //
 419 kumpf         1.54  //------------------------------------------------------------------------------
 420                     
 421                     void XmlWriter::appendValueElement(
 422 mike          1.125     Buffer& out,
 423 kumpf         1.54      const CIMValue& value)
 424                     {
 425                         if (value.isNull())
 426                         {
 427                             return;
 428                         }
 429                         if (value.isArray())
 430                         {
 431                             switch (value.getType())
 432                             {
 433 kumpf         1.66              case CIMTYPE_BOOLEAN:
 434 kumpf         1.54              {
 435                                     Array<Boolean> a;
 436                                     value.get(a);
 437 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 438 kumpf         1.54                  break;
 439                                 }
 440                     
 441 kumpf         1.66              case CIMTYPE_UINT8:
 442 kumpf         1.54              {
 443                                     Array<Uint8> a;
 444                                     value.get(a);
 445 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 446 kumpf         1.54                  break;
 447                                 }
 448                     
 449 kumpf         1.66              case CIMTYPE_SINT8:
 450 kumpf         1.54              {
 451                                     Array<Sint8> a;
 452                                     value.get(a);
 453 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 454 kumpf         1.54                  break;
 455                                 }
 456                     
 457 kumpf         1.66              case CIMTYPE_UINT16:
 458 kumpf         1.54              {
 459                                     Array<Uint16> a;
 460                                     value.get(a);
 461 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 462 kumpf         1.54                  break;
 463                                 }
 464                     
 465 kumpf         1.66              case CIMTYPE_SINT16:
 466 kumpf         1.54              {
 467                                     Array<Sint16> a;
 468                                     value.get(a);
 469 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 470 kumpf         1.54                  break;
 471                                 }
 472                     
 473 kumpf         1.66              case CIMTYPE_UINT32:
 474 kumpf         1.54              {
 475                                     Array<Uint32> a;
 476                                     value.get(a);
 477 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 478 kumpf         1.54                  break;
 479                                 }
 480                     
 481 kumpf         1.66              case CIMTYPE_SINT32:
 482 kumpf         1.54              {
 483                                     Array<Sint32> a;
 484                                     value.get(a);
 485 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 486 kumpf         1.54                  break;
 487                                 }
 488                     
 489 kumpf         1.66              case CIMTYPE_UINT64:
 490 kumpf         1.54              {
 491                                     Array<Uint64> a;
 492                                     value.get(a);
 493 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 494 kumpf         1.54                  break;
 495                                 }
 496                     
 497 kumpf         1.66              case CIMTYPE_SINT64:
 498 kumpf         1.54              {
 499                                     Array<Sint64> a;
 500                                     value.get(a);
 501 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 502 kumpf         1.54                  break;
 503                                 }
 504                     
 505 kumpf         1.66              case CIMTYPE_REAL32:
 506 kumpf         1.54              {
 507                                     Array<Real32> a;
 508                                     value.get(a);
 509 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 510 kumpf         1.54                  break;
 511                                 }
 512                     
 513 kumpf         1.66              case CIMTYPE_REAL64:
 514 kumpf         1.54              {
 515                                     Array<Real64> a;
 516                                     value.get(a);
 517 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 518 kumpf         1.54                  break;
 519                                 }
 520                     
 521 kumpf         1.66              case CIMTYPE_CHAR16:
 522 kumpf         1.54              {
 523                                     Array<Char16> a;
 524                                     value.get(a);
 525 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 526 kumpf         1.54                  break;
 527                                 }
 528                     
 529 kumpf         1.66              case CIMTYPE_STRING:
 530 kumpf         1.54              {
 531 kumpf         1.146                 const String* data;
 532                                     Uint32 size;
 533                                     value._get(data, size);
 534 mike          1.126                 _xmlWritter_appendValueArray(out, data, size);
 535 kumpf         1.54                  break;
 536                                 }
 537                     
 538 kumpf         1.66              case CIMTYPE_DATETIME:
 539 kumpf         1.54              {
 540                                     Array<CIMDateTime> a;
 541                                     value.get(a);
 542 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 543 kumpf         1.54                  break;
 544                                 }
 545                     
 546 kumpf         1.66              case CIMTYPE_REFERENCE:
 547 kumpf         1.54              {
 548 kumpf         1.59                  Array<CIMObjectPath> a;
 549 kumpf         1.54                  value.get(a);
 550 s.hills       1.99                  _xmlWritter_appendValueArray(out, a.getData(), a.size());
 551 kumpf         1.54                  break;
 552                                 }
 553                     
 554 dave.sudlik   1.114             case CIMTYPE_OBJECT:
 555                                 {
 556                                     Array<CIMObject> a;
 557                                     value.get(a);
 558                                     _xmlWritter_appendValueArray(out, a.getData(), a.size());
 559                                     break;
 560                                 }
 561 a.dunfey      1.137             case CIMTYPE_INSTANCE:
 562                                 {
 563                                     Array<CIMInstance> a;
 564                                     value.get(a);
 565                                     _xmlWritter_appendValueArray(out, a.getData(), a.size());
 566                                     break;
 567                                 }
 568 kumpf         1.54              default:
 569 kumpf         1.78                  PEGASUS_ASSERT(false);
 570 kumpf         1.54          }
 571                         }
 572 kumpf         1.66      else if (value.getType() == CIMTYPE_REFERENCE)
 573 kumpf         1.54      {
 574                             // Has to be separate because it uses VALUE.REFERENCE tag
 575 kumpf         1.59          CIMObjectPath v;
 576 kumpf         1.54          value.get(v);
 577 s.hills       1.99          _xmlWritter_appendValue(out, v);
 578 kumpf         1.54      }
 579                         else
 580                         {
 581 mike          1.126         out << STRLIT("<VALUE>");
 582 kumpf         1.54  
 583                             switch (value.getType())
 584                             {
 585 kumpf         1.66              case CIMTYPE_BOOLEAN:
 586 kumpf         1.54              {
 587                                     Boolean v;
 588                                     value.get(v);
 589 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 590 kumpf         1.54                  break;
 591                                 }
 592                     
 593 kumpf         1.66              case CIMTYPE_UINT8:
 594 kumpf         1.54              {
 595                                     Uint8 v;
 596                                     value.get(v);
 597 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 598 kumpf         1.54                  break;
 599                                 }
 600                     
 601 kumpf         1.66              case CIMTYPE_SINT8:
 602 kumpf         1.54              {
 603                                     Sint8 v;
 604                                     value.get(v);
 605 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 606 kumpf         1.54                  break;
 607                                 }
 608                     
 609 kumpf         1.66              case CIMTYPE_UINT16:
 610 kumpf         1.54              {
 611                                     Uint16 v;
 612                                     value.get(v);
 613 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 614 kumpf         1.54                  break;
 615                                 }
 616                     
 617 kumpf         1.66              case CIMTYPE_SINT16:
 618 kumpf         1.54              {
 619                                     Sint16 v;
 620                                     value.get(v);
 621 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 622 kumpf         1.54                  break;
 623                                 }
 624                     
 625 kumpf         1.66              case CIMTYPE_UINT32:
 626 kumpf         1.54              {
 627                                     Uint32 v;
 628                                     value.get(v);
 629 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 630 kumpf         1.54                  break;
 631                                 }
 632                     
 633 kumpf         1.66              case CIMTYPE_SINT32:
 634 kumpf         1.54              {
 635                                     Sint32 v;
 636                                     value.get(v);
 637 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 638 kumpf         1.54                  break;
 639                                 }
 640                     
 641 kumpf         1.66              case CIMTYPE_UINT64:
 642 kumpf         1.54              {
 643                                     Uint64 v;
 644                                     value.get(v);
 645 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 646 kumpf         1.54                  break;
 647                                 }
 648                     
 649 kumpf         1.66              case CIMTYPE_SINT64:
 650 kumpf         1.54              {
 651                                     Sint64 v;
 652                                     value.get(v);
 653 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 654 kumpf         1.54                  break;
 655                                 }
 656                     
 657 kumpf         1.66              case CIMTYPE_REAL32:
 658 kumpf         1.54              {
 659                                     Real32 v;
 660                                     value.get(v);
 661 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 662 kumpf         1.54                  break;
 663                                 }
 664                     
 665 kumpf         1.66              case CIMTYPE_REAL64:
 666 kumpf         1.54              {
 667                                     Real64 v;
 668                                     value.get(v);
 669 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 670 kumpf         1.54                  break;
 671                                 }
 672                     
 673 kumpf         1.66              case CIMTYPE_CHAR16:
 674 kumpf         1.54              {
 675                                     Char16 v;
 676                                     value.get(v);
 677 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 678 kumpf         1.54                  break;
 679                                 }
 680                     
 681 kumpf         1.66              case CIMTYPE_STRING:
 682 kumpf         1.54              {
 683                                     String v;
 684                                     value.get(v);
 685 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 686 kumpf         1.54                  break;
 687                                 }
 688                     
 689 kumpf         1.66              case CIMTYPE_DATETIME:
 690 kumpf         1.54              {
 691                                     CIMDateTime v;
 692                                     value.get(v);
 693 s.hills       1.99                  _xmlWritter_appendValue(out, v);
 694 kumpf         1.54                  break;
 695                                 }
 696                     
 697 dave.sudlik   1.114             case CIMTYPE_OBJECT:
 698                                 {
 699                                     CIMObject v;
 700                                     value.get(v);
 701                                     _xmlWritter_appendValue(out, v);
 702                                     break;
 703                                 }
 704 a.dunfey      1.137             case CIMTYPE_INSTANCE:
 705                                 {
 706                                     CIMInstance v;
 707                                     value.get(v);
 708                                     _xmlWritter_appendValue(out, v);
 709                                     break;
 710                                 }
 711 kumpf         1.54              default:
 712 kumpf         1.78                  PEGASUS_ASSERT(false);
 713 kumpf         1.54          }
 714                     
 715 mike          1.126         out << STRLIT("</VALUE>\n");
 716 kumpf         1.54      }
 717                     }
 718                     
 719                     void XmlWriter::printValueElement(
 720                         const CIMValue& value,
 721                         PEGASUS_STD(ostream)& os)
 722                     {
 723 mike          1.125     Buffer tmp;
 724 kumpf         1.54      appendValueElement(tmp, value);
 725                         os << tmp.getData() << PEGASUS_STD(endl);
 726                     }
 727                     
 728                     //------------------------------------------------------------------------------
 729                     //
 730 kumpf         1.56  // appendValueObjectWithPathElement()
 731                     //
 732                     //     <!ELEMENT VALUE.OBJECTWITHPATH
 733                     //         ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))>
 734                     //
 735                     //------------------------------------------------------------------------------
 736                     
 737                     void XmlWriter::appendValueObjectWithPathElement(
 738 mike          1.125     Buffer& out,
 739 kumpf         1.62      const CIMObject& objectWithPath)
 740 kumpf         1.56  {
 741 mike          1.126     out << STRLIT("<VALUE.OBJECTWITHPATH>\n");
 742 kumpf         1.56  
 743 kumpf         1.62      appendValueReferenceElement(out, objectWithPath.getPath (), false);
 744                         appendObjectElement(out, objectWithPath);
 745 kumpf         1.56  
 746 mike          1.126     out << STRLIT("</VALUE.OBJECTWITHPATH>\n");
 747 kumpf         1.56  }
 748                     
 749                     //------------------------------------------------------------------------------
 750                     //
 751                     // appendValueReferenceElement()
 752                     //
 753                     //    <!ELEMENT VALUE.REFERENCE
 754                     //        (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|
 755                     //         INSTANCENAME)>
 756                     //
 757                     //------------------------------------------------------------------------------
 758                     
 759                     void XmlWriter::appendValueReferenceElement(
 760 mike          1.125     Buffer& out,
 761 kumpf         1.59      const CIMObjectPath& reference,
 762 kumpf         1.56      Boolean putValueWrapper)
 763                     {
 764                         if (putValueWrapper)
 765 mike          1.126         out << STRLIT("<VALUE.REFERENCE>\n");
 766 kumpf         1.56  
 767                         // See if it is a class or instance reference (instance references have
 768                         // key-bindings; class references do not).
 769 kumpf         1.68      //
 770                         //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
 771                         //  distinguish instanceNames from classNames in every case
 772                         //  The instanceName of a singleton instance of a keyless class has no
 773                         //  key bindings
 774                         //
 775 kumpf         1.56  
 776 mike          1.126     const Array<CIMKeyBinding>& kbs = reference.getKeyBindings();
 777 sage          1.60  
 778 kumpf         1.56      if (kbs.size())
 779                         {
 780                             if (reference.getHost().size())
 781                             {
 782                                 appendInstancePathElement(out, reference);
 783                             }
 784 kumpf         1.67          else if (!reference.getNameSpace().isNull())
 785 kumpf         1.56          {
 786                                 appendLocalInstancePathElement(out, reference);
 787                             }
 788                             else
 789                             {
 790                                 appendInstanceNameElement(out, reference);
 791                             }
 792                         }
 793                         else
 794                         {
 795                             if (reference.getHost().size())
 796                             {
 797                                 appendClassPathElement(out, reference);
 798                             }
 799 kumpf         1.67          else if (!reference.getNameSpace().isNull())
 800 kumpf         1.56          {
 801                                 appendLocalClassPathElement(out, reference);
 802                             }
 803                             else
 804                             {
 805                                 appendClassNameElement(out, reference.getClassName());
 806                             }
 807                         }
 808                     
 809                         if (putValueWrapper)
 810 mike          1.126         out << STRLIT("</VALUE.REFERENCE>\n");
 811 kumpf         1.56  }
 812                     
 813                     void XmlWriter::printValueReferenceElement(
 814 kumpf         1.59      const CIMObjectPath& reference,
 815 kumpf         1.56      PEGASUS_STD(ostream)& os)
 816                     {
 817 mike          1.125     Buffer tmp;
 818 kumpf         1.56      appendValueReferenceElement(tmp, reference, true);
 819                         indentedPrint(os, tmp.getData());
 820                     }
 821                     
 822                     //------------------------------------------------------------------------------
 823                     //
 824                     // appendValueNamedInstanceElement()
 825                     //
 826                     //     <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME,INSTANCE)>
 827                     //
 828                     //------------------------------------------------------------------------------
 829                     
 830                     void XmlWriter::appendValueNamedInstanceElement(
 831 mike          1.125     Buffer& out,
 832 kumpf         1.61      const CIMInstance& namedInstance)
 833 kumpf         1.56  {
 834 mike          1.126     out << STRLIT("<VALUE.NAMEDINSTANCE>\n");
 835 kumpf         1.56  
 836 kumpf         1.61      appendInstanceNameElement(out, namedInstance.getPath ());
 837                         appendInstanceElement(out, namedInstance);
 838 kumpf         1.56  
 839 mike          1.126     out << STRLIT("</VALUE.NAMEDINSTANCE>\n");
 840 kumpf         1.56  }
 841                     
 842                     //------------------------------------------------------------------------------
 843                     //
 844 kumpf         1.55  // appendClassElement()
 845                     //
 846                     //     <!ELEMENT CLASS
 847                     //         (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,METHOD*)>
 848 kumpf         1.56  //     <!ATTLIST CLASS
 849 kumpf         1.55  //         %CIMName;
 850                     //         %SuperClass;>
 851                     //
 852                     //------------------------------------------------------------------------------
 853                     
 854                     void XmlWriter::appendClassElement(
 855 mike          1.125     Buffer& out,
 856 kumpf         1.156     const CIMConstClass& cimClass)
 857 kumpf         1.55  {
 858 kumpf         1.156     CheckRep(cimClass._rep);
 859                         const CIMClassRep* rep = cimClass._rep;
 860                     
 861                         // Class opening element:
 862                     
 863                         out << STRLIT("<CLASS NAME=\"")
 864                             << rep->getClassName()
 865                             << STRLIT("\" ");
 866                     
 867                         if (!rep->getSuperClassName().isNull())
 868                         {
 869                             out << STRLIT(" SUPERCLASS=\"")
 870                                 << rep->getSuperClassName()
 871                                 << STRLIT("\" ");
 872                         }
 873                     
 874                         out << STRLIT(">\n");
 875                     
 876                         // Append Class Qualifiers:
 877                     
 878                         for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
 879 kumpf         1.156         XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
 880                     
 881                         // Append Property definitions:
 882                     
 883                         for (Uint32 i = 0, n = rep->getPropertyCount(); i < n; i++)
 884                             XmlWriter::appendPropertyElement(out, rep->getProperty(i));
 885                     
 886                         // Append Method definitions:
 887                     
 888                         for (Uint32 i = 0, n = rep->getMethodCount(); i < n; i++)
 889                             XmlWriter::appendMethodElement(out, rep->getMethod(i));
 890                     
 891                         // Class closing element:
 892                     
 893                         out << STRLIT("</CLASS>\n");
 894 kumpf         1.55  }
 895                     
 896                     void XmlWriter::printClassElement(
 897                         const CIMConstClass& cimclass,
 898                         PEGASUS_STD(ostream)& os)
 899                     {
 900 mike          1.125     Buffer tmp;
 901 kumpf         1.55      appendClassElement(tmp, cimclass);
 902                         indentedPrint(os, tmp.getData(), 4);
 903                     }
 904                     
 905                     //------------------------------------------------------------------------------
 906                     //
 907                     // appendInstanceElement()
 908                     //
 909                     //     <!ELEMENT INSTANCE
 910                     //         (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*)>
 911                     //     <!ATTLIST INSTANCE
 912                     //         %ClassName;>
 913                     //
 914                     //------------------------------------------------------------------------------
 915                     
 916                     void XmlWriter::appendInstanceElement(
 917 mike          1.125     Buffer& out,
 918 kumpf         1.55      const CIMConstInstance& instance)
 919                     {
 920 marek         1.152     CheckRep(instance._rep);
 921 kumpf         1.156     const CIMInstanceRep* rep = instance._rep;
 922                     
 923                         // Class opening element:
 924                     
 925                         out << STRLIT("<INSTANCE CLASSNAME=\"")
 926                             << rep->getClassName()
 927                             << STRLIT("\" >\n");
 928                     
 929                         // Append Instance Qualifiers:
 930                     
 931                         for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
 932                             XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
 933                     
 934                         // Append Properties:
 935                     
 936                         for (Uint32 i = 0, n = rep->getPropertyCount(); i < n; i++)
 937                             XmlWriter::appendPropertyElement(out, rep->getProperty(i));
 938                     
 939                         // Instance closing element:
 940                     
 941                         out << STRLIT("</INSTANCE>\n");
 942 kumpf         1.55  }
 943                     
 944                     void XmlWriter::printInstanceElement(
 945                         const CIMConstInstance& instance,
 946                         PEGASUS_STD(ostream)& os)
 947                     {
 948 mike          1.125     Buffer tmp;
 949 kumpf         1.55      appendInstanceElement(tmp, instance);
 950                         os << tmp.getData() << PEGASUS_STD(endl);
 951                     }
 952                     
 953                     //------------------------------------------------------------------------------
 954                     //
 955 kumpf         1.56  // appendObjectElement()
 956                     //
 957                     // May refer to a CLASS or an INSTANCE
 958                     //
 959                     //------------------------------------------------------------------------------
 960                     
 961                     void XmlWriter::appendObjectElement(
 962 mike          1.125     Buffer& out,
 963 kumpf         1.56      const CIMConstObject& object)
 964                     {
 965 kumpf         1.73      if (object.isClass())
 966 kumpf         1.56      {
 967                             CIMConstClass c(object);
 968                             appendClassElement(out, c);
 969                         }
 970 kumpf         1.73      else if (object.isInstance())
 971 kumpf         1.56      {
 972 kumpf         1.73          CIMConstInstance i(object);
 973                             appendInstanceElement(out, i);
 974 kumpf         1.56      }
 975 kumpf         1.73      // else PEGASUS_ASSERT(0);
 976 kumpf         1.56  }
 977                     
 978                     //------------------------------------------------------------------------------
 979                     //
 980                     // appendPropertyElement()
 981                     //
 982                     //     <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)>
 983                     //     <!ATTLIST PROPERTY
 984                     //              %CIMName;
 985                     //              %CIMType;           #REQUIRED
 986                     //              %ClassOrigin;
 987                     //              %Propagated;>
 988                     //
 989                     //     <!ELEMENT PROPERTY.ARRAY (QUALIFIER*,VALUE.ARRAY?)>
 990                     //     <!ATTLIST PROPERTY.ARRAY
 991                     //              %CIMName;
 992                     //              %CIMType;           #REQUIRED
 993                     //              %ArraySize;
 994                     //              %ClassOrigin;
 995                     //              %Propagated;>
 996                     //
 997 kumpf         1.56  //     <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*,VALUE.REFERENCE?)>
 998                     //     <!ATTLIST PROPERTY.REFERENCE
 999                     //              %CIMName;
1000                     //              %ReferenceClass;
1001                     //              %ClassOrigin;
1002                     //              %Propagated;>
1003                     //
1004                     //------------------------------------------------------------------------------
1005                     
1006                     void XmlWriter::appendPropertyElement(
1007 mike          1.125     Buffer& out,
1008 kumpf         1.56      const CIMConstProperty& property)
1009                     {
1010 marek         1.152     CheckRep(property._rep);
1011 kumpf         1.156     const CIMPropertyRep* rep = property._rep;
1012                     
1013                         if (rep->getValue().isArray())
1014                         {
1015                             out << STRLIT("<PROPERTY.ARRAY NAME=\"")
1016                                 << rep->getName()
1017                                 << STRLIT("\" ");
1018                     
1019                             if (rep->getValue().getType() == CIMTYPE_OBJECT)
1020                             {
1021                                 // If the property array type is CIMObject, then
1022                                 //     encode the property in CIM-XML as a string array with the
1023                                 //     EmbeddedObject attribute (there is not currently a CIM-XML
1024                                 //     "object" datatype)
1025                     
1026                                 Array<CIMObject> a;
1027                                 rep->getValue().get(a);
1028                                 out << STRLIT(" TYPE=\"string\"");
1029                                 // If the Embedded Object is an instance, always add the
1030                                 // EmbeddedObject attribute.
1031                                 if (a.size() > 0 && a[0].isInstance())
1032 kumpf         1.156             {
1033 kumpf         1.167                 out << STRLIT(" EmbeddedObject=\"object\""
1034 thilo.boehm   1.162                               " EMBEDDEDOBJECT=\"object\"");
1035 kumpf         1.156             }
1036                     #ifndef PEGASUS_SNIA_INTEROP_COMPATIBILITY
1037                                 else
1038                     #endif
1039                                 {
1040                                     // Else the Embedded Object is a class, always add the
1041                                     // EmbeddedObject qualifier.  Note that if the macro
1042                                     // PEGASUS_SNIA_INTEROP_COMPATIBILITY is defined, then
1043                                     // the EmbeddedObject qualifier will always be added,
1044                                     // whether it's a class or an instance.
1045 thilo.boehm   1.159                 if (rep->findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT) ==
1046 kumpf         1.156                         PEG_NOT_FOUND)
1047                                     {
1048                                         // Note that addQualifiers() cannot be called on a const
1049                                         // CIMQualifierRep.  In this case we really do want to add
1050                                         // the EmbeddedObject qualifier, so we cast away the
1051                                         // constness.
1052                                         CIMPropertyRep* tmpRep = const_cast<CIMPropertyRep*>(rep);
1053                                         tmpRep->addQualifier(
1054 kumpf         1.167                         CIMQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT,
1055 thilo.boehm   1.159                                      true));
1056 kumpf         1.156                 }
1057                                 }
1058                             }
1059                             else if (rep->getValue().getType() == CIMTYPE_INSTANCE)
1060                             {
1061                                 // If the property array type is CIMInstance, then
1062                                 //   encode the property in CIM-XML as a string array with the
1063                                 //   EmbeddedObject attribute (there is not currently a CIM-XML
1064                                 //   "instance" datatype)
1065                     
1066                                 Array<CIMInstance> a;
1067                                 rep->getValue().get(a);
1068                                 out << STRLIT(" TYPE=\"string\"");
1069                     
1070                                 // add the EmbeddedObject attribute
1071                                 if (a.size() > 0)
1072                                 {
1073 kumpf         1.167                 out << STRLIT(" EmbeddedObject=\"instance\""
1074 thilo.boehm   1.162                               " EMBEDDEDOBJECT=\"instance\"");
1075 kumpf         1.156 
1076                                     // Note that if the macro PEGASUS_SNIA_INTEROP_COMPATIBILITY is
1077                                     // defined, then the EmbeddedInstance qualifier will be added
1078                     # ifdef PEGASUS_SNIA_INTEROP_COMPATIBILITY
1079 thilo.boehm   1.159                 if (rep->findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE ==
1080 kumpf         1.156                         PEG_NOT_FOUND)
1081                                     {
1082                                         // Note that addQualifiers() cannot be called on a const
1083                                         // CIMQualifierRep.  In this case we really do want to add
1084                                         // the EmbeddedInstance qualifier, so we cast away the
1085                                         // constness.
1086                     
1087                                         // For now, we assume that all the embedded instances in
1088                                         // the array are of the same type
1089                                         CIMPropertyRep* tmpRep = const_cast<CIMPropertyRep*>(rep);
1090                                         tmpRep->addQualifier(CIMQualifier(
1091 thilo.boehm   1.159                         PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE,
1092 kumpf         1.156                         a[0].getClassName().getString()));
1093                                     }
1094                     # endif
1095                                 }
1096                             }
1097                             else
1098                             {
1099 thilo.boehm   1.162             out.append(' ');
1100                                 out << _XmlWriterTypeStrings[rep->getValue().getType()];
1101 kumpf         1.156         }
1102                     
1103                             if (rep->getArraySize())
1104                             {
1105                                 char buffer[32];
1106 kumpf         1.158             sprintf(buffer, "%u", rep->getArraySize());
1107 kumpf         1.156             out << STRLIT(" ARRAYSIZE=\"") << buffer;
1108                                 out.append('"');
1109                             }
1110                     
1111                             if (!rep->getClassOrigin().isNull())
1112                             {
1113                                 out << STRLIT(" CLASSORIGIN=\"") << rep->getClassOrigin();
1114                                 out.append('"');
1115                             }
1116                     
1117                             if (rep->getPropagated())
1118                             {
1119                                 out << STRLIT(" PROPAGATED=\"true\"");
1120                             }
1121                     
1122                             out << STRLIT(">\n");
1123                     
1124                             for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1125                                 XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1126                     
1127                             XmlWriter::appendValueElement(out, rep->getValue());
1128 kumpf         1.156 
1129                             out << STRLIT("</PROPERTY.ARRAY>\n");
1130                         }
1131                         else if (rep->getValue().getType() == CIMTYPE_REFERENCE)
1132                         {
1133 kumpf         1.167         out << STRLIT("<PROPERTY.REFERENCE"
1134 thilo.boehm   1.162                       " NAME=\"") << rep->getName() << STRLIT("\" ");
1135 kumpf         1.156 
1136                             if (!rep->getReferenceClassName().isNull())
1137                             {
1138                                 out << STRLIT(" REFERENCECLASS=\"") << rep->getReferenceClassName();
1139                                 out.append('"');
1140                             }
1141                     
1142                             if (!rep->getClassOrigin().isNull())
1143                             {
1144                                 out << STRLIT(" CLASSORIGIN=\"") << rep->getClassOrigin();
1145                                 out.append('"');
1146                             }
1147                     
1148                             if (rep->getPropagated())
1149                             {
1150                                 out << STRLIT(" PROPAGATED=\"true\"");
1151                             }
1152                     
1153                             out << STRLIT(">\n");
1154                     
1155                             for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1156 kumpf         1.156             XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1157                     
1158                             XmlWriter::appendValueElement(out, rep->getValue());
1159                     
1160                             out << STRLIT("</PROPERTY.REFERENCE>\n");
1161                         }
1162                         else
1163                         {
1164                             out << STRLIT("<PROPERTY NAME=\"") << rep->getName() << STRLIT("\" ");
1165                     
1166                             if (!rep->getClassOrigin().isNull())
1167                             {
1168                                 out << STRLIT(" CLASSORIGIN=\"") << rep->getClassOrigin();
1169                                 out.append('"');
1170                             }
1171                     
1172                             if (rep->getPropagated())
1173                             {
1174                                 out << STRLIT(" PROPAGATED=\"true\"");
1175                             }
1176                     
1177 kumpf         1.156         if (rep->getValue().getType() == CIMTYPE_OBJECT)
1178                             {
1179                                 // If the property type is CIMObject, then
1180                                 //   encode the property in CIM-XML as a string with the
1181                                 //   EmbeddedObject attribute (there is not currently a CIM-XML
1182                                 //   "object" datatype)
1183                     
1184                                 CIMObject a;
1185                                 rep->getValue().get(a);
1186                                 out << STRLIT(" TYPE=\"string\"");
1187                     
1188                                 // If the Embedded Object is an instance, always add the
1189                                 // EmbeddedObject attribute.
1190                                 if (a.isInstance())
1191                                 {
1192 kumpf         1.167                 out << STRLIT(" EmbeddedObject=\"object\""
1193 thilo.boehm   1.162                               " EMBEDDEDOBJECT=\"object\"");
1194 kumpf         1.156             }
1195                                 // Else the Embedded Object is a class, always add the
1196                                 // EmbeddedObject qualifier.
1197                     #ifndef PEGASUS_SNIA_INTEROP_COMPATIBILITY
1198                                 else
1199                     #endif
1200                                 {
1201                                     // Note that if the macro PEGASUS_SNIA_INTEROP_COMPATIBILITY
1202                                     // is defined, then the EmbeddedObject qualifier will always
1203                                     // be added, whether it's a class or an instance.
1204 thilo.boehm   1.159                 if (rep->findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT) ==
1205 kumpf         1.156                         PEG_NOT_FOUND)
1206                                     {
1207                                         // Note that addQualifiers() cannot be called on a const
1208                                         // CIMQualifierRep.  In this case we really do want to add
1209                                         // the EmbeddedObject qualifier, so we cast away the
1210                                         // constness.
1211                                         CIMPropertyRep* tmpRep = const_cast<CIMPropertyRep*>(rep);
1212                                         tmpRep->addQualifier(
1213 kumpf         1.167                         CIMQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT,
1214 thilo.boehm   1.159                                      true));
1215 kumpf         1.156                 }
1216                                 }
1217                             }
1218                             else if (rep->getValue().getType() == CIMTYPE_INSTANCE)
1219                             {
1220                                 CIMInstance a;
1221                                 rep->getValue().get(a);
1222 kumpf         1.167             out << STRLIT(" TYPE=\"string\""
1223                                               " EmbeddedObject=\"instance\""
1224 thilo.boehm   1.162                           " EMBEDDEDOBJECT=\"instance\"");
1225 kumpf         1.156 
1226                     # ifdef PEGASUS_SNIA_INTEROP_COMPATIBILITY
1227 kumpf         1.167             if (rep->findQualifier(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT)
1228 thilo.boehm   1.159                 == PEG_NOT_FOUND)
1229 kumpf         1.156             {
1230                                     // Note that addQualifiers() cannot be called on a const
1231                                     // CIMQualifierRep.  In this case we really do want to add
1232                                     // the EmbeddedInstance qualifier, so we cast away the
1233                                     // constness.
1234                                     CIMPropertyRep* tmpRep = const_cast<CIMPropertyRep*>(rep);
1235                                     tmpRep->addQualifier(CIMQualifier(
1236 thilo.boehm   1.159                     PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE,
1237 kumpf         1.156                     a.getClassName().getString()));
1238                                 }
1239                     # endif
1240                             }
1241                             else
1242                             {
1243 thilo.boehm   1.162             out.append(' ');
1244                                 out << _XmlWriterTypeStrings[rep->getValue().getType()];
1245 kumpf         1.156         }
1246                     
1247                             out << STRLIT(">\n");
1248                     
1249                             for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1250                                 XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1251                     
1252                             XmlWriter::appendValueElement(out, rep->getValue());
1253                     
1254                             out << STRLIT("</PROPERTY>\n");
1255                         }
1256 kumpf         1.56  }
1257                     
1258                     void XmlWriter::printPropertyElement(
1259                         const CIMConstProperty& property,
1260                         PEGASUS_STD(ostream)& os)
1261                     {
1262 mike          1.125     Buffer tmp;
1263 kumpf         1.56      appendPropertyElement(tmp, property);
1264                         os << tmp.getData() << PEGASUS_STD(endl);
1265                     }
1266                     
1267                     //------------------------------------------------------------------------------
1268                     //
1269                     // appendMethodElement()
1270                     //
1271                     //     <!ELEMENT METHOD (QUALIFIER*,
1272                     //         (PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)>
1273                     //     <!ATTLIST METHOD
1274                     //              %CIMName;
1275                     //              %CIMType;          #IMPLIED
1276                     //              %ClassOrigin;
1277                     //              %Propagated;>
1278                     //
1279                     //------------------------------------------------------------------------------
1280                     
1281                     void XmlWriter::appendMethodElement(
1282 mike          1.125     Buffer& out,
1283 kumpf         1.56      const CIMConstMethod& method)
1284                     {
1285 marek         1.152     CheckRep(method._rep);
1286 kumpf         1.156     const CIMMethodRep* rep = method._rep;
1287                     
1288                         out << STRLIT("<METHOD NAME=\"") << rep->getName();
1289 thilo.boehm   1.162     out << STRLIT("\" ");
1290 kumpf         1.156 
1291 thilo.boehm   1.162     out << _XmlWriterTypeStrings[rep->getType()];
1292 kumpf         1.156 
1293                         if (!rep->getClassOrigin().isNull())
1294                         {
1295                             out << STRLIT(" CLASSORIGIN=\"") << rep->getClassOrigin();
1296                             out.append('"');
1297                         }
1298                     
1299                         if (rep->getPropagated())
1300                         {
1301                             out << STRLIT(" PROPAGATED=\"true\"");
1302                         }
1303                     
1304                         out << STRLIT(">\n");
1305                     
1306                         for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1307                             XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1308                     
1309                         for (Uint32 i = 0, n = rep->getParameterCount(); i < n; i++)
1310                             XmlWriter::appendParameterElement(out, rep->getParameter(i));
1311                     
1312                         out << STRLIT("</METHOD>\n");
1313 kumpf         1.56  }
1314                     
1315                     void XmlWriter::printMethodElement(
1316                         const CIMConstMethod& method,
1317                         PEGASUS_STD(ostream)& os)
1318                     {
1319 mike          1.125     Buffer tmp;
1320 kumpf         1.56      appendMethodElement(tmp, method);
1321                         os << tmp.getData() << PEGASUS_STD(endl);
1322                     }
1323                     
1324                     //------------------------------------------------------------------------------
1325                     //
1326                     // appendParameterElement()
1327                     //
1328                     //     <!ELEMENT PARAMETER (QUALIFIER*)>
1329                     //     <!ATTLIST PARAMETER
1330                     //              %CIMName;
1331                     //              %CIMType;      #REQUIRED>
1332                     //
1333                     //     <!ELEMENT PARAMETER.REFERENCE (QUALIFIER*)>
1334                     //     <!ATTLIST PARAMETER.REFERENCE
1335                     //              %CIMName;
1336                     //              %ReferenceClass;>
1337                     //
1338                     //     <!ELEMENT PARAMETER.ARRAY (QUALIFIER*)>
1339                     //     <!ATTLIST PARAMETER.ARRAY
1340                     //              %CIMName;
1341 kumpf         1.56  //              %CIMType;           #REQUIRED
1342                     //              %ArraySize;>
1343                     //
1344                     //     <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)>
1345                     //     <!ATTLIST PARAMETER.REFARRAY
1346                     //              %CIMName;
1347                     //              %ReferenceClass;
1348                     //              %ArraySize;>
1349                     //
1350                     //------------------------------------------------------------------------------
1351                     
1352                     void XmlWriter::appendParameterElement(
1353 mike          1.125     Buffer& out,
1354 kumpf         1.56      const CIMConstParameter& parameter)
1355                     {
1356 marek         1.152     CheckRep(parameter._rep);
1357 kumpf         1.156     const CIMParameterRep* rep = parameter._rep;
1358                     
1359                         if (rep->isArray())
1360                         {
1361                             if (rep->getType() == CIMTYPE_REFERENCE)
1362                             {
1363                                 out << STRLIT("<PARAMETER.REFARRAY NAME=\"") << rep->getName();
1364                                 out.append('"');
1365                     
1366                                 if (!rep->getReferenceClassName().isNull())
1367                                 {
1368                                     out << STRLIT(" REFERENCECLASS=\"");
1369                                     out << rep->getReferenceClassName().getString();
1370                                     out.append('"');
1371                                 }
1372                     
1373                                 if (rep->getArraySize())
1374                                 {
1375                                     char buffer[32];
1376 kumpf         1.158                 int n = sprintf(buffer, "%u", rep->getArraySize());
1377 kumpf         1.156                 out << STRLIT(" ARRAYSIZE=\"");
1378                                     out.append(buffer, n);
1379                                     out.append('"');
1380                                 }
1381                     
1382                                 out << STRLIT(">\n");
1383                     
1384                                 for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1385                                     XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1386                     
1387                                 out << STRLIT("</PARAMETER.REFARRAY>\n");
1388                             }
1389                             else
1390                             {
1391 kumpf         1.167             out << STRLIT("<PARAMETER.ARRAY"
1392 thilo.boehm   1.162                           " NAME=\"") << rep->getName();
1393                                 out << STRLIT("\" ") << _XmlWriterTypeStrings[rep->getType()];
1394 kumpf         1.167 
1395 kumpf         1.156             if (rep->getArraySize())
1396                                 {
1397                                     char buffer[32];
1398 kumpf         1.158                 sprintf(buffer, "%u", rep->getArraySize());
1399 kumpf         1.156                 out << STRLIT(" ARRAYSIZE=\"") << buffer;
1400                                     out.append('"');
1401                                 }
1402                     
1403                                 out << STRLIT(">\n");
1404                     
1405                                 for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1406                                     XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1407                     
1408                                 out << STRLIT("</PARAMETER.ARRAY>\n");
1409                             }
1410                         }
1411                         else if (rep->getType() == CIMTYPE_REFERENCE)
1412                         {
1413 kumpf         1.167         out << STRLIT("<PARAMETER.REFERENCE"
1414 thilo.boehm   1.162                       " NAME=\"") << rep->getName();
1415 kumpf         1.156         out.append('"');
1416                     
1417                             if (!rep->getReferenceClassName().isNull())
1418                             {
1419                                 out << STRLIT(" REFERENCECLASS=\"");
1420                                 out << rep->getReferenceClassName().getString();
1421                                 out.append('"');
1422                             }
1423                             out << STRLIT(">\n");
1424                     
1425                             for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1426                                 XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1427                     
1428                             out << STRLIT("</PARAMETER.REFERENCE>\n");
1429                         }
1430                         else
1431                         {
1432 kumpf         1.167         out << STRLIT("<PARAMETER"
1433 thilo.boehm   1.162                       " NAME=\"") << rep->getName();
1434                             out << STRLIT("\" ") << _XmlWriterTypeStrings[rep->getType()];
1435                     
1436                             out << STRLIT(">\n");
1437 kumpf         1.156 
1438                             for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)
1439                                 XmlWriter::appendQualifierElement(out, rep->getQualifier(i));
1440                     
1441                             out << STRLIT("</PARAMETER>\n");
1442                         }
1443 kumpf         1.56  }
1444                     
1445                     void XmlWriter::printParameterElement(
1446                         const CIMConstParameter& parameter,
1447                         PEGASUS_STD(ostream)& os)
1448                     {
1449 mike          1.125     Buffer tmp;
1450 kumpf         1.56      appendParameterElement(tmp, parameter);
1451                         os << tmp.getData() << PEGASUS_STD(endl);
1452                     }
1453                     
1454                     //------------------------------------------------------------------------------
1455                     //
1456                     // appendParamValueElement()
1457                     //
1458                     //     <!ELEMENT PARAMVALUE (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?>
1459                     //     <!ATTLIST PARAMVALUE
1460 kumpf         1.156 //         %CIMName;
1461                     //         %EmbeddedObject; #IMPLIED
1462                     //         %ParamType;>
1463 kumpf         1.56  //
1464                     //------------------------------------------------------------------------------
1465                     
1466                     void XmlWriter::appendParamValueElement(
1467 mike          1.125     Buffer& out,
1468 kumpf         1.56      const CIMParamValue& paramValue)
1469                     {
1470 marek         1.152     CheckRep(paramValue._rep);
1471 kumpf         1.156     const CIMParamValueRep* rep = paramValue._rep;
1472                     
1473                         out << STRLIT("<PARAMVALUE NAME=\"") << rep->getParameterName();
1474                         out.append('"');
1475                     
1476                         CIMType type = rep->getValue().getType();
1477                     
1478                         if (rep->isTyped())
1479                         {
1480                             XmlWriter::appendParamTypeAndEmbeddedObjAttrib(out, type);
1481                         }
1482                     
1483                         out << STRLIT(">\n");
1484                         XmlWriter::appendValueElement(out, rep->getValue());
1485                     
1486                         out << STRLIT("</PARAMVALUE>\n");
1487 kumpf         1.56  }
1488                     
1489                     void XmlWriter::printParamValueElement(
1490                         const CIMParamValue& paramValue,
1491                         PEGASUS_STD(ostream)& os)
1492                     {
1493 mike          1.125     Buffer tmp;
1494 kumpf         1.56      appendParamValueElement(tmp, paramValue);
1495                         os << tmp.getData() << PEGASUS_STD(endl);
1496                     }
1497                     
1498                     //------------------------------------------------------------------------------
1499                     //
1500                     // appendQualifierElement()
1501                     //
1502                     //     <!ELEMENT QUALIFIER (VALUE|VALUE.ARRAY)>
1503                     //     <!ATTLIST QUALIFIER
1504                     //              %CIMName;
1505                     //              %CIMType;               #REQUIRED
1506                     //              %Propagated;
1507                     //              %QualifierFlavor;>
1508                     //
1509                     //------------------------------------------------------------------------------
1510                     
1511                     void XmlWriter::appendQualifierElement(
1512 mike          1.125     Buffer& out,
1513 kumpf         1.56      const CIMConstQualifier& qualifier)
1514                     {
1515 marek         1.152     CheckRep(qualifier._rep);
1516 kumpf         1.156     const CIMQualifierRep* rep = qualifier._rep;
1517                     
1518                         out << STRLIT("<QUALIFIER NAME=\"") << rep->getName();
1519 thilo.boehm   1.162     out << STRLIT("\" ") << _XmlWriterTypeStrings[rep->getValue().getType()];
1520 kumpf         1.156 
1521                         if (rep->getPropagated())
1522                         {
1523                             out << STRLIT(" PROPAGATED=\"true\"");
1524                         }
1525                     
1526                         XmlWriter::appendQualifierFlavorEntity(out, rep->getFlavor());
1527                     
1528                         out << STRLIT(">\n");
1529                     
1530                         XmlWriter::appendValueElement(out, rep->getValue());
1531                     
1532                         out << STRLIT("</QUALIFIER>\n");
1533 kumpf         1.56  }
1534                     
1535                     void XmlWriter::printQualifierElement(
1536                         const CIMConstQualifier& qualifier,
1537                         PEGASUS_STD(ostream)& os)
1538                     {
1539 mike          1.125     Buffer tmp;
1540 kumpf         1.56      appendQualifierElement(tmp, qualifier);
1541                         os << tmp.getData() << PEGASUS_STD(endl);
1542                     }
1543                     
1544                     //------------------------------------------------------------------------------
1545                     //
1546                     // appendQualifierDeclElement()
1547                     //
1548                     //     <!ELEMENT QUALIFIER.DECLARATION (SCOPE?,(VALUE|VALUE.ARRAY)?)>
1549                     //     <!ATTLIST QUALIFIER.DECLARATION
1550                     //              %CIMName;
1551                     //              %CIMType;                       #REQUIRED
1552                     //              ISARRAY        (true|false)     #IMPLIED
1553                     //              %ArraySize;
1554                     //              %QualifierFlavor;>
1555                     //
1556                     //------------------------------------------------------------------------------
1557                     
1558                     void XmlWriter::appendQualifierDeclElement(
1559 mike          1.125     Buffer& out,
1560 kumpf         1.56      const CIMConstQualifierDecl& qualifierDecl)
1561                     {
1562 marek         1.152     CheckRep(qualifierDecl._rep);
1563 kumpf         1.156     const CIMQualifierDeclRep* rep = qualifierDecl._rep;
1564                     
1565                         out << STRLIT("<QUALIFIER.DECLARATION NAME=\"") << rep->getName();
1566 thilo.boehm   1.162     out << STRLIT("\" ") << _XmlWriterTypeStrings[rep->getValue().getType()];
1567 kumpf         1.156 
1568                         if (rep->getValue().isArray())
1569                         {
1570                             out << STRLIT(" ISARRAY=\"true\"");
1571                     
1572                             if (rep->getArraySize())
1573                             {
1574                                 char buffer[64];
1575 kumpf         1.158             int n = sprintf(buffer, " ARRAYSIZE=\"%u\"", rep->getArraySize());
1576 kumpf         1.156             out.append(buffer, n);
1577                             }
1578                         }
1579                     
1580                         XmlWriter::appendQualifierFlavorEntity(out, rep->getFlavor());
1581                     
1582                         out << STRLIT(">\n");
1583                     
1584                         XmlWriter::appendScopeElement(out, rep->getScope());
1585                         XmlWriter::appendValueElement(out, rep->getValue());
1586                     
1587                         out << STRLIT("</QUALIFIER.DECLARATION>\n");
1588 kumpf         1.56  }
1589                     
1590                     void XmlWriter::printQualifierDeclElement(
1591                         const CIMConstQualifierDecl& qualifierDecl,
1592                         PEGASUS_STD(ostream)& os)
1593                     {
1594 mike          1.125     Buffer tmp;
1595 kumpf         1.56      appendQualifierDeclElement(tmp, qualifierDecl);
1596                         os << tmp.getData() << PEGASUS_STD(endl);
1597                     }
1598                     
1599                     //------------------------------------------------------------------------------
1600                     //
1601 kumpf         1.57  // appendQualifierFlavorEntity()
1602                     //
1603                     //     <!ENTITY % QualifierFlavor "OVERRIDABLE  (true|false)   'true'
1604                     //                                 TOSUBCLASS   (true|false)   'true'
1605                     //                                 TOINSTANCE   (true|false)   'false'
1606                     //                                 TRANSLATABLE (true|false)   'false'">
1607                     //
1608 kumpf         1.168 //     DEPRECATION NOTE:  The attribute TOINSTANCE is DEPRECATED and MAY be
1609                     //     removed from the QualifierFlavor entity in a future version of this
1610                     //     document.  Use of this qualifier is discouraged.
1611                     //
1612 kumpf         1.57  //------------------------------------------------------------------------------
1613                     
1614                     void XmlWriter::appendQualifierFlavorEntity(
1615 mike          1.125     Buffer& out,
1616 kumpf         1.70      const CIMFlavor & flavor)
1617 kumpf         1.57  {
1618 kumpf         1.70      if (!(flavor.hasFlavor (CIMFlavor::OVERRIDABLE)))
1619 mike          1.126         out << STRLIT(" OVERRIDABLE=\"false\"");
1620 kumpf         1.57  
1621 kumpf         1.70      if (!(flavor.hasFlavor (CIMFlavor::TOSUBCLASS)))
1622 mike          1.126         out << STRLIT(" TOSUBCLASS=\"false\"");
1623 kumpf         1.57  
1624 kumpf         1.168     //if (flavor.hasFlavor (CIMFlavor::TOINSTANCE))
1625                         //    out << STRLIT(" TOINSTANCE=\"true\"");
1626 kumpf         1.57  
1627 kumpf         1.70      if (flavor.hasFlavor (CIMFlavor::TRANSLATABLE))
1628 mike          1.126         out << STRLIT(" TRANSLATABLE=\"true\"");
1629 kumpf         1.57  }
1630                     
1631                     //------------------------------------------------------------------------------
1632                     //
1633 kumpf         1.58  // appendScopeElement()
1634                     //
1635                     //     <!ELEMENT SCOPE EMPTY>
1636                     //     <!ATTLIST SCOPE
1637                     //              CLASS        (true|false)      'false'
1638                     //              ASSOCIATION  (true|false)      'false'
1639                     //              REFERENCE    (true|false)      'false'
1640                     //              PROPERTY     (true|false)      'false'
1641                     //              METHOD       (true|false)      'false'
1642                     //              PARAMETER    (true|false)      'false'
1643                     //              INDICATION   (true|false)      'false'>
1644                     //
1645                     //------------------------------------------------------------------------------
1646                     
1647                     void XmlWriter::appendScopeElement(
1648 mike          1.125     Buffer& out,
1649 kumpf         1.69      const CIMScope & scope)
1650 kumpf         1.58  {
1651 kumpf         1.69      if (!(scope.equal (CIMScope ())))
1652 kumpf         1.58      {
1653 mike          1.126         out << STRLIT("<SCOPE");
1654 kumpf         1.58  
1655 kumpf         1.69          if (scope.hasScope (CIMScope::CLASS))
1656 mike          1.126             out << STRLIT(" CLASS=\"true\"");
1657 kumpf         1.58  
1658 kumpf         1.69          if (scope.hasScope (CIMScope::ASSOCIATION))
1659 mike          1.126             out << STRLIT(" ASSOCIATION=\"true\"");
1660 kumpf         1.58  
1661 kumpf         1.69          if (scope.hasScope (CIMScope::REFERENCE))
1662 mike          1.126             out << STRLIT(" REFERENCE=\"true\"");
1663 kumpf         1.58  
1664 kumpf         1.69          if (scope.hasScope (CIMScope::PROPERTY))
1665 mike          1.126             out << STRLIT(" PROPERTY=\"true\"");
1666 kumpf         1.58  
1667 kumpf         1.69          if (scope.hasScope (CIMScope::METHOD))
1668 mike          1.126             out << STRLIT(" METHOD=\"true\"");
1669 kumpf         1.58  
1670 kumpf         1.69          if (scope.hasScope (CIMScope::PARAMETER))
1671 mike          1.126             out << STRLIT(" PARAMETER=\"true\"");
1672 kumpf         1.58  
1673 kumpf         1.69          if (scope.hasScope (CIMScope::INDICATION))
1674 mike          1.126             out << STRLIT(" INDICATION=\"true\"");
1675 kumpf         1.58  
1676 mike          1.126         out << STRLIT("/>");
1677 kumpf         1.58      }
1678                     }
1679                     
1680 david.dillard 1.121 // l10n - added content language and accept language support to
1681 chuck         1.89  // the header methods below
1682                     
1683 kumpf         1.58  //------------------------------------------------------------------------------
1684                     //
1685 kumpf         1.27  // appendMethodCallHeader()
1686 mike          1.23  //
1687 kumpf         1.31  //     Build HTTP method call request header.
1688 mike          1.23  //
1689                     //------------------------------------------------------------------------------
1690                     
1691 kumpf         1.27  void XmlWriter::appendMethodCallHeader(
1692 mike          1.125     Buffer& out,
1693 mike          1.23      const char* host,
1694 kumpf         1.80      const CIMName& cimMethod,
1695 mike          1.23      const String& cimObject,
1696 mike          1.24      const String& authenticationHeader,
1697 kumpf         1.82      HttpMethod httpMethod,
1698 kumpf         1.133     const AcceptLanguageList& acceptLanguages,
1699                         const ContentLanguageList& contentLanguages,
1700 mike          1.164     Uint32 contentLength,
1701                         bool binaryRequest,
1702                         bool binaryResponse)
1703 mike          1.23  {
1704                         char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
1705                     
1706 karl          1.81      // ATTN: KS 20020926 - Temporary change to issue only POST. This may
1707                         // be changed in the DMTF CIM Operations standard in the future.
1708                         // If we kept M-Post we would have to retry with Post. Does not
1709                         // do that in client today. Permanent change is to retry until spec
1710                         // updated. This change is temp to finish tests or until the retry
1711                         // installed.  Required because of change to wbemservices cimom
1712 kumpf         1.82      if (httpMethod == HTTP_METHOD_M_POST)
1713                         {
1714 mike          1.126         out << STRLIT("M-POST /cimom HTTP/1.1\r\n");
1715 kumpf         1.82      }
1716                         else
1717                         {
1718 mike          1.126         out << STRLIT("POST /cimom HTTP/1.1\r\n");
1719 kumpf         1.82      }
1720 mike          1.164     out << STRLIT("HOST: ") << host << STRLIT("\r\n");
1721                     
1722                         if (binaryRequest)
1723                         {
1724                             // Tell the server that the payload is encoded in the OpenPegasus
1725                             // binary protocol.
1726                             out << STRLIT("Content-Type: application/x-openpegasus\r\n");
1727                         }
1728                         else
1729                         {
1730                             out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");
1731                         }
1732                     
1733                         if (binaryResponse)
1734                         {
1735                             // Tell the server that this client accepts the OpenPegasus binary
1736                             // protocol.
1737                             out << STRLIT("Accept: application/x-openpegasus\r\n");
1738                         }
1739                     
1740 kumpf         1.157     OUTPUT_CONTENTLENGTH(out, contentLength);
1741 chuck         1.89      if (acceptLanguages.size() > 0)
1742                         {
1743 kumpf         1.146         out << STRLIT("Accept-Language: ") << acceptLanguages << STRLIT("\r\n");
1744 chuck         1.89      }
1745                         if (contentLanguages.size() > 0)
1746                         {
1747 kumpf         1.146         out << STRLIT("Content-Language: ") << contentLanguages <<
1748                                 STRLIT("\r\n");
1749 david.dillard 1.121     }
1750 brian.campbell 1.107 
1751 brian.campbell 1.113 #ifdef PEGASUS_DEBUG
1752 kumpf          1.146     // backdoor environment variable to turn OFF client requesting transfer
1753                          // encoding. The default is on. to turn off, set this variable to zero.
1754                          // This should be removed when stable. This should only be turned off in
1755                          // a debugging/testing environment.
1756 brian.campbell 1.113 
1757 kumpf          1.146     static const char *clientTransferEncodingOff =
1758                              getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST");
1759 karl           1.142 
1760 kumpf          1.146     if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0')
1761 a.dunfey       1.110 #endif
1762 brian.campbell 1.113 
1763 mike           1.164     if (!binaryResponse)
1764                          {
1765                              // The binary protocol does not allow chunking.
1766                              out << STRLIT("TE: chunked, trailers\r\n");
1767                          }
1768 brian.campbell 1.107 
1769 kumpf          1.82      if (httpMethod == HTTP_METHOD_M_POST)
1770                          {
1771 mike           1.126         out << STRLIT("Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");
1772                              out << nn << STRLIT("\r\n");
1773                              out << nn << STRLIT("-CIMOperation: MethodCall\r\n");
1774                              out << nn << STRLIT("-CIMMethod: ")
1775                                  << encodeURICharacters(cimMethod.getString()) << STRLIT("\r\n");
1776 kumpf          1.167         out << nn << STRLIT("-CIMObject: ")
1777 kumpf          1.157             << encodeURICharacters(cimObject) << STRLIT("\r\n");
1778 kumpf          1.82      }
1779 david.dillard  1.121     else
1780 kumpf          1.82      {
1781 mike           1.126         out << STRLIT("CIMOperation: MethodCall\r\n");
1782 kumpf          1.146         out << STRLIT("CIMMethod: ")
1783 kumpf          1.157             << encodeURICharacters(cimMethod.getString()) << STRLIT("\r\n");
1784 david.dillard  1.130         out << STRLIT("CIMObject: ") << encodeURICharacters(cimObject)
1785 kumpf          1.146             << STRLIT("\r\n");
1786 kumpf          1.82      }
1787                      
1788 mike           1.24      if (authenticationHeader.size())
1789                          {
1790 mike           1.126         out << authenticationHeader << STRLIT("\r\n");
1791 mike           1.24      }
1792 brian.campbell 1.107 
1793 mike           1.126     out << STRLIT("\r\n");
1794 mike           1.23  }
1795                      
1796 chuck          1.89  
1797 kumpf          1.27  void XmlWriter::appendMethodResponseHeader(
1798 mike           1.125      Buffer& out,
1799 w.white        1.108      HttpMethod httpMethod,
1800 kumpf          1.133      const ContentLanguageList& contentLanguages,
1801 w.white        1.108      Uint32 contentLength,
1802 mike           1.164      Uint64 serverResponseTime,
1803                           bool binaryResponse)
1804 brian.campbell 1.113 {
1805 mike           1.164     // Optimize the typical case for binary messages, circumventing the
1806                          // more expensive logic below.
1807 kumpf          1.167     if (binaryResponse &&
1808 mike           1.164         contentLength == 0 &&
1809                              httpMethod != HTTP_METHOD_M_POST &&
1810                              contentLanguages.size() == 0)
1811                          {
1812                              static const char HEADERS[] =
1813                                  "HTTP/1.1 200 OK\r\n"
1814                                  "Content-Type: application/x-openpegasus\r\n"
1815                                  "content-length: 0000000000\r\n"
1816                                  "CIMOperation: MethodResponse\r\n"
1817                                  "\r\n";
1818                      
1819                              // The HTTP processor fills in the content-length value later.
1820                              // It searches for a field matching "content-length" (so the first
1821                              // character must be lower case).
1822                              out.append(HEADERS, sizeof(HEADERS) - 1);
1823                              return;
1824                          }
1825                      
1826 mike           1.126      out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");
1827 kumpf          1.141 
1828                      #ifndef PEGASUS_DISABLE_PERFINST
1829                           if (StatisticalData::current()->copyGSD)
1830                           {
1831                               out << STRLIT("WBEMServerResponseTime: ") <<
1832                                   CIMValue(serverResponseTime).toString() << STRLIT("\r\n");
1833                           }
1834                      #endif
1835                      
1836 mike           1.164      if (binaryResponse)
1837                           {
1838                              // According to MIME RFC, the "x-" prefix should be used for all
1839                              // non-registered values.
1840                               out << STRLIT("Content-Type: application/x-openpegasus\r\n");
1841                           }
1842                           else
1843                           {
1844                               out << STRLIT("Content-Type: application/xml; charset=\"utf-8\"\r\n");
1845                           }
1846                      
1847 kumpf          1.157      OUTPUT_CONTENTLENGTH(out, contentLength);
1848 w.white        1.108 
1849                           if (contentLanguages.size() > 0)
1850                           {
1851 kumpf          1.146          out << STRLIT("Content-Language: ") << contentLanguages <<
1852                                   STRLIT("\r\n");
1853 w.white        1.108      }
1854                           if (httpMethod == HTTP_METHOD_M_POST)
1855                           {
1856 mike           1.164          char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
1857                      
1858 kumpf          1.167          out << STRLIT("Ext:\r\n"
1859                                             "Cache-Control: no-cache\r\n"
1860 thilo.boehm    1.162                        "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");
1861 mike           1.126          out << nn << STRLIT("\r\n");
1862                               out << nn << STRLIT("-CIMOperation: MethodResponse\r\n\r\n");
1863 w.white        1.108      }
1864                           else
1865                           {
1866 mike           1.126          out << STRLIT("CIMOperation: MethodResponse\r\n\r\n");
1867 w.white        1.108      }
1868 brian.campbell 1.113 }
1869 w.white        1.108 
1870                      
1871 mike           1.23  //------------------------------------------------------------------------------
1872                      //
1873 kumpf          1.40  // appendHttpErrorResponseHeader()
1874                      //
1875                      //     Build HTTP error response header.
1876                      //
1877                      //     Returns error response message in the following format:
1878                      //
1879 kumpf          1.41  //        HTTP/1.1 400 Bad Request       (using specified status code)
1880                      //        CIMError: <error type>         (if specified by caller)
1881                      //        PGErrorDetail: <error text>    (if specified by caller)
1882 kumpf          1.40  //
1883                      //------------------------------------------------------------------------------
1884                      
1885                      void XmlWriter::appendHttpErrorResponseHeader(
1886 mike           1.125     Buffer& out,
1887 kumpf          1.40      const String& status,
1888                          const String& cimError,
1889 kumpf          1.41      const String& errorDetail)
1890 kumpf          1.40  {
1891 mike           1.126     out << STRLIT("HTTP/1.1 ") << status << STRLIT("\r\n");
1892 kumpf          1.40      if (cimError != String::EMPTY)
1893                          {
1894 mike           1.126         out << STRLIT("CIMError: ") << cimError << STRLIT("\r\n");
1895 kumpf          1.40      }
1896 kumpf          1.41      if (errorDetail != String::EMPTY)
1897 kumpf          1.40      {
1898 mike           1.126         out << STRLIT(PEGASUS_HTTPHEADERTAG_ERRORDETAIL ": ")
1899                                  << encodeURICharacters(errorDetail) << STRLIT("\r\n");
1900 kumpf          1.40      }
1901 mike           1.126     out << STRLIT("\r\n");
1902 kumpf          1.40  }
1903                      
1904                      //------------------------------------------------------------------------------
1905                      //
1906 kumpf          1.27  // appendUnauthorizedResponseHeader()
1907                      //
1908                      //     Build HTTP authentication response header for unauthorized requests.
1909                      //
1910                      //     Returns unauthorized message in the following format:
1911                      //
1912                      //        HTTP/1.1 401 Unauthorized
1913 s.kodali       1.161 //        WWW-Authenticate: Basic realm="HostName"
1914 kumpf          1.27  //        <HTML><HEAD>
1915                      //        <TITLE>401 Unauthorized</TITLE>
1916                      //        </HEAD><BODY BGCOLOR="#99cc99">
1917                      //        <H2>TEST401 Unauthorized</H2>
1918                      //        <HR>
1919                      //        </BODY></HTML>
1920                      //
1921                      //------------------------------------------------------------------------------
1922                      
1923                      void XmlWriter::appendUnauthorizedResponseHeader(
1924 mike           1.125     Buffer& out,
1925 kumpf          1.27      const String& content)
1926                      {
1927 mike           1.126     out << STRLIT("HTTP/1.1 " HTTP_STATUS_UNAUTHORIZED "\r\n");
1928 kumpf          1.157     OUTPUT_CONTENTLENGTH(out, 0);
1929 thilo.boehm    1.162     out << content << STRLIT("\r\n\r\n");
1930 kumpf          1.27  
1931                      //ATTN: We may need to include the following line, so that the browsers
1932                      //      can display the error message.
1933                      //    out << "<HTML><HEAD>\r\n";
1934                      //    out << "<TITLE>" << "401 Unauthorized" <<  "</TITLE>\r\n";
1935                      //    out << "</HEAD><BODY BGCOLOR=\"#99cc99\">\r\n";
1936                      //    out << "<H2>TEST" << "401 Unauthorized" << "</H2>\r\n";
1937                      //    out << "<HR>\r\n";
1938                      //    out << "</BODY></HTML>\r\n";
1939                      }
1940                      
1941 gerarda        1.90  #ifdef PEGASUS_KERBEROS_AUTHENTICATION
1942                      //------------------------------------------------------------------------------
1943                      //
1944                      // appendOKResponseHeader()
1945                      //
1946                      //     Build HTTP authentication response header for unauthorized requests.
1947                      //
1948                      //     Returns OK message in the following format:
1949                      //
1950                      //        HTTP/1.1 200 OK
1951 gerarda        1.101 //        Content-Length: 0
1952 gerarda        1.90  //        WWW-Authenticate: Negotiate "token"
1953                      //        <HTML><HEAD>
1954                      //        <TITLE>200 OK</TITLE>
1955                      //        </HEAD><BODY BGCOLOR="#99cc99">
1956                      //        <H2>TEST200 OK</H2>
1957                      //        <HR>
1958                      //        </BODY></HTML>
1959                      //
1960                      //------------------------------------------------------------------------------
1961                      
1962                      void XmlWriter::appendOKResponseHeader(
1963 mike           1.125     Buffer& out,
1964 gerarda        1.90      const String& content)
1965                      {
1966 mike           1.126     out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n");
1967 gerarda        1.101     // Content-Length header needs to be added because 200 OK record
1968                          // is usually intended to have content.  But, for Kerberos this
1969                          // may not always be the case so we need to indicate that there
1970                          // is no content
1971 kumpf          1.157     OUTPUT_CONTENTLENGTH(out, 0);
1972 thilo.boehm    1.162     out << content << STRLIT("\r\n\r\n");
1973 gerarda        1.90  
1974                      //ATTN: We may need to include the following line, so that the browsers
1975                      //      can display the error message.
1976                      //    out << "<HTML><HEAD>\r\n";
1977                      //    out << "<TITLE>" << "200 OK" <<  "</TITLE>\r\n";
1978                      //    out << "</HEAD><BODY BGCOLOR=\"#99cc99\">\r\n";
1979                      //    out << "<H2>TEST" << "200 OK" << "</H2>\r\n";
1980                      //    out << "<HR>\r\n";
1981                      //    out << "</BODY></HTML>\r\n";
1982                      }
1983                      #endif
1984                      
1985 kumpf          1.27  //------------------------------------------------------------------------------
1986                      //
1987 kumpf          1.29  // _appendMessageElementBegin()
1988                      // _appendMessageElementEnd()
1989 mike           1.23  //
1990                      //     <!ELEMENT MESSAGE (SIMPLEREQ|MULTIREQ|SIMPLERSP|MULTIRSP)>
1991                      //     <!ATTLIST MESSAGE
1992                      //         ID CDATA #REQUIRED
1993                      //         PROTOCOLVERSION CDATA #REQUIRED>
1994                      //
1995                      //------------------------------------------------------------------------------
1996                      
1997 kumpf          1.29  void XmlWriter::_appendMessageElementBegin(
1998 mike           1.125     Buffer& out,
1999 kumpf          1.27      const String& messageId)
2000 mike           1.23  {
2001 kumpf          1.167     out << STRLIT("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
2002                                        "<CIM CIMVERSION=\"2.0\" DTDVERSION=\"2.0\">\n"
2003 thilo.boehm    1.162                   "<MESSAGE ID=\"") << messageId;
2004 mike           1.126     out << STRLIT("\" PROTOCOLVERSION=\"1.0\">\n");
2005 kumpf          1.27  }
2006                      
2007 kumpf          1.29  void XmlWriter::_appendMessageElementEnd(
2008 mike           1.125     Buffer& out)
2009 kumpf          1.27  {
2010 thilo.boehm    1.162     out << STRLIT("</MESSAGE>\n</CIM>\n");
2011 mike           1.23  }
2012                      
2013                      //------------------------------------------------------------------------------
2014                      //
2015 kumpf          1.29  // _appendSimpleReqElementBegin()
2016                      // _appendSimpleReqElementEnd()
2017 mike           1.23  //
2018                      //     <!ELEMENT SIMPLEREQ (IMETHODCALL|METHODCALL)>
2019                      //
2020                      //------------------------------------------------------------------------------
2021                      
2022 kumpf          1.29  void XmlWriter::_appendSimpleReqElementBegin(
2023 mike           1.125     Buffer& out)
2024 kumpf          1.27  {
2025 mike           1.126     out << STRLIT("<SIMPLEREQ>\n");
2026 kumpf          1.27  }
2027                      
2028 kumpf          1.29  void XmlWriter::_appendSimpleReqElementEnd(
2029 mike           1.125     Buffer& out)
2030 mike           1.23  {
2031 mike           1.126     out << STRLIT("</SIMPLEREQ>\n");
2032 mike           1.23  }
2033                      
2034                      //------------------------------------------------------------------------------
2035                      //
2036 kumpf          1.29  // _appendMethodCallElementBegin()
2037                      // _appendMethodCallElementEnd()
2038 mike           1.23  //
2039 kumpf          1.27  //     <!ELEMENT METHODCALL ((LOCALCLASSPATH|LOCALINSTANCEPATH),PARAMVALUE*)>
2040                      //     <!ATTLIST METHODCALL %CIMName;>
2041 mike           1.23  //
2042                      //------------------------------------------------------------------------------
2043                      
2044 kumpf          1.29  void XmlWriter::_appendMethodCallElementBegin(
2045 mike           1.125     Buffer& out,
2046 kumpf          1.80      const CIMName& name)
2047 kumpf          1.27  {
2048 mike           1.126     out << STRLIT("<METHODCALL NAME=\"") << name << STRLIT("\">\n");
2049 kumpf          1.27  }
2050                      
2051 kumpf          1.29  void XmlWriter::_appendMethodCallElementEnd(
2052 mike           1.125     Buffer& out)
2053 mike           1.23  {
2054 mike           1.126     out << STRLIT("</METHODCALL>\n");
2055 mike           1.23  }
2056                      
2057                      //------------------------------------------------------------------------------
2058                      //
2059 kumpf          1.29  // _appendIMethodCallElementBegin()
2060                      // _appendIMethodCallElementEnd()
2061 mike           1.23  //
2062                      //     <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH,IPARAMVALUE*)>
2063                      //     <!ATTLIST IMETHODCALL %CIMName;>
2064                      //
2065                      //------------------------------------------------------------------------------
2066                      
2067 kumpf          1.29  void XmlWriter::_appendIMethodCallElementBegin(
2068 mike           1.125     Buffer& out,
2069 kumpf          1.80      const CIMName& name)
2070 mike           1.23  {
2071 mike           1.126     out << STRLIT("<IMETHODCALL NAME=\"") << name << STRLIT("\">\n");
2072 kumpf          1.27  }
2073                      
2074 kumpf          1.29  void XmlWriter::_appendIMethodCallElementEnd(
2075 mike           1.125     Buffer& out)
2076 kumpf          1.27  {
2077 mike           1.126     out << STRLIT("</IMETHODCALL>\n");
2078 mike           1.23  }
2079                      
2080                      //------------------------------------------------------------------------------
2081                      //
2082 kumpf          1.29  // _appendIParamValueElementBegin()
2083                      // _appendIParamValueElementEnd()
2084 mike           1.23  //
2085 kumpf          1.27  //     <!ELEMENT IPARAMVALUE (VALUE|VALUE.ARRAY|VALUE.REFERENCE
2086                      //         |INSTANCENAME|CLASSNAME|QUALIFIER.DECLARATION
2087                      //         |CLASS|INSTANCE|VALUE.NAMEDINSTANCE)?>
2088                      //     <!ATTLIST IPARAMVALUE %CIMName;>
2089 mike           1.23  //
2090                      //------------------------------------------------------------------------------
2091                      
2092 kumpf          1.29  void XmlWriter::_appendIParamValueElementBegin(
2093 mike           1.125     Buffer& out,
2094 kumpf          1.27      const char* name)
2095                      {
2096 mike           1.126     out << STRLIT("<IPARAMVALUE NAME=\"") << name << STRLIT("\">\n");
2097 kumpf          1.27  }
2098                      
2099 kumpf          1.29  void XmlWriter::_appendIParamValueElementEnd(
2100 mike           1.125     Buffer& out)
2101 mike           1.23  {
2102 mike           1.126     out << STRLIT("</IPARAMVALUE>\n");
2103 mike           1.23  }
2104                      
2105                      //------------------------------------------------------------------------------
2106                      //
2107 kumpf          1.29  // _appendSimpleRspElementBegin()
2108                      // _appendSimpleRspElementEnd()
2109 mike           1.23  //
2110 kumpf          1.27  //     <!ELEMENT SIMPLERSP (METHODRESPONSE|IMETHODRESPONSE)>
2111 mike           1.23  //
2112                      //------------------------------------------------------------------------------
2113                      
2114 kumpf          1.29  void XmlWriter::_appendSimpleRspElementBegin(
2115 mike           1.125     Buffer& out)
2116 kumpf          1.27  {
2117 mike           1.126     out << STRLIT("<SIMPLERSP>\n");
2118 kumpf          1.27  }
2119                      
2120 kumpf          1.29  void XmlWriter::_appendSimpleRspElementEnd(
2121 mike           1.125     Buffer& out)
2122 mike           1.23  {
2123 mike           1.126     out << STRLIT("</SIMPLERSP>\n");
2124 mike           1.23  }
2125                      
2126                      //------------------------------------------------------------------------------
2127                      //
2128 kumpf          1.29  // _appendMethodResponseElementBegin()
2129                      // _appendMethodResponseElementEnd()
2130 mike           1.23  //
2131 kumpf          1.27  //     <!ELEMENT METHODRESPONSE (ERROR|IRETURNVALUE?)>
2132                      //     <!ATTLIST METHODRESPONSE %CIMName;>
2133 mike           1.23  //
2134                      //------------------------------------------------------------------------------
2135                      
2136 kumpf          1.29  void XmlWriter::_appendMethodResponseElementBegin(
2137 mike           1.125     Buffer& out,
2138 kumpf          1.80      const CIMName& name)
2139 kumpf          1.27  {
2140 mike           1.126     out << STRLIT("<METHODRESPONSE NAME=\"") << name << STRLIT("\">\n");
2141 kumpf          1.27  }
2142                      
2143 kumpf          1.29  void XmlWriter::_appendMethodResponseElementEnd(
2144 mike           1.125     Buffer& out)
2145 mike           1.23  {
2146 mike           1.126     out << STRLIT("</METHODRESPONSE>\n");
2147 kumpf          1.27  }
2148                      
2149                      //------------------------------------------------------------------------------
2150                      //
2151 kumpf          1.29  // _appendIMethodResponseElementBegin()
2152                      // _appendIMethodResponseElementEnd()
2153 kumpf          1.27  //
2154                      //     <!ELEMENT IMETHODRESPONSE (ERROR|IRETURNVALUE?)>
2155                      //     <!ATTLIST IMETHODRESPONSE %CIMName;>
2156                      //
2157                      //------------------------------------------------------------------------------
2158                      
2159 kumpf          1.29  void XmlWriter::_appendIMethodResponseElementBegin(
2160 mike           1.125     Buffer& out,
2161 kumpf          1.80      const CIMName& name)
2162 kumpf          1.27  {
2163 mike           1.126     out << STRLIT("<IMETHODRESPONSE NAME=\"") << name << STRLIT("\">\n");
2164 kumpf          1.27  }
2165                      
2166 kumpf          1.29  void XmlWriter::_appendIMethodResponseElementEnd(
2167 mike           1.125     Buffer& out)
2168 kumpf          1.27  {
2169 mike           1.126     out << STRLIT("</IMETHODRESPONSE>\n");
2170 mike           1.23  }
2171                      
2172                      //------------------------------------------------------------------------------
2173                      //
2174 kumpf          1.29  // _appendErrorElement()
2175 mike           1.23  //
2176                      //------------------------------------------------------------------------------
2177                      
2178 kumpf          1.29  void XmlWriter::_appendErrorElement(
2179 mike           1.125     Buffer& out,
2180 kumpf          1.42      const CIMException& cimException)
2181 mike           1.23  {
2182 thilo.boehm    1.163     Tracer::traceCIMException(TRC_XML, Tracer::LEVEL2, cimException);
2183 kumpf          1.44  
2184 thilo.boehm    1.162     out << STRLIT("<ERROR CODE=\"") << Uint32(cimException.getCode());
2185 karl           1.145     out.append('"');
2186 karl           1.142 
2187 kumpf          1.71      String description = TraceableCIMException(cimException).getDescription();
2188 karl           1.145 
2189 kumpf          1.51      if (description != String::EMPTY)
2190 kumpf          1.42      {
2191 mike           1.126         out << STRLIT(" DESCRIPTION=\"");
2192 kumpf          1.51          appendSpecial(out, description);
2193 kumpf          1.146         out.append('"');
2194 kumpf          1.42      }
2195 karl           1.142 
2196 karl           1.145     if (cimException.getErrorCount())
2197 karl           1.142     {
2198 karl           1.145         out << STRLIT(">");
2199                      
2200                              for (Uint32 i = 0, n = cimException.getErrorCount(); i < n; i++)
2201                                  appendInstanceElement(out, cimException.getError(i));
2202                      
2203                              out << STRLIT("</ERROR>");
2204 karl           1.142     }
2205 karl           1.145     else
2206                              out << STRLIT("/>");
2207 mike           1.23  }
2208                      
2209 kumpf          1.157 //----------------------------------------------------------------------
2210                      //
2211                      // appendParamTypeAndEmbeddedObjAttrib
2212                      // Appends the Param type and EmbeddedObject Info to the buffer
2213                      //     %EmbeddedObject; #IMPLIED
2214                      //     %ParamType;>
2215                      //
2216 karl           1.154 //---------------------------------------------------------------------
2217 kumpf          1.157 
2218 karl           1.154 void XmlWriter::appendParamTypeAndEmbeddedObjAttrib(
2219 mike           1.125     Buffer& out,
2220 karl           1.154     const CIMType& type)
2221 kumpf          1.27  {
2222                      
2223 david.dillard  1.121     // If the property type is CIMObject, then
2224 karl           1.154     //   encode the property in CIM-XML as a string with the EmbeddedObject
2225                          //   attribute (there is not currently a CIM-XML "object"
2226                          //   datatype).
2227                          //   Because of an error in Pegasus we were earlier outputting
2228                          //   upper case "EMBEDDEDOBJECT" as the attribute name. The
2229                          //   spec calls for mixed case "EmbeddedObject. Fixed in
2230                          //   bug 7131 to output EmbeddedObject  attribute in upper
2231                          //   case and mixed case. Receiver will ignore one or the
2232                          //   other.
2233                          //else
2234                          //      output the real type
2235 dave.sudlik    1.117     if (type == CIMTYPE_OBJECT)
2236                          {
2237 karl           1.154 
2238 kumpf          1.167         out << STRLIT(" PARAMTYPE=\"string\""
2239                                            " EmbeddedObject=\"object\""
2240 thilo.boehm    1.162                       " EMBEDDEDOBJECT=\"object\"");
2241 dave.sudlik    1.117     }
2242 a.dunfey       1.137     else if (type == CIMTYPE_INSTANCE)
2243                          {
2244 thilo.boehm    1.162         out << STRLIT(" PARAMTYPE=\"string\""
2245 kumpf          1.167                       " EmbeddedObject=\"instance\""
2246 thilo.boehm    1.162                       " EMBEDDEDOBJECT=\"instance\"");
2247 a.dunfey       1.137     }
2248 dave.sudlik    1.117     else
2249                          {
2250 thilo.boehm    1.162         out << STRLIT(" PARAM") << _XmlWriterTypeStrings[type];
2251 dave.sudlik    1.117     }
2252 karl           1.154 }
2253                      
2254                      //------------------------------------------------------------------------------
2255                      //
2256                      // appendReturnValueElement()
2257                      //
2258                      // <!ELEMENT RETURNVALUE (VALUE|VALUE.REFERENCE)>
2259                      // <!ATTLIST RETURNVALUE
2260                      //     %EmbeddedObject; #IMPLIED
2261                      //     %ParamType;>
2262                      //
2263                      //------------------------------------------------------------------------------
2264                      
2265                      void XmlWriter::appendReturnValueElement(
2266                          Buffer& out,
2267                          const CIMValue& value)
2268                      {
2269                          out << STRLIT("<RETURNVALUE");
2270                      
2271                          CIMType type = value.getType();
2272                      
2273 karl           1.154     appendParamTypeAndEmbeddedObjAttrib(out, type);
2274 kumpf          1.27  
2275 mike           1.126     out << STRLIT(">\n");
2276 karl           1.37  
2277 kumpf          1.54      // Add value.
2278                          appendValueElement(out, value);
2279 mike           1.126     out << STRLIT("</RETURNVALUE>\n");
2280 kumpf          1.27  }
2281                      
2282                      //------------------------------------------------------------------------------
2283                      //
2284 kumpf          1.29  // _appendIReturnValueElementBegin()
2285                      // _appendIReturnValueElementEnd()
2286 kumpf          1.27  //
2287                      //      <!ELEMENT IRETURNVALUE (CLASSNAME*|INSTANCENAME*|VALUE*|
2288                      //          VALUE.OBJECTWITHPATH*|VALUE.OBJECTWITHLOCALPATH*|VALUE.OBJECT*|
2289                      //          OBJECTPATH*|QUALIFIER.DECLARATION*|VALUE.ARRAY?|VALUE.REFERENCE?|
2290                      //          CLASS*|INSTANCE*|VALUE.NAMEDINSTANCE*)>
2291                      //
2292                      //------------------------------------------------------------------------------
2293                      
2294 kumpf          1.29  void XmlWriter::_appendIReturnValueElementBegin(
2295 mike           1.125     Buffer& out)
2296 kumpf          1.27  {
2297 mike           1.126     out << STRLIT("<IRETURNVALUE>\n");
2298 kumpf          1.27  }
2299                      
2300 kumpf          1.29  void XmlWriter::_appendIReturnValueElementEnd(
2301 mike           1.125     Buffer& out)
2302 mike           1.23  {
2303 mike           1.126     out << STRLIT("</IRETURNVALUE>\n");
2304 mike           1.23  }
2305                      
2306                      //------------------------------------------------------------------------------
2307                      //
2308 kumpf          1.27  // appendBooleanIParameter()
2309 mike           1.23  //
2310                      //------------------------------------------------------------------------------
2311                      
2312 kumpf          1.27  void XmlWriter::appendBooleanIParameter(
2313 mike           1.125     Buffer& out,
2314 mike           1.23      const char* name,
2315 kumpf          1.27      Boolean flag)
2316 mike           1.23  {
2317 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2318 mike           1.126     out << STRLIT("<VALUE>");
2319 kumpf          1.54      append(out, flag);
2320 mike           1.126     out << STRLIT("</VALUE>\n");
2321 kumpf          1.29      _appendIParamValueElementEnd(out);
2322 mike           1.23  }
2323                      
2324                      //------------------------------------------------------------------------------
2325                      //
2326 kumpf          1.27  // appendStringIParameter()
2327 mike           1.23  //
2328                      //------------------------------------------------------------------------------
2329                      
2330 kumpf          1.27  void XmlWriter::appendStringIParameter(
2331 mike           1.125     Buffer& out,
2332 mike           1.23      const char* name,
2333 kumpf          1.27      const String& str)
2334 mike           1.23  {
2335 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2336 mike           1.126     out << STRLIT("<VALUE>");
2337 kumpf          1.27      appendSpecial(out, str);
2338 mike           1.126     out << STRLIT("</VALUE>\n");
2339 kumpf          1.29      _appendIParamValueElementEnd(out);
2340 mike           1.23  }
2341                      
2342                      //------------------------------------------------------------------------------
2343                      //
2344 kumpf          1.27  // appendClassNameIParameter()
2345 mike           1.23  //
2346                      //------------------------------------------------------------------------------
2347                      
2348 kumpf          1.27  void XmlWriter::appendClassNameIParameter(
2349 mike           1.125     Buffer& out,
2350 kumpf          1.27      const char* name,
2351 kumpf          1.80      const CIMName& className)
2352 mike           1.23  {
2353 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2354 kumpf          1.83  
2355                          //
2356 david.dillard  1.121     //  A NULL (unassigned) value for a parameter is specified by an
2357 kumpf          1.83      //  <IPARAMVALUE> element with no subelement
2358                          //
2359                          if (!className.isNull ())
2360                          {
2361                              appendClassNameElement(out, className);
2362                          }
2363                      
2364 kumpf          1.29      _appendIParamValueElementEnd(out);
2365 mike           1.23  }
2366                      
2367                      //------------------------------------------------------------------------------
2368                      //
2369 kumpf          1.27  // appendInstanceNameIParameter()
2370 mike           1.23  //
2371                      //------------------------------------------------------------------------------
2372                      
2373 kumpf          1.27  void XmlWriter::appendInstanceNameIParameter(
2374 mike           1.125     Buffer& out,
2375 kumpf          1.27      const char* name,
2376 kumpf          1.59      const CIMObjectPath& instanceName)
2377 mike           1.23  {
2378 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2379                          appendInstanceNameElement(out, instanceName);
2380                          _appendIParamValueElementEnd(out);
2381 kumpf          1.27  }
2382                      
2383                      void XmlWriter::appendObjectNameIParameter(
2384 mike           1.125     Buffer& out,
2385 kumpf          1.27      const char* name,
2386 kumpf          1.59      const CIMObjectPath& objectName)
2387 kumpf          1.27  {
2388 kumpf          1.68      //
2389                          //  ATTN-CAKG-P2-20020726:  The following condition does not correctly
2390                          //  distinguish instanceNames from classNames in every case
2391 david.dillard  1.121     //  The instanceName of a singleton instance of a keyless class also
2392 kumpf          1.68      //  has no key bindings
2393                          //
2394                          if (objectName.getKeyBindings ().size () == 0)
2395 kumpf          1.27      {
2396 kumpf          1.146         XmlWriter::appendClassNameIParameter(
2397                                  out, name, objectName.getClassName());
2398 kumpf          1.27      }
2399                          else
2400                          {
2401 kumpf          1.146         XmlWriter::appendInstanceNameIParameter(
2402                                  out, name, objectName);
2403 kumpf          1.27      }
2404                      }
2405                      
2406                      //------------------------------------------------------------------------------
2407                      //
2408                      // appendClassIParameter()
2409                      //
2410                      //------------------------------------------------------------------------------
2411                      
2412                      void XmlWriter::appendClassIParameter(
2413 mike           1.125     Buffer& out,
2414 kumpf          1.27      const char* name,
2415                          const CIMConstClass& cimClass)
2416                      {
2417 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2418 kumpf          1.55      appendClassElement(out, cimClass);
2419 kumpf          1.29      _appendIParamValueElementEnd(out);
2420 mike           1.23  }
2421                      
2422                      //------------------------------------------------------------------------------
2423                      //
2424 kumpf          1.27  // appendInstanceIParameter()
2425 mike           1.23  //
2426                      //------------------------------------------------------------------------------
2427                      
2428 kumpf          1.27  void XmlWriter::appendInstanceIParameter(
2429 mike           1.125     Buffer& out,
2430 kumpf          1.27      const char* name,
2431 mike           1.23      const CIMConstInstance& instance)
2432                      {
2433 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2434 kumpf          1.55      appendInstanceElement(out, instance);
2435 kumpf          1.29      _appendIParamValueElementEnd(out);
2436 mike           1.23  }
2437                      
2438 mike           1.24  //------------------------------------------------------------------------------
2439                      //
2440 kumpf          1.27  // appendNamedInstanceIParameter()
2441 mike           1.24  //
2442                      //------------------------------------------------------------------------------
2443                      
2444 kumpf          1.27  void XmlWriter::appendNamedInstanceIParameter(
2445 mike           1.125     Buffer& out,
2446 kumpf          1.27      const char* name,
2447 kumpf          1.61      const CIMInstance& namedInstance)
2448 mike           1.24  {
2449 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2450 kumpf          1.56      appendValueNamedInstanceElement(out, namedInstance);
2451 kumpf          1.29      _appendIParamValueElementEnd(out);
2452 mike           1.24  }
2453                      
2454 mike           1.23  //----------------------------------------------------------
2455                      //
2456 kumpf          1.27  //  appendPropertyNameIParameter()
2457 david.dillard  1.121 //
2458 mike           1.23  //     </IPARAMVALUE>
2459                      //     <IPARAMVALUE NAME="PropertyName"><VALUE>FreeSpace</VALUE></IPARAMVALUE>
2460                      //
2461                      //     USE: Create parameter for getProperty operation
2462 brian.campbell 1.113 //==========================================================
2463 kumpf          1.27  void XmlWriter::appendPropertyNameIParameter(
2464 mike           1.125     Buffer& out,
2465 kumpf          1.80      const CIMName& propertyName)
2466 mike           1.23  {
2467 kumpf          1.29      _appendIParamValueElementBegin(out, "PropertyName");
2468 mike           1.126     out << STRLIT("<VALUE>") << propertyName << STRLIT("</VALUE>\n");
2469 kumpf          1.29      _appendIParamValueElementEnd(out);
2470 kumpf          1.27  }
2471 mike           1.23  
2472                      //------------------------------------------------------------------------------
2473                      //
2474 kumpf          1.27  // appendPropertyValueIParameter()
2475 mike           1.24  //
2476                      //------------------------------------------------------------------------------
2477                      
2478 kumpf          1.27  void XmlWriter::appendPropertyValueIParameter(
2479 mike           1.125     Buffer& out,
2480 kumpf          1.27      const char* name,
2481 mike           1.24      const CIMValue& value)
2482                      {
2483 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2484 kumpf          1.54      appendValueElement(out, value);
2485 kumpf          1.29      _appendIParamValueElementEnd(out);
2486 mike           1.24  }
2487                      
2488                      //------------------------------------------------------------------------------
2489                      //
2490 kumpf          1.27  // appendPropertyListIParameter()
2491 mike           1.24  //
2492                      //------------------------------------------------------------------------------
2493                      
2494 kumpf          1.27  void XmlWriter::appendPropertyListIParameter(
2495 mike           1.125     Buffer& out,
2496 mike           1.24      const CIMPropertyList& propertyList)
2497                      {
2498 kumpf          1.29      _appendIParamValueElementBegin(out, "PropertyList");
2499 mike           1.24  
2500 kumpf          1.83      //
2501 david.dillard  1.121     //  A NULL (unassigned) value for a parameter is specified by an
2502 kumpf          1.83      //  <IPARAMVALUE> element with no subelement
2503                          //
2504                          if (!propertyList.isNull ())
2505 mike           1.24      {
2506 mike           1.126         out << STRLIT("<VALUE.ARRAY>\n");
2507 kumpf          1.83          for (Uint32 i = 0; i < propertyList.size(); i++)
2508                              {
2509 mike           1.126             out << STRLIT("<VALUE>") << propertyList[i] << STRLIT("</VALUE>\n");
2510 kumpf          1.83          }
2511 mike           1.126         out << STRLIT("</VALUE.ARRAY>\n");
2512 mike           1.24      }
2513 kumpf          1.27  
2514 kumpf          1.29      _appendIParamValueElementEnd(out);
2515 mike           1.24  }
2516                      
2517                      //------------------------------------------------------------------------------
2518                      //
2519 kumpf          1.27  // appendQualifierDeclarationIParameter()
2520 mike           1.23  //
2521                      //------------------------------------------------------------------------------
2522                      
2523 kumpf          1.27  void XmlWriter::appendQualifierDeclarationIParameter(
2524 mike           1.125     Buffer& out,
2525 kumpf          1.27      const char* name,
2526 mike           1.23      const CIMConstQualifierDecl& qualifierDecl)
2527                      {
2528 kumpf          1.29      _appendIParamValueElementBegin(out, name);
2529 kumpf          1.56      appendQualifierDeclElement(out, qualifierDecl);
2530 kumpf          1.29      _appendIParamValueElementEnd(out);
2531 kumpf          1.40  }
2532                      
2533                      //------------------------------------------------------------------------------
2534                      //
2535                      // XmlWriter::formatHttpErrorRspMessage()
2536                      //
2537                      //------------------------------------------------------------------------------
2538                      
2539 mike           1.125 Buffer XmlWriter::formatHttpErrorRspMessage(
2540 kumpf          1.40      const String& status,
2541                          const String& cimError,
2542 kumpf          1.41      const String& errorDetail)
2543 kumpf          1.40  {
2544 mike           1.125     Buffer out;
2545 kumpf          1.40  
2546 kumpf          1.41      appendHttpErrorResponseHeader(out, status, cimError, errorDetail);
2547 kumpf          1.40  
2548 kumpf          1.41      return out;
2549 mike           1.23  }
2550                      
2551 chuck          1.89  // l10n - add content language support to the format methods below
2552                      
2553 mike           1.23  //------------------------------------------------------------------------------
2554                      //
2555 kumpf          1.27  // XmlWriter::formatSimpleMethodReqMessage()
2556 mike           1.23  //
2557                      //------------------------------------------------------------------------------
2558                      
2559 kumpf          1.27  // ATTN-RK-P1-20020228: Need to complete copy elimination optimization
2560 mike           1.125 Buffer XmlWriter::formatSimpleMethodReqMessage(
2561 kumpf          1.27      const char* host,
2562 kumpf          1.80      const CIMNamespaceName& nameSpace,
2563 kumpf          1.59      const CIMObjectPath& path,
2564 kumpf          1.80      const CIMName& methodName,
2565 kumpf          1.30      const Array<CIMParamValue>& parameters,
2566 kumpf          1.27      const String& messageId,
2567 kumpf          1.82      HttpMethod httpMethod,
2568 chuck          1.89      const String& authenticationHeader,
2569 kumpf          1.133     const AcceptLanguageList& httpAcceptLanguages,
2570 mike           1.164     const ContentLanguageList& httpContentLanguages,
2571                          bool binaryResponse)
2572 kumpf          1.27  {
2573 mike           1.125     Buffer out;
2574                          Buffer tmp;
2575 kumpf          1.59      CIMObjectPath localObjectPath = path;
2576 kumpf          1.80      localObjectPath.setNameSpace(nameSpace.getString());
2577 kumpf          1.77      localObjectPath.setHost(String::EMPTY);
2578 kumpf          1.27  
2579 kumpf          1.29      _appendMessageElementBegin(out, messageId);
2580                          _appendSimpleReqElementBegin(out);
2581                          _appendMethodCallElementBegin(out, methodName);
2582 kumpf          1.38      appendLocalObjectPathElement(out, localObjectPath);
2583 kumpf          1.30      for (Uint32 i=0; i < parameters.size(); i++)
2584 kumpf          1.29      {
2585 kumpf          1.56          appendParamValueElement(out, parameters[i]);
2586 kumpf          1.29      }
2587                          _appendMethodCallElementEnd(out);
2588                          _appendSimpleReqElementEnd(out);
2589                          _appendMessageElementEnd(out);
2590 kumpf          1.27  
2591                          appendMethodCallHeader(
2592 kumpf          1.146         tmp,
2593                              host,
2594                              methodName,
2595                              localObjectPath.toString(),
2596 kumpf          1.27          authenticationHeader,
2597 kumpf          1.82          httpMethod,
2598 chuck          1.89          httpAcceptLanguages,
2599                              httpContentLanguages,
2600 mike           1.164         out.size(),
2601                              false,
2602                              binaryResponse);
2603 kumpf          1.27      tmp << out;
2604                      
2605                          return tmp;
2606                      }
2607                      
2608 mike           1.125 Buffer XmlWriter::formatSimpleMethodRspMessage(
2609 w.white        1.108     const CIMName& methodName,
2610                          const String& messageId,
2611                          HttpMethod httpMethod,
2612 kumpf          1.133     const ContentLanguageList& httpContentLanguages,
2613 mike           1.125     const Buffer& body,
2614 kumpf          1.146     Uint64 serverResponseTime,
2615                          Boolean isFirst,
2616                          Boolean isLast)
2617                      {
2618                          Buffer out;
2619                      
2620                          if (isFirst == true)
2621                          {
2622                              // NOTE: temporarily put zero for content length. the http code
2623                              // will later decide to fill in the length or remove it altogether
2624                              appendMethodResponseHeader(
2625                                  out, httpMethod, httpContentLanguages, 0, serverResponseTime);
2626                              _appendMessageElementBegin(out, messageId);
2627                              _appendSimpleRspElementBegin(out);
2628                              _appendMethodResponseElementBegin(out, methodName);
2629                          }
2630                      
2631                          if (body.size() != 0)
2632                          {
2633                              out << body;
2634                          }
2635 kumpf          1.146 
2636                          if (isLast == true)
2637                          {
2638                              _appendMethodResponseElementEnd(out);
2639                              _appendSimpleRspElementEnd(out);
2640                              _appendMessageElementEnd(out);
2641                          }
2642 david.dillard  1.121 
2643 kumpf          1.146     return out;
2644 w.white        1.108 }
2645                      
2646                      
2647 mike           1.23  //------------------------------------------------------------------------------
2648                      //
2649 kumpf          1.28  // XmlWriter::formatSimpleMethodErrorRspMessage()
2650                      //
2651                      //------------------------------------------------------------------------------
2652                      
2653 mike           1.125 Buffer XmlWriter::formatSimpleMethodErrorRspMessage(
2654 kumpf          1.80      const CIMName& methodName,
2655 kumpf          1.28      const String& messageId,
2656 kumpf          1.82      HttpMethod httpMethod,
2657 kumpf          1.42      const CIMException& cimException)
2658 kumpf          1.28  {
2659 mike           1.125     Buffer out;
2660                          Buffer tmp;
2661 kumpf          1.28  
2662 kumpf          1.29      _appendMessageElementBegin(out, messageId);
2663                          _appendSimpleRspElementBegin(out);
2664 kumpf          1.80      _appendMethodResponseElementBegin(out, methodName);
2665 kumpf          1.42      _appendErrorElement(out, cimException);
2666 kumpf          1.29      _appendMethodResponseElementEnd(out);
2667                          _appendSimpleRspElementEnd(out);
2668                          _appendMessageElementEnd(out);
2669 kumpf          1.28  
2670 kumpf          1.146     appendMethodResponseHeader(
2671                              tmp,
2672                              httpMethod,
2673                              cimException.getContentLanguages(),
2674 mike           1.164         out.size(),
2675                              false);
2676 kumpf          1.28      tmp << out;
2677                      
2678                          return tmp;
2679                      }
2680                      
2681                      //------------------------------------------------------------------------------
2682                      //
2683 kumpf          1.27  // XmlWriter::formatSimpleIMethodReqMessage()
2684 mike           1.23  //
2685                      //------------------------------------------------------------------------------
2686                      
2687 mike           1.125 Buffer XmlWriter::formatSimpleIMethodReqMessage(
2688 kumpf          1.27      const char* host,
2689 kumpf          1.80      const CIMNamespaceName& nameSpace,
2690                          const CIMName& iMethodName,
2691 kumpf          1.27      const String& messageId,
2692 kumpf          1.82      HttpMethod httpMethod,
2693 kumpf          1.27      const String& authenticationHeader,
2694 kumpf          1.133     const AcceptLanguageList& httpAcceptLanguages,
2695                          const ContentLanguageList& httpContentLanguages,
2696 mike           1.164     const Buffer& body,
2697                          bool binaryResponse)
2698 mike           1.23  {
2699 mike           1.125     Buffer out;
2700                          Buffer tmp;
2701 kumpf          1.27  
2702 kumpf          1.29      _appendMessageElementBegin(out, messageId);
2703                          _appendSimpleReqElementBegin(out);
2704                          _appendIMethodCallElementBegin(out, iMethodName);
2705 kumpf          1.80      appendLocalNameSpacePathElement(out, nameSpace.getString());
2706 kumpf          1.27      out << body;
2707 kumpf          1.29      _appendIMethodCallElementEnd(out);
2708                          _appendSimpleReqElementEnd(out);
2709                          _appendMessageElementEnd(out);
2710 kumpf          1.27  
2711                          appendMethodCallHeader(
2712 kumpf          1.146         tmp,
2713                              host,
2714                              iMethodName,
2715                              nameSpace.getString(),
2716 kumpf          1.27          authenticationHeader,
2717 kumpf          1.82          httpMethod,
2718 chuck          1.89          httpAcceptLanguages,
2719                              httpContentLanguages,
2720 kumpf          1.167         out.size(),
2721 mike           1.164         false,
2722                              binaryResponse);
2723 kumpf          1.27      tmp << out;
2724 mike           1.23  
2725 kumpf          1.27      return tmp;
2726 mike           1.23  }
2727                      
2728                      //------------------------------------------------------------------------------
2729                      //
2730 kumpf          1.27  // XmlWriter::formatSimpleIMethodRspMessage()
2731 mike           1.23  //
2732                      //------------------------------------------------------------------------------
2733                      
2734 mike           1.125 Buffer XmlWriter::formatSimpleIMethodRspMessage(
2735 kumpf          1.80      const CIMName& iMethodName,
2736 kumpf          1.27      const String& messageId,
2737 kumpf          1.82      HttpMethod httpMethod,
2738 kumpf          1.133     const ContentLanguageList& httpContentLanguages,
2739 mike           1.125     const Buffer& body,
2740 david.dillard  1.130     Uint64 serverResponseTime,
2741 david.dillard  1.121     Boolean isFirst,
2742                          Boolean isLast)
2743 mike           1.23  {
2744 mike           1.125     Buffer out;
2745 mike           1.23  
2746 kumpf          1.146     if (isFirst == true)
2747                          {
2748                              // NOTE: temporarily put zero for content length. the http code
2749                              // will later decide to fill in the length or remove it altogether
2750                              appendMethodResponseHeader(
2751                                  out, httpMethod, httpContentLanguages, 0, serverResponseTime);
2752                              _appendMessageElementBegin(out, messageId);
2753                              _appendSimpleRspElementBegin(out);
2754                              _appendIMethodResponseElementBegin(out, iMethodName);
2755                      
2756                              // output the start of the return tag. Test if there is response data
2757                              // by:
2758                              // 1. there is data on the first chunk OR
2759                              // 2. there is no data on the first chunk but isLast is false implying
2760                              //    there is more non-empty data to come. If all subsequent chunks
2761                              //    are empty, then this generates and empty response.
2762                              if (body.size() != 0 || isLast == false)
2763                                  _appendIReturnValueElementBegin(out);
2764                          }
2765 w.white        1.108 
2766                          if (body.size() != 0)
2767                          {
2768 kumpf          1.146         out << body;
2769 w.white        1.108     }
2770                      
2771 kumpf          1.146     if (isLast == true)
2772                          {
2773                              if (body.size() != 0 || isFirst == false)
2774                                  _appendIReturnValueElementEnd(out);
2775                              _appendIMethodResponseElementEnd(out);
2776                              _appendSimpleRspElementEnd(out);
2777                              _appendMessageElementEnd(out);
2778                          }
2779 w.white        1.108 
2780                          return out;
2781                      }
2782                      
2783                      
2784 kumpf          1.28  //------------------------------------------------------------------------------
2785                      //
2786                      // XmlWriter::formatSimpleIMethodErrorRspMessage()
2787                      //
2788                      //------------------------------------------------------------------------------
2789                      
2790 mike           1.125 Buffer XmlWriter::formatSimpleIMethodErrorRspMessage(
2791 kumpf          1.80      const CIMName& iMethodName,
2792 kumpf          1.28      const String& messageId,
2793 kumpf          1.82      HttpMethod httpMethod,
2794 kumpf          1.42      const CIMException& cimException)
2795 kumpf          1.28  {
2796 mike           1.125     Buffer out;
2797                          Buffer tmp;
2798 kumpf          1.28  
2799 kumpf          1.29      _appendMessageElementBegin(out, messageId);
2800                          _appendSimpleRspElementBegin(out);
2801 kumpf          1.80      _appendIMethodResponseElementBegin(out, iMethodName);
2802 kumpf          1.42      _appendErrorElement(out, cimException);
2803 kumpf          1.29      _appendIMethodResponseElementEnd(out);
2804                          _appendSimpleRspElementEnd(out);
2805                          _appendMessageElementEnd(out);
2806 kumpf          1.28  
2807 chuck          1.89      appendMethodResponseHeader(tmp,
2808 kumpf          1.146         httpMethod,
2809                              cimException.getContentLanguages(),
2810 mike           1.164         out.size(), false);
2811 kumpf          1.28      tmp << out;
2812                      
2813                          return tmp;
2814                      }
2815                      
2816 kumpf          1.27  //******************************************************************************
2817                      //
2818                      // Export Messages (used for indications)
2819                      //
2820                      //******************************************************************************
2821 mike           1.23  
2822 kumpf          1.27  //------------------------------------------------------------------------------
2823                      //
2824                      // appendEMethodRequestHeader()
2825                      //
2826                      //     Build HTTP request header for export operation.
2827                      //
2828                      //------------------------------------------------------------------------------
2829 mike           1.23  
2830 kumpf          1.27  void XmlWriter::appendEMethodRequestHeader(
2831 mike           1.125     Buffer& out,
2832 kumpf          1.50      const char* requestUri,
2833 kumpf          1.27      const char* host,
2834 kumpf          1.80      const CIMName& cimMethod,
2835 kumpf          1.82      HttpMethod httpMethod,
2836 kumpf          1.27      const String& authenticationHeader,
2837 kumpf          1.133     const AcceptLanguageList& acceptLanguages,
2838                          const ContentLanguageList& contentLanguages,
2839 kumpf          1.27      Uint32 contentLength)
2840                      {
2841                          char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
2842 mike           1.23  
2843 kumpf          1.82      if (httpMethod == HTTP_METHOD_M_POST)
2844                          {
2845 mike           1.126       out << STRLIT("M-POST ") << requestUri << STRLIT(" HTTP/1.1\r\n");
2846 kumpf          1.82      }
2847                          else
2848                          {
2849 mike           1.126       out << STRLIT("POST ") << requestUri << STRLIT(" HTTP/1.1\r\n");
2850 kumpf          1.82      }
2851 kumpf          1.167     out << STRLIT("HOST: ") << host << STRLIT("\r\n"
2852 thilo.boehm    1.162                   "Content-Type: application/xml; charset=\"utf-8\"\r\n");
2853 kumpf          1.157     OUTPUT_CONTENTLENGTH(out, contentLength);
2854 brian.campbell 1.107 
2855 chuck          1.89      if (acceptLanguages.size() > 0)
2856                          {
2857 kumpf          1.146         out << STRLIT("Accept-Language: ") << acceptLanguages << STRLIT("\r\n");
2858 chuck          1.89      }
2859                          if (contentLanguages.size() > 0)
2860                          {
2861 kumpf          1.146         out << STRLIT("Content-Language: ") << contentLanguages <<
2862                                  STRLIT("\r\n");
2863 david.dillard  1.121     }
2864 brian.campbell 1.107 
2865 brian.campbell 1.113 #ifdef PEGASUS_DEBUG
2866 kumpf          1.146     // backdoor environment variable to turn OFF client requesting transfer
2867                          // encoding. The default is on. to turn off, set this variable to zero.
2868                          // This should be removed when stable. This should only be turned off in
2869                          // a debugging/testing environment.
2870                      
2871                          static const char *clientTransferEncodingOff =
2872                              getenv("PEGASUS_HTTP_TRANSFER_ENCODING_REQUEST");
2873                          if (!clientTransferEncodingOff || *clientTransferEncodingOff != '0')
2874 a.dunfey       1.110 #endif
2875 kumpf          1.146     out << STRLIT("TE: chunked, trailers\r\n");
2876 brian.campbell 1.107 
2877 kumpf          1.82      if (httpMethod == HTTP_METHOD_M_POST)
2878                          {
2879 kumpf          1.146         out << STRLIT("Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");
2880 mike           1.126         out << nn << STRLIT("\r\n");
2881                              out << nn << STRLIT("-CIMExport: MethodRequest\r\n");
2882 kumpf          1.146         out << nn << STRLIT("-CIMExportMethod: ") << cimMethod <<
2883                                  STRLIT("\r\n");
2884 kumpf          1.82      }
2885                          else
2886                          {
2887 kumpf          1.167         out << STRLIT("CIMExport: MethodRequest\r\n"
2888 thilo.boehm    1.162                       "CIMExportMethod: ") << cimMethod << STRLIT("\r\n");
2889 kumpf          1.82      }
2890                      
2891 kumpf          1.27      if (authenticationHeader.size())
2892                          {
2893 mike           1.126         out << authenticationHeader << STRLIT("\r\n");
2894 kumpf          1.27      }
2895 brian.campbell 1.107 
2896 mike           1.126     out << STRLIT("\r\n");
2897 kumpf          1.27  }
2898 mike           1.23  
2899 kumpf          1.27  //------------------------------------------------------------------------------
2900                      //
2901                      // appendEMethodResponseHeader()
2902                      //
2903                      //     Build HTTP response header for export operation.
2904                      //
2905                      //------------------------------------------------------------------------------
2906 mike           1.23  
2907 kumpf          1.27  void XmlWriter::appendEMethodResponseHeader(
2908 mike           1.125     Buffer& out,
2909 kumpf          1.82      HttpMethod httpMethod,
2910 kumpf          1.133     const ContentLanguageList& contentLanguages,
2911 kumpf          1.27      Uint32 contentLength)
2912                      {
2913                          char nn[] = { '0' + (rand() % 10), '0' + (rand() % 10), '\0' };
2914 mike           1.23  
2915 kumpf          1.167     out << STRLIT("HTTP/1.1 " HTTP_STATUS_OK "\r\n"
2916 thilo.boehm    1.162                   "Content-Type: application/xml; charset=\"utf-8\"\r\n");
2917 kumpf          1.157     OUTPUT_CONTENTLENGTH(out, contentLength);
2918 brian.campbell 1.107 
2919 chuck          1.89      if (contentLanguages.size() > 0)
2920                          {
2921 kumpf          1.146         out << STRLIT("Content-Language: ") << contentLanguages <<
2922                                  STRLIT("\r\n");
2923 david.dillard  1.121     }
2924 kumpf          1.82      if (httpMethod == HTTP_METHOD_M_POST)
2925                          {
2926 kumpf          1.167         out << STRLIT("Ext:\r\n"
2927                                            "Cache-Control: no-cache\r\n"
2928 thilo.boehm    1.162                       "Man: http://www.dmtf.org/cim/mapping/http/v1.0; ns=");
2929 mike           1.126         out << nn << STRLIT("\r\n");
2930                              out << nn << STRLIT("-CIMExport: MethodResponse\r\n\r\n");
2931 kumpf          1.82      }
2932                          else
2933                          {
2934 mike           1.126         out << STRLIT("CIMExport: MethodResponse\r\n\r\n");
2935 kumpf          1.82      }
2936 mike           1.23  }
2937                      
2938                      //------------------------------------------------------------------------------
2939                      //
2940 kumpf          1.29  // _appendSimpleExportReqElementBegin()
2941                      // _appendSimpleExportReqElementEnd()
2942 kumpf          1.27  //
2943                      //     <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)>
2944 mike           1.23  //
2945                      //------------------------------------------------------------------------------
2946                      
2947 kumpf          1.29  void XmlWriter::_appendSimpleExportReqElementBegin(
2948 mike           1.125     Buffer& out)
2949 mike           1.23  {
2950 mike           1.126     out << STRLIT("<SIMPLEEXPREQ>\n");
2951 kumpf          1.27  }
2952 mike           1.23  
2953 kumpf          1.29  void XmlWriter::_appendSimpleExportReqElementEnd(
2954 mike           1.125     Buffer& out)
2955 kumpf          1.27  {
2956 mike           1.126     out << STRLIT("</SIMPLEEXPREQ>\n");
2957 mike           1.23  }
2958                      
2959                      //------------------------------------------------------------------------------
2960                      //
2961 kumpf          1.29  // _appendEMethodCallElementBegin()
2962                      // _appendEMethodCallElementEnd()
2963 kumpf          1.27  //
2964                      //     <!ELEMENT EXPMETHODCALL (IPARAMVALUE*)>
2965                      //     <!ATTLIST EXPMETHODCALL %CIMName;>
2966 mike           1.23  //
2967                      //------------------------------------------------------------------------------
2968                      
2969 kumpf          1.29  void XmlWriter::_appendEMethodCallElementBegin(
2970 mike           1.125     Buffer& out,
2971 kumpf          1.80      const CIMName& name)
2972 mike           1.23  {
2973 mike           1.126     out << STRLIT("<EXPMETHODCALL NAME=\"") << name << STRLIT("\">\n");
2974 mike           1.24  }
2975                      
2976 kumpf          1.29  void XmlWriter::_appendEMethodCallElementEnd(
2977 mike           1.125     Buffer& out)
2978 mike           1.24  {
2979 mike           1.126     out << STRLIT("</EXPMETHODCALL>\n");
2980 mike           1.24  }
2981                      
2982                      //------------------------------------------------------------------------------
2983                      //
2984 kumpf          1.85  // _appendEParamValueElementBegin()
2985                      // _appendEParamValueElementEnd()
2986                      //
2987 david.dillard  1.121 //     <!ELEMENT EXPPARAMVALUE (INSTANCE)>
2988                      //     <!ATTLIST EXPPARAMVALUE
2989 kumpf          1.85  //         %CIMName;>
2990                      //
2991                      //------------------------------------------------------------------------------
2992                      
2993                      void XmlWriter::_appendEParamValueElementBegin(
2994 mike           1.125     Buffer& out,
2995 kumpf          1.85      const char* name)
2996                      {
2997 mike           1.126     out << STRLIT("<EXPPARAMVALUE NAME=\"") << name << STRLIT("\">\n");
2998 kumpf          1.85  }
2999                      
3000                      void XmlWriter::_appendEParamValueElementEnd(
3001 mike           1.125     Buffer& out)
3002 kumpf          1.85  {
3003 mike           1.126     out << STRLIT("</EXPPARAMVALUE>\n");
3004 kumpf          1.85  }
3005                      
3006                      //------------------------------------------------------------------------------
3007                      //
3008                      // appendInstanceEParameter()
3009                      //
3010                      //------------------------------------------------------------------------------
3011                      
3012                      void XmlWriter::appendInstanceEParameter(
3013 mike           1.125     Buffer& out,
3014 kumpf          1.85      const char* name,
3015                          const CIMInstance& instance)
3016                      {
3017                          _appendEParamValueElementBegin(out, name);
3018                          appendInstanceElement(out, instance);
3019                          _appendEParamValueElementEnd(out);
3020                      }
3021                      
3022                      //------------------------------------------------------------------------------
3023                      //
3024 kumpf          1.29  // _appendSimpleExportRspElementBegin()
3025                      // _appendSimpleExportRspElementEnd()
3026 mike           1.24  //
3027 kumpf          1.27  //     <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)>
3028 mike           1.24  //
3029                      //------------------------------------------------------------------------------
3030                      
3031 kumpf          1.29  void XmlWriter::_appendSimpleExportRspElementBegin(
3032 mike           1.125     Buffer& out)
3033 kumpf          1.27  {
3034 mike           1.126     out << STRLIT("<SIMPLEEXPRSP>\n");
3035 kumpf          1.27  }
3036                      
3037 kumpf          1.29  void XmlWriter::_appendSimpleExportRspElementEnd(
3038 mike           1.125     Buffer& out)
3039 mike           1.24  {
3040 mike           1.126     out << STRLIT("</SIMPLEEXPRSP>\n");
3041 mike           1.24  }
3042                      
3043                      //------------------------------------------------------------------------------
3044                      //
3045 kumpf          1.29  // _appendEMethodResponseElementBegin()
3046                      // _appendEMethodResponseElementEnd()
3047 mike           1.24  //
3048                      //     <!ELEMENT EXPMETHODRESPONSE (ERROR|IRETURNVALUE?)>
3049                      //     <!ATTLIST EXPMETHODRESPONSE %CIMName;>
3050                      //
3051                      //------------------------------------------------------------------------------
3052                      
3053 kumpf          1.29  void XmlWriter::_appendEMethodResponseElementBegin(
3054 mike           1.125     Buffer& out,
3055 kumpf          1.80      const CIMName& name)
3056 mike           1.24  {
3057 mike           1.126     out << STRLIT("<EXPMETHODRESPONSE NAME=\"") << name << STRLIT("\">\n");
3058 kumpf          1.27  }
3059                      
3060 kumpf          1.29  void XmlWriter::_appendEMethodResponseElementEnd(
3061 mike           1.125     Buffer& out)
3062 kumpf          1.27  {
3063 mike           1.126     out << STRLIT("</EXPMETHODRESPONSE>\n");
3064 mike           1.24  }
3065                      
3066                      //------------------------------------------------------------------------------
3067                      //
3068 kumpf          1.27  // XmlWriter::formatSimpleEMethodReqMessage()
3069 mike           1.24  //
3070                      //------------------------------------------------------------------------------
3071                      
3072 mike           1.125 Buffer XmlWriter::formatSimpleEMethodReqMessage(
3073 kumpf          1.50      const char* requestUri,
3074 kumpf          1.27      const char* host,
3075 kumpf          1.80      const CIMName& eMethodName,
3076 kumpf          1.27      const String& messageId,
3077 kumpf          1.82      HttpMethod httpMethod,
3078 kumpf          1.27      const String& authenticationHeader,
3079 kumpf          1.133     const AcceptLanguageList& httpAcceptLanguages,
3080                          const ContentLanguageList& httpContentLanguages,
3081 mike           1.125     const Buffer& body)
3082 mike           1.24  {
3083 mike           1.125     Buffer out;
3084                          Buffer tmp;
3085 kumpf          1.27  
3086 kumpf          1.29      _appendMessageElementBegin(out, messageId);
3087                          _appendSimpleExportReqElementBegin(out);
3088                          _appendEMethodCallElementBegin(out, eMethodName);
3089 kumpf          1.27      out << body;
3090 kumpf          1.29      _appendEMethodCallElementEnd(out);
3091                          _appendSimpleExportReqElementEnd(out);
3092                          _appendMessageElementEnd(out);
3093 kumpf          1.27  
3094                          appendEMethodRequestHeader(
3095                              tmp,
3096 kumpf          1.50          requestUri,
3097 kumpf          1.27          host,
3098                              eMethodName,
3099 kumpf          1.82          httpMethod,
3100 kumpf          1.27          authenticationHeader,
3101 chuck          1.89          httpAcceptLanguages,
3102                              httpContentLanguages,
3103 kumpf          1.148         out.size());
3104 kumpf          1.27      tmp << out;
3105 mike           1.24  
3106 kumpf          1.50      return tmp;
3107 mike           1.24  }
3108                      
3109                      //------------------------------------------------------------------------------
3110                      //
3111 kumpf          1.27  // XmlWriter::formatSimpleEMethodRspMessage()
3112 mike           1.24  //
3113                      //------------------------------------------------------------------------------
3114                      
3115 mike           1.125 Buffer XmlWriter::formatSimpleEMethodRspMessage(
3116 kumpf          1.80      const CIMName& eMethodName,
3117 mike           1.24      const String& messageId,
3118 kumpf          1.82      HttpMethod httpMethod,
3119 kumpf          1.133     const ContentLanguageList& httpContentLanguages,
3120 mike           1.125     const Buffer& body)
3121 mike           1.24  {
3122 mike           1.125     Buffer out;
3123                          Buffer tmp;
3124 kumpf          1.27  
3125 kumpf          1.29      _appendMessageElementBegin(out, messageId);
3126                          _appendSimpleExportRspElementBegin(out);
3127                          _appendEMethodResponseElementBegin(out, eMethodName);
3128 kumpf          1.27      out << body;
3129 kumpf          1.29      _appendEMethodResponseElementEnd(out);
3130                          _appendSimpleExportRspElementEnd(out);
3131                          _appendMessageElementEnd(out);
3132 kumpf          1.28  
3133 david.dillard  1.121     appendEMethodResponseHeader(tmp,
3134 kumpf          1.146         httpMethod,
3135                              httpContentLanguages,
3136 kumpf          1.148         out.size());
3137 kumpf          1.28      tmp << out;
3138                      
3139                          return tmp;
3140                      }
3141                      
3142                      //------------------------------------------------------------------------------
3143                      //
3144                      // XmlWriter::formatSimpleEMethodErrorRspMessage()
3145                      //
3146                      //------------------------------------------------------------------------------
3147                      
3148 mike           1.125 Buffer XmlWriter::formatSimpleEMethodErrorRspMessage(
3149 kumpf          1.80      const CIMName& eMethodName,
3150 kumpf          1.28      const String& messageId,
3151 kumpf          1.82      HttpMethod httpMethod,
3152 kumpf          1.42      const CIMException& cimException)
3153 kumpf          1.28  {
3154 mike           1.125     Buffer out;
3155                          Buffer tmp;
3156 kumpf          1.28  
3157 kumpf          1.29      _appendMessageElementBegin(out, messageId);
3158                          _appendSimpleExportRspElementBegin(out);
3159 kumpf          1.80      _appendEMethodResponseElementBegin(out, eMethodName);
3160 kumpf          1.42      _appendErrorElement(out, cimException);
3161 kumpf          1.29      _appendEMethodResponseElementEnd(out);
3162                          _appendSimpleExportRspElementEnd(out);
3163                          _appendMessageElementEnd(out);
3164 kumpf          1.27  
3165 kumpf          1.146     appendEMethodResponseHeader(
3166                              tmp,
3167                              httpMethod,
3168                              cimException.getContentLanguages(),
3169 kumpf          1.148         out.size());
3170 kumpf          1.27      tmp << out;
3171                      
3172                          return tmp;
3173 mike           1.24  }
3174                      
3175                      //------------------------------------------------------------------------------
3176                      //
3177 kumpf          1.27  // XmlWriter::getNextMessageId()
3178 mike           1.24  //
3179                      //------------------------------------------------------------------------------
3180                      
3181 mike           1.139 static IDFactory _messageIDFactory(1000);
3182                      
3183 kumpf          1.27  String XmlWriter::getNextMessageId()
3184 mike           1.24  {
3185 marek          1.151     char scratchBuffer[22];
3186                          Uint32 n;
3187 kumpf          1.167     const char * startP = Uint32ToString(scratchBuffer,
3188 marek          1.151                                          _messageIDFactory.getID(),
3189                                                               n);
3190                          return String(startP, n);
3191 kumpf          1.68  }
3192                      
3193                      //------------------------------------------------------------------------------
3194                      //
3195                      // XmlWriter::keyBindingTypeToString
3196                      //
3197                      //------------------------------------------------------------------------------
3198 thilo.boehm    1.162 const StrLit XmlWriter::keyBindingTypeToString (CIMKeyBinding::Type type)
3199 kumpf          1.68  {
3200                          switch (type)
3201                          {
3202 kumpf          1.79          case CIMKeyBinding::BOOLEAN:
3203 thilo.boehm    1.162             return STRLIT("boolean");
3204 kumpf          1.68  
3205 kumpf          1.79          case CIMKeyBinding::STRING:
3206 thilo.boehm    1.162             return STRLIT("string");
3207 kumpf          1.68  
3208 kumpf          1.79          case CIMKeyBinding::NUMERIC:
3209 thilo.boehm    1.162             return STRLIT("numeric");
3210 kumpf          1.68  
3211 kumpf          1.79          case CIMKeyBinding::REFERENCE:
3212 kumpf          1.68          default:
3213                                  PEGASUS_ASSERT(false);
3214                          }
3215                      
3216 thilo.boehm    1.162     return STRLIT("unknown");
3217 mike           1.23  }
3218                      
3219                      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2