version 1.1.2.2, 2009/11/11 10:12:12
|
version 1.3.4.1, 2011/10/11 18:18:09
|
|
|
| |
void SCMOInternalXmlEncoder::_putXMLInstance( | void SCMOInternalXmlEncoder::_putXMLInstance( |
CIMBuffer& out, | CIMBuffer& out, |
const SCMOInstance& ci) |
const SCMOInstance& ci, |
|
const CIMPropertyList& propertyList ) |
{ | { |
| |
if (ci.isUninitialized()) | if (ci.isUninitialized()) |
|
|
Buffer buf(4096); | Buffer buf(4096); |
| |
// Serialize instance as XML. | // Serialize instance as XML. |
SCMOXmlWriter::appendInstanceElement(buf, ci); |
if (propertyList.isNull()) |
|
{ |
|
Array<Uint32> emptyNodes; |
|
SCMOXmlWriter::appendInstanceElement( |
|
buf, |
|
ci, |
|
false, |
|
emptyNodes); |
|
} |
|
else |
|
{ |
|
Array<propertyFilterNodesArray_t> propFilterNodesArrays; |
|
// This searches for an already created array of nodes, |
|
// if not found, creates it inside propFilterNodesArrays |
|
const Array<Uint32> & nodes= |
|
SCMOXmlWriter::getFilteredNodesArray( |
|
propFilterNodesArrays, |
|
ci, |
|
propertyList); |
|
SCMOXmlWriter::appendInstanceElement( |
|
buf, |
|
ci, |
|
true, |
|
nodes); |
|
} |
buf.append('\0'); | buf.append('\0'); |
| |
out.putUint32(buf.size()); | out.putUint32(buf.size()); |
|
|
out.putBytes(buf.getData(), buf.size()); | out.putBytes(buf.getData(), buf.size()); |
| |
// Write hostname and namespace in UTF-16 format | // Write hostname and namespace in UTF-16 format |
Uint64 len=0; |
Uint32 len=0; |
const char* hn = ci.getHostName_l(len); | const char* hn = ci.getHostName_l(len); |
out.putUTF8AsString(hn, len); | out.putUTF8AsString(hn, len); |
const char * ns = ci.getNameSpace_l(len); | const char * ns = ci.getNameSpace_l(len); |
|
|
| |
void SCMOInternalXmlEncoder::_putXMLNamedInstance( | void SCMOInternalXmlEncoder::_putXMLNamedInstance( |
CIMBuffer& out, | CIMBuffer& out, |
const SCMOInstance& ci) |
const Array<SCMOInstance> & ci, |
|
const CIMPropertyList& propertyList) |
{ | { |
if (ci.isUninitialized()) |
Array<propertyFilterNodesArray_t> propFilterNodesArrays; |
|
Array<Uint32> emptyNodes; |
|
for (Uint32 i = 0, n = ci.size(); i < n; i++) |
|
{ |
|
if (ci[i].isUninitialized()) |
{ | { |
out.putUint32(0); | out.putUint32(0); |
out.putUint32(0); | out.putUint32(0); |
|
|
else | else |
{ | { |
Buffer buf(4096); | Buffer buf(4096); |
|
|
// Serialize instance as XML. | // Serialize instance as XML. |
|
if (propertyList.isNull()) |
SCMOXmlWriter::appendInstanceElement(buf, ci); |
|
buf.append('\0'); |
|
|
|
out.putUint32(buf.size()); |
|
out.putBytes(buf.getData(), buf.size()); |
|
buf.clear(); |
|
|
|
if (0 == ci.getClassName()) |
|
{ | { |
out.putUint32(0); |
SCMOXmlWriter::appendInstanceElement( |
out.putString(String()); |
buf, |
out.putNamespaceName(CIMNamespaceName()); |
ci[i], |
|
false, |
|
emptyNodes); |
} | } |
else | else |
{ | { |
// Serialize object path as XML. |
// This searches for an already created array of nodes, |
SCMOXmlWriter::appendInstanceNameElement(buf, ci); |
// if not found, creates it inside propFilterNodesArrays |
|
const Array<Uint32> & nodes = |
|
SCMOXmlWriter::getFilteredNodesArray( |
|
propFilterNodesArrays, |
|
ci[i], |
|
propertyList); |
|
SCMOXmlWriter::appendInstanceElement( |
|
buf, |
|
ci[i], |
|
true, |
|
nodes); |
|
} |
buf.append('\0'); | buf.append('\0'); |
|
|
out.putUint32(buf.size()); | out.putUint32(buf.size()); |
out.putBytes(buf.getData(), buf.size()); | out.putBytes(buf.getData(), buf.size()); |
|
buf.clear(); |
| |
// Write hostname and namespace in UTF-16 format |
if (0 == ci[i].getClassName()) |
Uint64 len=0; |
|
const char* hn = ci.getHostName_l(len); |
|
out.putUTF8AsString(hn, len); |
|
const char * ns = ci.getNameSpace_l(len); |
|
out.putUTF8AsString(ns, len); |
|
} |
|
} |
|
} |
|
|
|
void SCMOInternalXmlEncoder::_putXMLInstanceName( |
|
CIMBuffer& out, |
|
const SCMOInstance& cop) |
|
{ | { |
if (0 == cop.getClassName()) |
|
{ |
|
out.putUint32(0); |
|
out.putUint32(0); | out.putUint32(0); |
out.putString(String()); | out.putString(String()); |
out.putNamespaceName(CIMNamespaceName()); | out.putNamespaceName(CIMNamespaceName()); |
} | } |
else | else |
{ | { |
Buffer buf(4096); |
|
|
|
// Serialize object path as XML. | // Serialize object path as XML. |
SCMOXmlWriter::appendValueReferenceElement(buf, cop, true); |
SCMOXmlWriter::appendInstanceNameElement(buf, ci[i]); |
buf.append('\0'); | buf.append('\0'); |
| |
out.putUint32(buf.size()); | out.putUint32(buf.size()); |
out.putBytes(buf.getData(), buf.size()); | out.putBytes(buf.getData(), buf.size()); |
| |
// Write hostname and namespace in UTF-16 format | // Write hostname and namespace in UTF-16 format |
Uint64 len=0; |
Uint32 len=0; |
const char* hn = cop.getHostName_l(len); |
const char* hn = ci[i].getHostName_l(len); |
out.putUTF8AsString(hn, len); | out.putUTF8AsString(hn, len); |
const char * ns = cop.getNameSpace_l(len); |
const char * ns = ci[i].getNameSpace_l(len); |
out.putUTF8AsString(ns, len); | out.putUTF8AsString(ns, len); |
} | } |
} | } |
|
} |
|
} |
| |
void SCMOInternalXmlEncoder::_putXMLObject( | void SCMOInternalXmlEncoder::_putXMLObject( |
CIMBuffer& out, | CIMBuffer& out, |
const SCMOInstance& co) |
const Array<SCMOInstance> & co, |
|
const CIMPropertyList& propertyList) |
{ | { |
if (co.isUninitialized()) |
Array<propertyFilterNodesArray_t> propFilterNodesArrays; |
|
Array<Uint32> emptyNodes; |
|
for (Uint32 i = 0, n = co.size(); i < n; i++) |
|
{ |
|
if (co[i].isUninitialized()) |
{ | { |
out.putUint32(0); | out.putUint32(0); |
out.putUint32(0); | out.putUint32(0); |
|
|
Buffer buf(4096); | Buffer buf(4096); |
| |
// Serialize instance as XML. | // Serialize instance as XML. |
|
if (propertyList.isNull()) |
|
{ |
|
SCMOXmlWriter::appendObjectElement( |
|
buf, |
|
co[i], |
|
false, |
|
emptyNodes); |
|
} |
|
else |
|
{ |
|
// This searches for an already created array of nodes, |
|
// if not found, creates it inside propFilterNodesArrays |
|
const Array<Uint32> & nodes = |
|
SCMOXmlWriter::getFilteredNodesArray( |
|
propFilterNodesArrays, |
|
co[i], |
|
propertyList); |
|
SCMOXmlWriter::appendObjectElement( |
|
buf, |
|
co[i], |
|
true, |
|
nodes); |
|
} |
| |
SCMOXmlWriter::appendObjectElement(buf, co); |
|
buf.append('\0'); | buf.append('\0'); |
|
|
out.putUint32(buf.size()); | out.putUint32(buf.size()); |
out.putBytes(buf.getData(), buf.size()); | out.putBytes(buf.getData(), buf.size()); |
buf.clear(); | buf.clear(); |
| |
if (0 == co.getClassName()) |
if (0 == co[i].getClassName()) |
{ | { |
out.putUint32(0); | out.putUint32(0); |
out.putString(String()); | out.putString(String()); |
|
|
else | else |
{ | { |
// Serialize object path as XML. | // Serialize object path as XML. |
SCMOXmlWriter::appendValueReferenceElement(buf, co, true); |
_appendValueReferenceElement(buf, co[i]); |
buf.append('\0'); | buf.append('\0'); |
| |
out.putUint32(buf.size()); | out.putUint32(buf.size()); |
out.putBytes(buf.getData(), buf.size()); | out.putBytes(buf.getData(), buf.size()); |
| |
// Write hostname and namespace in UTF-16 format | // Write hostname and namespace in UTF-16 format |
Uint64 len=0; |
Uint32 len=0; |
const char* hn = co.getHostName_l(len); |
const char* hn = co[i].getHostName_l(len); |
out.putUTF8AsString(hn, len); | out.putUTF8AsString(hn, len); |
const char * ns = co.getNameSpace_l(len); |
const char * ns = co[i].getNameSpace_l(len); |
out.putUTF8AsString(ns, len); | out.putUTF8AsString(ns, len); |
} | } |
} | } |
} | } |
|
} |
|
|
|
void SCMOInternalXmlEncoder::_appendValueReferenceElement( |
|
Buffer& out, |
|
const SCMOInstance& ref) |
|
{ |
|
out << STRLIT("<VALUE.REFERENCE>\n"); |
|
|
|
SCMOXmlWriter::appendInstanceNameElement(out, ref); |
|
|
|
out << STRLIT("</VALUE.REFERENCE>\n"); |
|
} |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |