version 1.5, 2011/01/07 02:17:20
|
version 1.9.2.1, 2012/05/25 13:04:22
|
|
|
{ | { |
PEG_METHOD_ENTER(TRC_DISPATCHER, | PEG_METHOD_ENTER(TRC_DISPATCHER, |
"CIMResponseData::encodeBinaryResponse"); | "CIMResponseData::encodeBinaryResponse"); |
|
|
// Need to do a complete job here by transferring all contained data | // Need to do a complete job here by transferring all contained data |
// into binary format and handing it out in the CIMBuffer | // into binary format and handing it out in the CIMBuffer |
if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY)) | if (RESP_ENC_BINARY == (_encoding & RESP_ENC_BINARY)) |
|
|
p.setNameSpace(nsName); | p.setNameSpace(nsName); |
} | } |
} | } |
|
break; |
} | } |
case RESP_INSTANCES: | case RESP_INSTANCES: |
{ | { |
|
|
for (Uint32 j = 0, n = _scmoInstances.size(); j < n; j++) | for (Uint32 j = 0, n = _scmoInstances.size(); j < n; j++) |
{ | { |
SCMOInstance & scmoInst=_scmoInstances[j]; | SCMOInstance & scmoInst=_scmoInstances[j]; |
if (0 == scmoInst.getHostName()) |
scmoInst.completeHostNameAndNamespace( |
{ |
hnChars, |
scmoInst.setHostName_l(hnChars,hnLen); |
hnLen, |
} |
nsChars, |
if (0 == scmoInst.getNameSpace()) |
nsLen); |
{ |
|
scmoInst.setNameSpace_l(nsChars,nsLen); |
|
} |
|
} | } |
break; | break; |
} | } |
|
|
{ | { |
_resolveBinary(); | _resolveBinary(); |
} | } |
|
|
if (RESP_ENC_XML == (_encoding & RESP_ENC_XML)) | if (RESP_ENC_XML == (_encoding & RESP_ENC_XML)) |
{ | { |
switch (_dataType) | switch (_dataType) |
|
|
{ | { |
if (_instances.size() > 0) | if (_instances.size() > 0) |
{ | { |
XmlWriter::appendInstanceElement(out, _instances[0]); |
XmlWriter::appendInstanceElement( |
|
out, |
|
_instances[0], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
} | } |
break; | break; |
} | } |
|
|
for (Uint32 i = 0, n = _instances.size(); i < n; i++) | for (Uint32 i = 0, n = _instances.size(); i < n; i++) |
{ | { |
XmlWriter::appendValueNamedInstanceElement( | XmlWriter::appendValueNamedInstanceElement( |
out, _instances[i]); |
out, |
|
_instances[i], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
} | } |
break; | break; |
} | } |
|
|
{ | { |
XmlWriter::appendValueObjectWithPathElement( | XmlWriter::appendValueObjectWithPathElement( |
out, | out, |
_objects[i]); |
_objects[i], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
} | } |
break; | break; |
} | } |
|
|
SCMOXmlWriter::appendInstanceNameElement( | SCMOXmlWriter::appendInstanceNameElement( |
out, | out, |
_scmoInstances[i]); | _scmoInstances[i]); |
|
|
} | } |
break; | break; |
} | } |
|
|
{ | { |
if (_scmoInstances.size() > 0) | if (_scmoInstances.size() > 0) |
{ | { |
SCMOXmlWriter::appendInstanceElement(out,_scmoInstances[0]); |
if(_propertyList.isNull()) |
|
{ |
|
Array<Uint32> emptyNodes; |
|
SCMOXmlWriter::appendInstanceElement( |
|
out, |
|
_scmoInstances[0], |
|
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, |
|
_scmoInstances[0], |
|
_propertyList); |
|
SCMOXmlWriter::appendInstanceElement( |
|
out, |
|
_scmoInstances[0], |
|
true, |
|
nodes); |
|
} |
} | } |
break; | break; |
} | } |
case RESP_INSTANCES: | case RESP_INSTANCES: |
{ | { |
for (Uint32 i = 0, n = _scmoInstances.size(); i < n; i++) |
SCMOXmlWriter::appendValueSCMOInstanceElements( |
{ |
|
SCMOXmlWriter::appendValueSCMOInstanceElement( |
|
out, | out, |
_scmoInstances[i]); |
_scmoInstances, |
} |
_propertyList); |
break; | break; |
} | } |
case RESP_OBJECTS: | case RESP_OBJECTS: |
{ | { |
for (Uint32 i = 0; i < _scmoInstances.size(); i++) |
|
{ |
|
SCMOXmlWriter::appendValueObjectWithPathElement( | SCMOXmlWriter::appendValueObjectWithPathElement( |
out, | out, |
_scmoInstances[i]); |
_scmoInstances, |
} |
_propertyList); |
break; | break; |
} | } |
case RESP_OBJECTPATHS: | case RESP_OBJECTPATHS: |
|
|
"CIMResponseData::encodeInternalXmlResponse(encoding=%X,content=%X)", | "CIMResponseData::encodeInternalXmlResponse(encoding=%X,content=%X)", |
_encoding, | _encoding, |
_dataType)); | _dataType)); |
|
|
// For mixed (CIM+SCMO) responses, we need to tell the receiver the | // For mixed (CIM+SCMO) responses, we need to tell the receiver the |
// total number of instances. The totalSize variable is used to keep track | // total number of instances. The totalSize variable is used to keep track |
// of this. | // of this. |
|
|
if (0 == _instances.size()) | if (0 == _instances.size()) |
{ | { |
_instances.append(CIMInstance()); | _instances.append(CIMInstance()); |
|
CIMInternalXmlEncoder::_putXMLInstance( |
|
out, |
|
_instances[0]); |
|
break; |
} | } |
CIMInternalXmlEncoder::_putXMLInstance(out, _instances[0]); |
CIMInternalXmlEncoder::_putXMLInstance( |
|
out, |
|
_instances[0], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
break; | break; |
} | } |
case RESP_INSTANCES: | case RESP_INSTANCES: |
|
|
{ | { |
CIMInternalXmlEncoder::_putXMLNamedInstance( | CIMInternalXmlEncoder::_putXMLNamedInstance( |
out, | out, |
_instances[i]); |
_instances[i], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
} | } |
break; | break; |
} | } |
|
|
out.putUint32(totalSize); | out.putUint32(totalSize); |
for (Uint32 i = 0; i < n; i++) | for (Uint32 i = 0; i < n; i++) |
{ | { |
CIMInternalXmlEncoder::_putXMLObject(out, _objects[i]); |
CIMInternalXmlEncoder::_putXMLObject( |
|
out, |
|
_objects[i], |
|
_includeQualifiers, |
|
_includeClassOrigin, |
|
_propertyList); |
} | } |
break; | break; |
} | } |
|
|
{ | { |
_scmoInstances.append(SCMOInstance()); | _scmoInstances.append(SCMOInstance()); |
} | } |
SCMOInternalXmlEncoder::_putXMLInstance(out, _scmoInstances[0]); |
SCMOInternalXmlEncoder::_putXMLInstance( |
|
out, |
|
_scmoInstances[0], |
|
_propertyList); |
break; | break; |
} | } |
case RESP_INSTANCES: | case RESP_INSTANCES: |
|
|
{ | { |
out.putUint32(n); | out.putUint32(n); |
} | } |
for (Uint32 i = 0; i < n; i++) |
|
{ |
|
SCMOInternalXmlEncoder::_putXMLNamedInstance( | SCMOInternalXmlEncoder::_putXMLNamedInstance( |
out, | out, |
_scmoInstances[i]); |
_scmoInstances, |
} |
_propertyList); |
break; | break; |
} | } |
case RESP_OBJECTS: | case RESP_OBJECTS: |
|
|
{ | { |
out.putUint32(n); | out.putUint32(n); |
} | } |
for (Uint32 i = 0; i < n; i++) |
|
{ |
|
SCMOInternalXmlEncoder::_putXMLObject( | SCMOInternalXmlEncoder::_putXMLObject( |
out, | out, |
_scmoInstances[i]); |
_scmoInstances, |
} |
_propertyList); |
break; | break; |
} | } |
// internal xml encoding of instance names and object paths not | // internal xml encoding of instance names and object paths not |
|
|
} | } |
} | } |
} | } |
|
|
} | } |
| |
void CIMResponseData::_resolveToCIM() | void CIMResponseData::_resolveToCIM() |
|
|
_encoding |=RESP_ENC_SCMO; | _encoding |=RESP_ENC_SCMO; |
} | } |
| |
|
void CIMResponseData::setRequestProperties( |
|
const Boolean includeQualifiers, |
|
const Boolean includeClassOrigin, |
|
const CIMPropertyList& propertyList) |
|
{ |
|
_includeQualifiers = includeQualifiers; |
|
_includeClassOrigin = includeClassOrigin; |
|
_propertyList = propertyList; |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |