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

Diff for /pegasus/src/Pegasus/Common/SCMOXmlWriter.cpp between version 1.1.2.3 and 1.1.2.7

version 1.1.2.3, 2009/09/29 08:18:49 version 1.1.2.7, 2009/10/14 12:47:15
Line 78 
Line 78 
  
         if (kbType == CIMTYPE_REFERENCE)         if (kbType == CIMTYPE_REFERENCE)
         {         {
             /*              SCMOInstance * ref = kbValue->extRefPtr;
             TODO: NEED RESOLvE the value down to a SCMO....              appendValueReferenceElement(out, *ref, true);
             CIMObjectPath ref = keyBindings[i].getValue();  
             appendValueReferenceElement(out, ref, true);  
             */  
         }         }
         else         else
         {         {
Line 141 
Line 138 
     }     }
  
     // Append Properties:     // Append Properties:
     for (Uint32 i=0,k=scmoInstance.inst.hdr->numberProperties;i<k;i++)      for (Uint32 i=0,k=scmoInstance.getPropertyCount();i<k;i++)
     {     {
         if (scmoInstance.inst.hdr->flags.isFiltered &&         if (scmoInstance.inst.hdr->flags.isFiltered &&
             !scmoInstance._isPropertyInFilter(i))             !scmoInstance._isPropertyInFilter(i))
Line 207 
Line 204 
  
     out << STRLIT(">\n");     out << STRLIT(">\n");
     // append the value of the qualifier     // append the value of the qualifier
       SCMOXmlWriter::appendValueElement(out, theQualifier.value, base);
     // TODO: Implement and call appendValueElement  
     //SCMOXmlWriter::appendValueElement(out, theQualifier.value, clsbase);  
  
     out << STRLIT("</QUALIFIER>\n");     out << STRLIT("</QUALIFIER>\n");
 } }
