version 1.2.2.23, 2009/12/10 11:32:44
|
version 1.9.2.1, 2012/05/25 13:04:22
|
|
|
return _binaryData; | return _binaryData; |
} | } |
| |
bool CIMResponseData::setBinary(CIMBuffer& in, bool hasLen) |
bool CIMResponseData::setBinary(CIMBuffer& in) |
{ | { |
PEG_METHOD_ENTER(TRC_DISPATCHER, |
PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setBinary"); |
"CIMResponseData::setBinary"); |
|
| |
if (hasLen) |
// Append all serial data from the CIMBuffer to the local data store. |
{ |
// Returns error if input not a serialized Uint8A |
if (!in.getUint8A(_binaryData)) | if (!in.getUint8A(_binaryData)) |
{ | { |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1, | PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1, |
"Failed to get binary object path data!"); |
"Failed to get binary input data!"); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return false; | return false; |
} | } |
|
_encoding |= RESP_ENC_BINARY; |
|
PEG_METHOD_EXIT(); |
|
return true; |
} | } |
else |
|
|
bool CIMResponseData::setRemainingBinaryData(CIMBuffer& in) |
{ | { |
size_t remainingDataLength = in.capacity() - in.size(); |
PEG_METHOD_ENTER(TRC_DISPATCHER, "CIMResponseData::setRemainingBinaryData"); |
|
|
|
// Append any data that has not been deserialized already from |
|
// the CIMBuffer. |
|
size_t remainingDataLength = in.remainingDataLength(); |
_binaryData.append((Uint8*)in.getPtr(), remainingDataLength); | _binaryData.append((Uint8*)in.getPtr(), remainingDataLength); |
} |
|
_encoding |= RESP_ENC_BINARY; | _encoding |= RESP_ENC_BINARY; |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; | return true; |
|
|
{ | { |
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; |
} | } |
|
|
void CIMResponseData::encodeXmlResponse(Buffer& out) | void CIMResponseData::encodeXmlResponse(Buffer& out) |
{ | { |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, | PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
"CIMResponseData::encodeXmlResponse(encoding=%X,content=%X)\n", |
"CIMResponseData::encodeXmlResponse(encoding=%X,content=%X)", |
_encoding, | _encoding, |
_dataType)); | _dataType)); |
| |
|
|
{ | { |
_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: |
|
|
void CIMResponseData::encodeInternalXmlResponse(CIMBuffer& out) | void CIMResponseData::encodeInternalXmlResponse(CIMBuffer& out) |
{ | { |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, | PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
"CIMResponseData::encodeInternalXmlResponse(encoding=%X,content=%X)\n", |
"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() |
{ | { |
PEG_TRACE((TRC_XML, Tracer::LEVEL2, |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
"CIMResponseData::_resolveToCIM(encoding=%X,content=%X)\n", |
"CIMResponseData::_resolveToCIM(encoding=%X,content=%X)", |
_encoding, | _encoding, |
_dataType)); | _dataType)); |
| |
|
|
| |
void CIMResponseData::_resolveToSCMO() | void CIMResponseData::_resolveToSCMO() |
{ | { |
PEG_TRACE((TRC_XML, Tracer::LEVEL2, |
PEG_TRACE((TRC_XML, Tracer::LEVEL3, |
"CIMResponseData::_resolveToSCMO(encoding=%X,content=%X)\n", |
"CIMResponseData::_resolveToSCMO(encoding=%X,content=%X)", |
_encoding, | _encoding, |
_dataType)); | _dataType)); |
| |
|
|
_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 |