version 1.1.2.9, 2009/10/21 08:59:53
|
version 1.3.2.2, 2011/10/18 13:53:28
|
|
|
const SCMOInstance& scmoInstance) | const SCMOInstance& scmoInstance) |
{ | { |
out << STRLIT("<INSTANCENAME CLASSNAME=\""); | out << STRLIT("<INSTANCENAME CLASSNAME=\""); |
Uint64 len; |
Uint32 len; |
const char * className = scmoInstance.getClassName_l(len); | const char * className = scmoInstance.getClassName_l(len); |
out.append(className,len-1); |
out.append(className,len); |
out << STRLIT("\">\n"); |
// TODO: check performance impact |
|
out.append('"','>','\n'); |
| |
for (Uint32 i = 0, n = scmoInstance.getKeyBindingCount(); i < n; i++) | for (Uint32 i = 0, n = scmoInstance.getKeyBindingCount(); i < n; i++) |
{ | { |
|
|
| |
out << STRLIT("<KEYBINDING NAME=\""); | out << STRLIT("<KEYBINDING NAME=\""); |
out.append(kbName,kbNameLen-1); | out.append(kbName,kbNameLen-1); |
out << STRLIT("\">\n"); |
out.append('"','>','\n'); |
| |
if (kbType == CIMTYPE_REFERENCE) | if (kbType == CIMTYPE_REFERENCE) |
{ | { |
|
|
{ | { |
out << STRLIT("<KEYVALUE VALUETYPE=\""); | out << STRLIT("<KEYVALUE VALUETYPE=\""); |
out << xmlWriterKeyTypeStrings(kbType); | out << xmlWriterKeyTypeStrings(kbType); |
out << STRLIT("\">"); |
out.append('"','>'); |
| |
if (SCMO_OK == smrc) | if (SCMO_OK == smrc) |
{ | { |
|
|
// Class opening element: | // Class opening element: |
| |
out << STRLIT("<INSTANCE CLASSNAME=\""); | out << STRLIT("<INSTANCE CLASSNAME=\""); |
Uint64 len; |
Uint32 len; |
const char * className = scmoInstance.getClassName_l(len); | const char * className = scmoInstance.getClassName_l(len); |
out.append(className,len-1); |
out.append(className,len); |
out << STRLIT("\" >\n"); |
out.append('"',' ','>','\n'); |
|
//out << STRLIT("\" >\n"); |
| |
// Append Instance Qualifiers: | // Append Instance Qualifiers: |
if (scmoInstance.inst.hdr->flags.includeQualifiers) | if (scmoInstance.inst.hdr->flags.includeQualifiers) |
{ | { |
SCMBClass_Main *classMain=scmoInstance.inst.hdr->theClass->cls.hdr; |
SCMBClass_Main *classMain=scmoInstance.inst.hdr->theClass.ptr->cls.hdr; |
char* clsbase = scmoInstance.inst.hdr->theClass->cls.base; |
char* clsbase = scmoInstance.inst.hdr->theClass.ptr->cls.base; |
| |
SCMBQualifier *theArray = | SCMBQualifier *theArray = |
(SCMBQualifier*)&(clsbase[classMain->qualifierArray.start]); | (SCMBQualifier*)&(clsbase[classMain->qualifierArray.start]); |
|
|
} | } |
| |
// Append Properties: | // Append Properties: |
|
// getPropertyCount() returns number of properties, only non-filtered ones |
for (Uint32 i=0,k=scmoInstance.getPropertyCount();i<k;i++) | for (Uint32 i=0,k=scmoInstance.getPropertyCount();i<k;i++) |
{ | { |
if (scmoInstance.inst.hdr->flags.isFiltered && |
// function _getPropertyAt() used by appendPropertyElement |
!scmoInstance._isPropertyInFilter(i)) |
// translates the filter position of a property into the real one |
{ |
// for us |
// Property is filtered, ignore and go to next |
|
continue; |
|
} |
|
else |
|
{ |
|
SCMOXmlWriter::appendPropertyElement(out,scmoInstance,i); | SCMOXmlWriter::appendPropertyElement(out,scmoInstance,i); |
} | } |
} |
|
// Instance closing element: | // Instance closing element: |
out << STRLIT("</INSTANCE>\n"); | out << STRLIT("</INSTANCE>\n"); |
} | } |
|
|
{ | { |
out.append( | out.append( |
&(base[theQualifier.userDefName.start]), | &(base[theQualifier.userDefName.start]), |
theQualifier.userDefName.length-1); |
theQualifier.userDefName.size-1); |
} | } |
} | } |
else | else |
{ | { |
out << SCMOClass::qualifierNameStrLit(theQualifier.name); | out << SCMOClass::qualifierNameStrLit(theQualifier.name); |
} | } |
|
out.append('"',' '); |
out << STRLIT("\" "); |
//out << STRLIT("\" "); |
| |
// Append type | // Append type |
out << xmlWriterTypeStrings(theQualifier.value.valueType); | out << xmlWriterTypeStrings(theQualifier.value.valueType); |
|
|
out, | out, |
CIMFlavor(theQualifier.flavor)); | CIMFlavor(theQualifier.flavor)); |
| |
out << STRLIT(">\n"); |
out.append('>','\n'); |
|
//out << STRLIT(">\n"); |
// append the value of the qualifier | // append the value of the qualifier |
SCMOXmlWriter::appendValueElement(out, theQualifier.value, base); | SCMOXmlWriter::appendValueElement(out, theQualifier.value, base); |
| |
|
|
Uint32 pos) | Uint32 pos) |
{ | { |
CIMType propertyType; | CIMType propertyType; |
Buffer embeddedQualifierOutput; |
|
| |
// This is an absolute pointer at a SCMBValue | // This is an absolute pointer at a SCMBValue |
SCMBValue * propertyValue; | SCMBValue * propertyValue; |
|
|
SCMBClassProperty * propertyDef; | SCMBClassProperty * propertyDef; |
// This is the absolute pointer at which the class info for the given | // This is the absolute pointer at which the class info for the given |
// instance starts | // instance starts |
const char* clsbase = scmoInstance.inst.hdr->theClass->cls.base; |
const char* clsbase = scmoInstance.inst.hdr->theClass.ptr->cls.base; |
| |
SCMO_RC rc = scmoInstance.getPropertyAt( |
scmoInstance._getPropertyAt( |
pos, | pos, |
&propertyValue, | &propertyValue, |
&propertyValueBase, | &propertyValueBase, |
|
|
| |
propertyType = propertyValue->valueType; | propertyType = propertyValue->valueType; |
| |
|
|
if (propertyValue->flags.isArray) | if (propertyValue->flags.isArray) |
{ | { |
Uint32 arraySize=propertyValue->valueArraySize; | Uint32 arraySize=propertyValue->valueArraySize; |
|
|
| |
out.append( | out.append( |
&(clsbase[propertyDef->name.start]), | &(clsbase[propertyDef->name.start]), |
propertyDef->name.length-1); |
(propertyDef->name.size-1)); |
| |
out << STRLIT("\" "); |
out.append('"',' '); |
|
//out << STRLIT("\" "); |
if (propertyType == CIMTYPE_OBJECT) | if (propertyType == CIMTYPE_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 |
// "object" datatype) | // "object" datatype) |
|
|
out << STRLIT(" TYPE=\"string\""); | out << STRLIT(" TYPE=\"string\""); |
// If the Embedded Object is an instance, always add the | // If the Embedded Object is an instance, always add the |
// EmbeddedObject attribute. | // EmbeddedObject attribute. |
|
|
out << STRLIT(" CLASSORIGIN=\""); | out << STRLIT(" CLASSORIGIN=\""); |
out.append( | out.append( |
&(clsbase[propertyDef->originClassName.start]), | &(clsbase[propertyDef->originClassName.start]), |
propertyDef->originClassName.length-1); |
(propertyDef->originClassName.size-1)); |
out.append('"'); | out.append('"'); |
} | } |
} | } |
|
|
out << STRLIT(" PROPAGATED=\"true\""); | out << STRLIT(" PROPAGATED=\"true\""); |
} | } |
| |
out << STRLIT(">\n"); |
out.append('>','\n'); |
|
//out << STRLIT(">\n"); |
| |
// Append Instance Qualifiers: | // Append Instance Qualifiers: |
if (scmoInstance.inst.hdr->flags.includeQualifiers) | if (scmoInstance.inst.hdr->flags.includeQualifiers) |
|
|
clsbase); | clsbase); |
} | } |
} | } |
|
|
SCMOXmlWriter::appendValueElement(out,*propertyValue,propertyValueBase); | SCMOXmlWriter::appendValueElement(out,*propertyValue,propertyValueBase); |
|
|
out << STRLIT("</PROPERTY.ARRAY>\n"); | out << STRLIT("</PROPERTY.ARRAY>\n"); |
} | } |
else if (propertyType == CIMTYPE_REFERENCE) | else if (propertyType == CIMTYPE_REFERENCE) |
|
|
out << STRLIT("<PROPERTY.REFERENCE NAME=\""); | out << STRLIT("<PROPERTY.REFERENCE NAME=\""); |
out.append( | out.append( |
&(clsbase[propertyDef->name.start]), | &(clsbase[propertyDef->name.start]), |
propertyDef->name.length-1); |
(propertyDef->name.size-1)); |
out << STRLIT("\" "); |
out.append('"',' '); |
|
//out << STRLIT("\" "); |
| |
if (0 != propertyDef->refClassName.start) | if (0 != propertyDef->refClassName.start) |
{ | { |
out << STRLIT(" REFERENCECLASS=\""); | out << STRLIT(" REFERENCECLASS=\""); |
out.append( | out.append( |
&(clsbase[propertyDef->refClassName.start]), | &(clsbase[propertyDef->refClassName.start]), |
propertyDef->refClassName.length-1); |
(propertyDef->refClassName.size-1)); |
out.append('"'); | out.append('"'); |
} | } |
| |
|
|
out << STRLIT(" CLASSORIGIN=\""); | out << STRLIT(" CLASSORIGIN=\""); |
out.append( | out.append( |
&(clsbase[propertyDef->originClassName.start]), | &(clsbase[propertyDef->originClassName.start]), |
propertyDef->originClassName.length-1); |
(propertyDef->originClassName.size-1)); |
out.append('"'); | out.append('"'); |
} | } |
} | } |
|
|
{ | { |
out << STRLIT(" PROPAGATED=\"true\""); | out << STRLIT(" PROPAGATED=\"true\""); |
} | } |
out << STRLIT(">\n"); |
out.append('>','\n'); |
|
//out << STRLIT(">\n"); |
// Append Instance Qualifiers: | // Append Instance Qualifiers: |
if (scmoInstance.inst.hdr->flags.includeQualifiers) | if (scmoInstance.inst.hdr->flags.includeQualifiers) |
{ | { |
|
|
| |
out.append( | out.append( |
&(clsbase[propertyDef->name.start]), | &(clsbase[propertyDef->name.start]), |
propertyDef->name.length-1); |
(propertyDef->name.size-1)); |
| |
out << STRLIT("\" "); |
out.append('"',' '); |
|
//out << STRLIT("\" "); |
| |
if (scmoInstance.inst.hdr->flags.includeClassOrigin) | if (scmoInstance.inst.hdr->flags.includeClassOrigin) |
{ | { |
|
|
out << STRLIT(" CLASSORIGIN=\""); | out << STRLIT(" CLASSORIGIN=\""); |
out.append( | out.append( |
&(clsbase[propertyDef->originClassName.start]), | &(clsbase[propertyDef->originClassName.start]), |
propertyDef->originClassName.length-1); |
(propertyDef->originClassName.size-1)); |
out.append('"'); | out.append('"'); |
} | } |
} | } |
|
|
out << STRLIT(" EmbeddedObject=\"object\"" | out << STRLIT(" EmbeddedObject=\"object\"" |
" EMBEDDEDOBJECT=\"object\""); | " EMBEDDEDOBJECT=\"object\""); |
} | } |
|
} |
else if (propertyType == CIMTYPE_INSTANCE) | else if (propertyType == CIMTYPE_INSTANCE) |
{ | { |
out << STRLIT(" TYPE=\"string\"" | out << STRLIT(" TYPE=\"string\"" |
" EmbeddedObject=\"instance\"" | " EmbeddedObject=\"instance\"" |
" EMBEDDEDOBJECT=\"instance\""); | " EMBEDDEDOBJECT=\"instance\""); |
} | } |
} |
|
else | else |
{ | { |
out.append(' '); | out.append(' '); |
out << xmlWriterTypeStrings(propertyType); | out << xmlWriterTypeStrings(propertyType); |
} | } |
out << STRLIT(">\n"); |
out.append('>','\n'); |
|
//out << STRLIT(">\n"); |
| |
// Append Instance Qualifiers: | // Append Instance Qualifiers: |
if (scmoInstance.inst.hdr->flags.includeQualifiers) | if (scmoInstance.inst.hdr->flags.includeQualifiers) |
|
|
} | } |
else | else |
{ | { |
Uint64 classNameLength=0; |
Uint32 classNameLength=0; |
const char* className = ref.getClassName_l(classNameLength); | const char* className = ref.getClassName_l(classNameLength); |
appendClassNameElement(out, className, classNameLength-1); |
appendClassNameElement(out, className, classNameLength); |
} | } |
} | } |
else | else |
|
|
const SCMOInstance& instancePath) | const SCMOInstance& instancePath) |
{ | { |
out << STRLIT("<LOCALINSTANCEPATH>\n"); | out << STRLIT("<LOCALINSTANCEPATH>\n"); |
Uint64 nsLength=0; |
Uint32 nsLength=0; |
const char* ns=instancePath.getNameSpace_l(nsLength); | const char* ns=instancePath.getNameSpace_l(nsLength); |
appendLocalNameSpacePathElement(out, ns, nsLength-1); |
appendLocalNameSpacePathElement(out, ns, nsLength); |
appendInstanceNameElement(out, instancePath); | appendInstanceNameElement(out, instancePath); |
out << STRLIT("</LOCALINSTANCEPATH>\n"); | out << STRLIT("</LOCALINSTANCEPATH>\n"); |
} | } |
|
|
{ | { |
out << STRLIT("<INSTANCEPATH>\n"); | out << STRLIT("<INSTANCEPATH>\n"); |
| |
Uint64 hostnameLength=0; |
Uint32 hostnameLength=0; |
const char* hostname=instancePath.getHostName_l(hostnameLength); | const char* hostname=instancePath.getHostName_l(hostnameLength); |
Uint64 nsLength=0; |
Uint32 nsLength=0; |
const char* ns=instancePath.getNameSpace_l(nsLength); | const char* ns=instancePath.getNameSpace_l(nsLength); |
appendNameSpacePathElement(out,hostname,hostnameLength-1,ns,nsLength-1); |
appendNameSpacePathElement(out,hostname,hostnameLength,ns,nsLength); |
| |
appendInstanceNameElement(out, instancePath); | appendInstanceNameElement(out, instancePath); |
out << STRLIT("</INSTANCEPATH>\n"); | out << STRLIT("</INSTANCEPATH>\n"); |
|
|
const SCMOInstance& cimClass) | const SCMOInstance& cimClass) |
{ | { |
| |
SCMBClass_Main* theClass = cimClass.inst.hdr->theClass->cls.hdr; |
SCMBClass_Main* ptrClass = cimClass.inst.hdr->theClass.ptr->cls.hdr; |
const char* clsBase = cimClass.inst.hdr->theClass->cls.base; |
const char* clsBase = cimClass.inst.hdr->theClass.ptr->cls.base; |
| |
// Class opening element: | // Class opening element: |
out << STRLIT("<CLASS NAME=\""); | out << STRLIT("<CLASS NAME=\""); |
out.append( | out.append( |
&(clsBase[theClass->className.start]), |
&(clsBase[ptrClass->className.start]), |
theClass->className.length-1); |
(ptrClass->className.size-1)); |
| |
out << STRLIT("\" "); |
out.append('"',' '); |
if (0 != theClass->superClassName.start) |
if (0 != ptrClass->superClassName.start) |
{ | { |
out << STRLIT(" SUPERCLASS=\""); | out << STRLIT(" SUPERCLASS=\""); |
out.append( | out.append( |
&(clsBase[theClass->superClassName.start]), |
&(clsBase[ptrClass->superClassName.start]), |
theClass->superClassName.length-1); |
(ptrClass->superClassName.size-1)); |
out << STRLIT("\" "); |
out.append('"',' '); |
} | } |
out << STRLIT(">\n"); |
out.append('>','\n'); |
| |
// Append class qualifiers | // Append class qualifiers |
SCMBQualifier *theArray = | SCMBQualifier *theArray = |
(SCMBQualifier*)&(clsBase[theClass->qualifierArray.start]); |
(SCMBQualifier*)&(clsBase[ptrClass->qualifierArray.start]); |
for (Uint32 i=0, n=theClass->numberOfQualifiers;i<n;i++) |
for (Uint32 i=0, n=ptrClass->numberOfQualifiers;i<n;i++) |
{ | { |
SCMOXmlWriter::appendQualifierElement(out,theArray[i],clsBase); | SCMOXmlWriter::appendQualifierElement(out,theArray[i],clsBase); |
} | } |
|
|
const SCMOInstance& classPath) | const SCMOInstance& classPath) |
{ | { |
out << STRLIT("<LOCALCLASSPATH>\n"); | out << STRLIT("<LOCALCLASSPATH>\n"); |
Uint64 hostnameLength=0; |
Uint32 hostnameLength=0; |
const char* hostname=classPath.getHostName_l(hostnameLength); | const char* hostname=classPath.getHostName_l(hostnameLength); |
Uint64 nsLength=0; |
Uint32 nsLength=0; |
const char* ns=classPath.getNameSpace_l(nsLength); | const char* ns=classPath.getNameSpace_l(nsLength); |
| |
appendNameSpacePathElement(out,hostname,hostnameLength-1,ns,nsLength-1); |
appendNameSpacePathElement(out,hostname,hostnameLength,ns,nsLength); |
| |
Uint64 classNameLength=0; |
Uint32 classNameLength=0; |
const char* className = classPath.getClassName_l(classNameLength); | const char* className = classPath.getClassName_l(classNameLength); |
appendClassNameElement(out, className, classNameLength-1); |
appendClassNameElement(out, className, classNameLength); |
out << STRLIT("</LOCALCLASSPATH>\n"); | out << STRLIT("</LOCALCLASSPATH>\n"); |
} | } |
| |
|
|
{ | { |
out << STRLIT("<CLASSPATH>\n"); | out << STRLIT("<CLASSPATH>\n"); |
| |
Uint64 hostnameLength=0; |
Uint32 hostnameLength=0; |
const char* hostname=classPath.getHostName_l(hostnameLength); | const char* hostname=classPath.getHostName_l(hostnameLength); |
Uint64 nsLength=0; |
Uint32 nsLength=0; |
const char* ns=classPath.getNameSpace_l(nsLength); | const char* ns=classPath.getNameSpace_l(nsLength); |
| |
appendNameSpacePathElement(out,hostname,hostnameLength,ns,nsLength); | appendNameSpacePathElement(out,hostname,hostnameLength,ns,nsLength); |
| |
Uint64 classNameLength=0; |
Uint32 classNameLength=0; |
const char* className = classPath.getClassName_l(classNameLength); | const char* className = classPath.getClassName_l(classNameLength); |
| |
appendClassNameElement(out, className, classNameLength-1); |
appendClassNameElement(out, className, classNameLength); |
out << STRLIT("</CLASSPATH>\n"); | out << STRLIT("</CLASSPATH>\n"); |
} | } |
| |
|
|
{ | { |
SCMOXmlWriter::appendSpecial( | SCMOXmlWriter::appendSpecial( |
out, | out, |
u.simple.val.c16); |
Char16(u.simple.val.c16)); |
} | } |
break; | break; |
} | } |
|
|
SCMOXmlWriter::appendSpecial( | SCMOXmlWriter::appendSpecial( |
out, | out, |
&(base[u.stringValue.start]), | &(base[u.stringValue.start]), |
u.stringValue.length-1); |
(u.stringValue.size-1)); |
} | } |
break; | break; |
} | } |
|
|
// an SCMBDateTime is a CIMDateTimeRep | // an SCMBDateTime is a CIMDateTimeRep |
// this should help us to reuse existing optimized Datetime | // this should help us to reuse existing optimized Datetime |
char buffer[26]; | char buffer[26]; |
_DateTimetoCStr(&(u.dateTimeValue), buffer); |
_DateTimetoCStr(u.dateTimeValue, buffer); |
// datetime value is formatted with a \0 at end, ignore | // datetime value is formatted with a \0 at end, ignore |
out.append(buffer,sizeof(buffer)-1); | out.append(buffer,sizeof(buffer)-1); |
break; | break; |
|
|
while (numElements--) | while (numElements--) |
{ | { |
out << STRLIT("<VALUE>"); | out << STRLIT("<VALUE>"); |
SCMOXmlWriter::append(out, arr->simple.val.bin); |
SCMOXmlWriter::appendSpecial(out, Char16(arr->simple.val.c16)); |
SCMOXmlWriter::appendSpecial(out, arr->simple.val.c16); |
|
arr++; | arr++; |
out << STRLIT("</VALUE>\n"); | out << STRLIT("</VALUE>\n"); |
} | } |
|
|
while (numElements--) | while (numElements--) |
{ | { |
out << STRLIT("<VALUE>"); | out << STRLIT("<VALUE>"); |
|
if (0!=arr->stringValue.start) |
|
{ |
SCMOXmlWriter::appendSpecial( | SCMOXmlWriter::appendSpecial( |
out, | out, |
&(base[arr->stringValue.start]), | &(base[arr->stringValue.start]), |
arr->stringValue.length-1); |
(arr->stringValue.size-1)); |
|
} |
arr++; | arr++; |
out << STRLIT("</VALUE>\n"); | out << STRLIT("</VALUE>\n"); |
} | } |
|
|
out << STRLIT("<VALUE>"); | out << STRLIT("<VALUE>"); |
// an SCMBDateTime is a CIMDateTimeRep | // an SCMBDateTime is a CIMDateTimeRep |
// this should help us to reuse existing optimized Datetime | // this should help us to reuse existing optimized Datetime |
_DateTimetoCStr(&(arr->dateTimeValue), buffer); |
_DateTimetoCStr(arr->dateTimeValue, buffer); |
// datetime value is formatted with a \0 at end, ignore | // datetime value is formatted with a \0 at end, ignore |
out.append(buffer,sizeof(buffer)-1); | out.append(buffer,sizeof(buffer)-1); |
arr++; | arr++; |
|
|
arr++; | arr++; |
} | } |
out << STRLIT("</VALUE.REFARRAY>\n"); | out << STRLIT("</VALUE.REFARRAY>\n"); |
|
break; |
} | } |
case CIMTYPE_OBJECT: | case CIMTYPE_OBJECT: |
case CIMTYPE_INSTANCE: | case CIMTYPE_INSTANCE: |