Line 281 
Line 276 
         out << STRLIT("\" ");         out << STRLIT("\" ");
         if (propertyType == CIMTYPE_OBJECT)         if (propertyType == CIMTYPE_OBJECT)
         {         {
 /*  /*          TODO: Implement writing CIM_OBJECT
             // If the property array type is CIMObject, then             // If the property array type is CIMObject, then
             //    encode the property in CIM-XML as a string array with the             //    encode the property in CIM-XML as a string array with the
             //    EmbeddedObject attribute (there is not currently a CIM-XML             //    EmbeddedObject attribute (there is not currently a CIM-XML
Line 323 
Line 318 
         }         }
         else if (propertyType == CIMTYPE_INSTANCE)         else if (propertyType == CIMTYPE_INSTANCE)
         {         {
 /*  /*          TODO: Implement writing embedded instance
             // If the property array type is CIMInstance, then             // If the property array type is CIMInstance, then
             //   encode the property in CIM-XML as a string array with the             //   encode the property in CIM-XML as a string array with the
             //   EmbeddedObject attribute (there is not currently a CIM-XML             //   EmbeddedObject attribute (there is not currently a CIM-XML
Line 419 
Line 414 
     }     }
     else if (propertyType == CIMTYPE_REFERENCE)     else if (propertyType == CIMTYPE_REFERENCE)
     {     {
 /*          out << STRLIT("<PROPERTY.REFERENCE NAME=\"");
         out << STRLIT("<PROPERTY.REFERENCE"          out.append(
                       " NAME=\"") << rep->getName() << STRLIT("\" ");              &(clsbase[propertyDef->name.start]),
               propertyDef->name.length-1);
           out << STRLIT("\" ");
  
         if (!rep->getReferenceClassName().isNull())          if (0 != propertyDef->refClassName.start)
         {         {
             out << STRLIT(" REFERENCECLASS=\"")              out << STRLIT(" REFERENCECLASS=\"");
                 << rep->getReferenceClassName();              out.append(
                   &(clsbase[propertyDef->refClassName.start]),
                   propertyDef->refClassName.length-1);
             out.append('"');             out.append('"');
         }         }
  
         if (!rep->getClassOrigin().isNull())          if (scmoInstance.inst.hdr->flags.includeClassOrigin)
         {         {
             out << STRLIT(" CLASSORIGIN=\"") << rep->getClassOrigin();              if (propertyDef->originClassName.start != 0)
               {
                   out << STRLIT(" CLASSORIGIN=\"");
                   out.append(
                       &(clsbase[propertyDef->originClassName.start]),
                       propertyDef->originClassName.length-1);
             out.append('"');             out.append('"');
         }         }
           }
         if (rep->getPropagated())          if (propertyDef->flags.propagated)
         {         {
             out << STRLIT(" PROPAGATED=\"true\"");             out << STRLIT(" PROPAGATED=\"true\"");
         }         }
   
         out << STRLIT(">\n");         out << STRLIT(">\n");
           // Append Instance Qualifiers:
         for (Uint32 i = 0, n = rep->getQualifierCount(); i < n; i++)          if (scmoInstance.inst.hdr->flags.includeQualifiers)
             XmlWriter::appendQualifierElement(out, rep->getQualifier(i));          {
               SCMBQualifier * theArray=
         XmlWriter::appendValueElement(out, rep->getValue());                  (SCMBQualifier*)
                       &(clsbase[propertyDef->qualifierArray.start]);
               // need to iterate
               for (Uint32 i=0, n=propertyDef->numberOfQualifiers;i<n;i++)
               {
                   SCMOXmlWriter::appendQualifierElement(
                       out,
                       theArray[i],
                       clsbase);
               }
           }
           SCMOXmlWriter::appendValueElement(out,*propertyValue,propertyValueBase);
         out << STRLIT("</PROPERTY.REFERENCE>\n");         out << STRLIT("</PROPERTY.REFERENCE>\n");
 */  
     }     }
     else     else
     {     {
Line 479 
Line 491 
  
         if (propertyType == CIMTYPE_OBJECT)         if (propertyType == CIMTYPE_OBJECT)
         {         {
 /*  /*          TODO: Implement writing Embedded Object
             // If the property type is CIMObject, then             // If the property type is CIMObject, then
             //   encode the property in CIM-XML as a string with the             //   encode the property in CIM-XML as a string with the
             //   EmbeddedObject attribute (there is not currently a CIM-XML             //   EmbeddedObject attribute (there is not currently a CIM-XML
Line 522 
Line 534 
             }             }
             else if (propertyType == CIMTYPE_INSTANCE)             else if (propertyType == CIMTYPE_INSTANCE)
             {             {
 /*  /*              TODO: Implement writing Embedded Instance
                 CIMInstance a;                 CIMInstance a;
                 rep->getValue().get(a);                 rep->getValue().get(a);
                 out << STRLIT(" TYPE=\"string\""                 out << STRLIT(" TYPE=\"string\""
Line 586 
Line 598 
  
 void SCMOXmlWriter::appendValueElement( void SCMOXmlWriter::appendValueElement(
     Buffer& out,     Buffer& out,
     SCMBValue & value,      const SCMBValue & value,
     const char * base)     const char * base)
 { {
     if (value.flags.isNull)     if (value.flags.isNull)
Line 604 
Line 616 
     }     }
     else if (value.valueType == CIMTYPE_REFERENCE)     else if (value.valueType == CIMTYPE_REFERENCE)
     {     {
 /*          SCMOInstance * ref = value.value.extRefPtr;
         // Has to be separate because it uses VALUE.REFERENCE tag          appendValueReferenceElement(out, *ref, true);
         CIMObjectPath v;  
         value.get(v);  
         _xmlWritter_appendValue(out, v);  
 */  
     }     }
     else     else
     {     {
Line 622 
Line 630 
     }     }
 } }
  
   //------------------------------------------------------------------------------
   //
   // appendValueReferenceElement()
   //
   //    <!ELEMENT VALUE.REFERENCE
   //        (CLASSPATH|LOCALCLASSPATH|CLASSNAME|INSTANCEPATH|LOCALINSTANCEPATH|
   //         INSTANCENAME)>
   //
   //------------------------------------------------------------------------------
   void SCMOXmlWriter::appendValueReferenceElement(
       Buffer& out,
       const SCMOInstance& ref,
       Boolean putValueWrapper)
   {
       if (putValueWrapper)
       {
           out << STRLIT("<VALUE.REFERENCE>\n");
       }
   
       // See if it is a class or instance reference (instance references have
       // key-bindings; class references do not).
   
       // differentiate between instance and class using the SCMO flag
       if (ref.inst.hdr->flags.isClassOnly)
       {
           // class
           if (0 != ref.inst.hdr->hostName.start)
           {
               appendClassPathElement(out, ref);
           }
           else if (0 != ref.inst.hdr->instNameSpace.start)
           {
               appendLocalClassPathElement(out, ref);
           }
           else
           {
               Uint64 classNameLength=0;
               const char* className = ref.getClassName_l(classNameLength);
               appendClassNameElement(out, className, classNameLength-1);
           }
       }
       else
       {
           // instance
           if (0 != ref.inst.hdr->hostName.start)
           {
               appendInstancePathElement(out, ref);
           }
           else if (0 != ref.inst.hdr->instNameSpace.start)
           {
               appendLocalInstancePathElement(out, ref);
           }
           else
           {
               appendInstanceNameElement(out, ref);
           }
       }
       if (putValueWrapper)
       {
           out << STRLIT("</VALUE.REFERENCE>\n");
       }
   }
   
   // appendLocalInstancePathElement()
   //     <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH, INSTANCENAME)>
   void SCMOXmlWriter::appendLocalInstancePathElement(
       Buffer& out,
       const SCMOInstance& instancePath)
   {
       out << STRLIT("<LOCALINSTANCEPATH>\n");
       Uint64 nsLength=0;
       const char* ns=instancePath.getNameSpace_l(nsLength);
       appendLocalNameSpacePathElement(out, ns, nsLength-1);
       appendInstanceNameElement(out, instancePath);
       out << STRLIT("</LOCALINSTANCEPATH>\n");
   }
   
   // appendInstancePathElement()
   //     <!ELEMENT INSTANCEPATH (NAMESPACEPATH,INSTANCENAME)>
   void SCMOXmlWriter::appendInstancePathElement(
       Buffer& out,
       const SCMOInstance& instancePath)
   {
       out << STRLIT("<INSTANCEPATH>\n");
   
       Uint64 hostnameLength=0;
       const char* hostname=instancePath.getHostName_l(hostnameLength);
       Uint64 nsLength=0;
       const char* ns=instancePath.getNameSpace_l(nsLength);
       appendNameSpacePathElement(out,hostname,hostnameLength-1,ns,nsLength-1);
   
       appendInstanceNameElement(out, instancePath);
       out << STRLIT("</INSTANCEPATH>\n");
   }
   
   // appendValueObjectWithPathElement()
   //     <!ELEMENT VALUE.OBJECTWITHPATH
   //         ((CLASSPATH,CLASS)|(INSTANCEPATH,INSTANCE))>
   void SCMOXmlWriter::appendValueObjectWithPathElement(
       Buffer& out,
       const SCMOInstance& objectWithPath)
   {
       out << STRLIT("<VALUE.OBJECTWITHPATH>\n");
   
       appendValueReferenceElement(out, objectWithPath, false);
       appendObjectElement(out, objectWithPath);
   
       out << STRLIT("</VALUE.OBJECTWITHPATH>\n");
   }
   
   // appendObjectElement()
   // May refer to a CLASS or an INSTANCE
   void SCMOXmlWriter::appendObjectElement(
       Buffer& out,
       const SCMOInstance& object)
   {
       if (object.inst.hdr->flags.isClassOnly)
       {
           appendClassElement(out, object);
       }
       else
       {
           appendInstanceElement(out, object);
       }
   }
   
   //------------------------------------------------------------------------------
   //
   // appendClassElement()
   //
   //     <!ELEMENT CLASS
   //         (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,METHOD*)>
   //     <!ATTLIST CLASS
   //         %CIMName;
   //         %SuperClass;>
   //
   //------------------------------------------------------------------------------
   
   void SCMOXmlWriter::appendClassElement(
       Buffer& out,
       const SCMOInstance& cimClass)
   {
   
       SCMBClass_Main* theClass = cimClass.inst.hdr->theClass->cls.hdr;
       const char* clsBase = cimClass.inst.hdr->theClass->cls.base;
   
       // Class opening element:
       out << STRLIT("<CLASS NAME=\"");
       out.append(
           &(clsBase[theClass->className.start]),
           theClass->className.length-1);
   
       out << STRLIT("\" ");
       if (0 != theClass->superClassName.start)
       {
           out << STRLIT(" SUPERCLASS=\"");
           out.append(
               &(clsBase[theClass->superClassName.start]),
               theClass->superClassName.length-1);
           out << STRLIT("\" ");
       }
       out << STRLIT(">\n");
   
       // Append class qualifiers
       SCMBQualifier *theArray =
           (SCMBQualifier*)&(clsBase[theClass->qualifierArray.start]);
       for (Uint32 i=0, n=theClass->numberOfQualifiers;i<n;i++)
       {
           SCMOXmlWriter::appendQualifierElement(out,theArray[i],clsBase);
       }
   
       // Append Property definitions:
       for (Uint32 i=0,k=cimClass.getPropertyCount();i<k;i++)
       {
               SCMOXmlWriter::appendPropertyElement(out,cimClass,i);
       }
   
       // TODO: What do with Method definitions ?
       // for (Uint32 i = 0, n = rep->getMethodCount(); i < n; i++)
       //    XmlWriter::appendMethodElement(out, rep->getMethod(i));
   
       // Class closing element:
       out << STRLIT("</CLASS>\n");
   }
   
   // appendLocalClassPathElement()
   //     <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)>
   void SCMOXmlWriter::appendLocalClassPathElement(
       Buffer& out,
       const SCMOInstance& classPath)
   {
       out << STRLIT("<LOCALCLASSPATH>\n");
       Uint64 hostnameLength=0;
       const char* hostname=classPath.getHostName_l(hostnameLength);
       Uint64 nsLength=0;
       const char* ns=classPath.getNameSpace_l(nsLength);
   
       appendNameSpacePathElement(out,hostname,hostnameLength-1,ns,nsLength-1);
   
       Uint64 classNameLength=0;
       const char* className = classPath.getClassName_l(classNameLength);
       appendClassNameElement(out, className, classNameLength-1);
       out << STRLIT("</LOCALCLASSPATH>\n");
   }
   
   // appendClassPathElement()
   //     <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)>
   void SCMOXmlWriter::appendClassPathElement(
       Buffer& out,
       const SCMOInstance& classPath)
   {
       out << STRLIT("<CLASSPATH>\n");
   
       Uint64 hostnameLength=0;
       const char* hostname=classPath.getHostName_l(hostnameLength);
       Uint64 nsLength=0;
       const char* ns=classPath.getNameSpace_l(nsLength);
   
       appendNameSpacePathElement(out,hostname,hostnameLength,ns,nsLength);
   
       Uint64 classNameLength=0;
       const char* className = classPath.getClassName_l(classNameLength);
   
       appendClassNameElement(out, className, classNameLength-1);
       out << STRLIT("</CLASSPATH>\n");
   }
   
 void SCMOXmlWriter::appendSCMBUnion( void SCMOXmlWriter::appendSCMBUnion(
     Buffer& out,     Buffer& out,
     const SCMBUnion & u,     const SCMBUnion & u,


Legend:
Removed from v.1.1.2.3  
changed lines
  Added in v.1.1.2.7

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2