version 1.1.2.5, 2009/10/13 13:39:24
|
version 1.1.2.7, 2009/10/14 12:47:15
|
|
|
| |
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 |
{ | { |
|
|
} | } |
else if (value.valueType == CIMTYPE_REFERENCE) | else if (value.valueType == CIMTYPE_REFERENCE) |
{ | { |
/* TODO: Implement writing an object path as value |
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); |
|
----> same as: XmlWriter::appendValueReferenceElement(out, x, true); |
|
*/ |
|
} | } |
else | else |
{ | { |
|
|
// INSTANCENAME)> | // INSTANCENAME)> |
// | // |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
void SCMOXmlWriter::appendValueReferenceElement( | void SCMOXmlWriter::appendValueReferenceElement( |
Buffer& out, | Buffer& out, |
const SCMOInstance& ref, | const SCMOInstance& ref, |
Boolean putValueWrapper) | Boolean putValueWrapper) |
{ | { |
if (putValueWrapper) | if (putValueWrapper) |
|
{ |
out << STRLIT("<VALUE.REFERENCE>\n"); | out << STRLIT("<VALUE.REFERENCE>\n"); |
|
} |
| |
// See if it is a class or instance reference (instance references have | // See if it is a class or instance reference (instance references have |
// key-bindings; class references do not). | // key-bindings; class references do not). |
|
|
{ | { |
appendClassPathElement(out, ref); | appendClassPathElement(out, ref); |
} | } |
/* TODO: Implement |
else if (0 != ref.inst.hdr->instNameSpace.start) |
else if (!reference.getNameSpace().isNull()) |
|
{ | { |
appendLocalClassPathElement(out, reference); |
appendLocalClassPathElement(out, ref); |
} | } |
else | else |
{ | { |
appendClassNameElement(out, reference.getClassName()); |
Uint64 classNameLength=0; |
|
const char* className = ref.getClassName_l(classNameLength); |
|
appendClassNameElement(out, className, classNameLength-1); |
} | } |
*/ |
|
} | } |
else | else |
{ | { |
// instance | // instance |
if (0 != ref.inst.hdr->hostName.start) | if (0 != ref.inst.hdr->hostName.start) |
{ | { |
// appendInstancePathElement(out, reference); |
appendInstancePathElement(out, ref); |
} | } |
/* TODO: Implement |
else if (0 != ref.inst.hdr->instNameSpace.start) |
else if (!reference.getNameSpace().isNull()) |
|
{ | { |
appendLocalInstancePathElement(out, reference); |
appendLocalInstancePathElement(out, ref); |
} | } |
else | else |
{ | { |
appendInstanceNameElement(out, reference); |
appendInstanceNameElement(out, ref); |
} | } |
*/ |
|
} | } |
if (putValueWrapper) | if (putValueWrapper) |
|
{ |
out << STRLIT("</VALUE.REFERENCE>\n"); | 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); |
|
} |
|
} |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
// | // |
// appendClassPathElement() |
// appendClassElement() |
// | // |
// <!ELEMENT CLASSPATH (NAMESPACEPATH,CLASSNAME)> |
// <!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( | void SCMOXmlWriter::appendClassPathElement( |
Buffer& out, | Buffer& out, |
const SCMOInstance& classPath) | const SCMOInstance& classPath) |