version 1.24.12.1, 2008/09/19 06:30:28
|
version 1.25, 2008/05/12 09:14:54
|
|
|
#include "OperationResponseHandler.h" | #include "OperationResponseHandler.h" |
#include "CIMOMHandleContext.h" | #include "CIMOMHandleContext.h" |
| |
#include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/SharedPtr.h> | #include <Pegasus/Common/SharedPtr.h> |
#include <Pegasus/Provider/CIMOMHandle.h> | #include <Pegasus/Provider/CIMOMHandle.h> |
#include <Pegasus/Config/ConfigManager.h> |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
static void _initializeNormalizer( |
|
CIMOperationRequestMessage *request, |
|
Boolean includeQualifiers, |
|
Boolean includeClassOrigin, |
|
ObjectNormalizer &normalizer) |
|
{ |
|
// Attempt to get the cached class definition, normalization is disabled |
|
// if it does not exist. |
|
if (request->operationContext.contains( |
|
CachedClassDefinitionContainer::NAME)) |
|
{ |
|
CIMClass cimClass; |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get( |
|
CachedClassDefinitionContainer::NAME); |
|
cimClass = container.getClass(); |
|
SharedPtr<NormalizerContext> tmpContext(new CIMOMHandleContext()); |
|
ObjectNormalizer tmpNormalizer( |
|
cimClass, |
|
includeQualifiers, |
|
includeClassOrigin, |
|
request->nameSpace, |
|
tmpContext); |
|
normalizer = tmpNormalizer; |
|
} |
|
} |
|
|
|
// | // |
// OperationResponseHandler | // OperationResponseHandler |
// | // |
|
|
simple.clear(); | simple.clear(); |
} | } |
| |
String function = getClass() + "::" + "transfer"; |
PEG_TRACE(( |
Logger::put( |
TRC_PROVIDERMANAGER, |
Logger::STANDARD_LOG, |
Tracer::LEVEL4, |
System::CIMSERVER, |
"%s::transfer", |
Logger::TRACE, |
(const char*) getClass().getCString())); |
function); |
|
| |
transfer(); | transfer(); |
simple.clear(); | simple.clear(); |
|
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) | PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) |
: OperationResponseHandler(request, response, responseChunkCallback) | : OperationResponseHandler(request, response, responseChunkCallback) |
{ | { |
_initializeNormalizer( |
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
request, |
// Attempt to get the cached class definition used to validate results of |
|
// this operation. If it does not exist, then this feature is disabled |
|
// for this operation. |
|
CIMClass cimClass; |
|
|
|
if (request->operationContext.contains( |
|
CachedClassDefinitionContainer::NAME)) |
|
{ |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get( |
|
CachedClassDefinitionContainer::NAME); |
|
|
|
cimClass = container.getClass(); |
|
} |
|
|
|
SharedPtr<NormalizerContext> tmpContext(new CIMOMHandleContext()); |
|
ObjectNormalizer tmpNormalizer( |
|
cimClass, |
request->includeQualifiers, | request->includeQualifiers, |
request->includeClassOrigin, | request->includeClassOrigin, |
_normalizer); |
request->nameSpace, |
|
tmpContext); |
|
_normalizer = tmpNormalizer; |
|
#endif |
} | } |
| |
void GetInstanceResponseHandler::deliver(const CIMInstance& cimInstance) | void GetInstanceResponseHandler::deliver(const CIMInstance& cimInstance) |
|
|
throw CIMException(CIM_ERR_FAILED, message); | throw CIMException(CIM_ERR_FAILED, message); |
} | } |
| |
CIMInstance localInstance(cimInstance); |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION | #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
// The normalizer expects an object path embedded in instances even | // The normalizer expects an object path embedded in instances even |
// though it is not required by this operation. Use the requested | // though it is not required by this operation. Use the requested |
// object path is missing from the instance. | // object path is missing from the instance. |
|
CIMInstance localInstance(cimInstance); |
|
|
if (localInstance.getPath().getKeyBindings().size() == 0) | if (localInstance.getPath().getKeyBindings().size() == 0) |
{ | { |
// ATTN: should clone before modification | // ATTN: should clone before modification |
localInstance.setPath(static_cast<CIMGetInstanceRequestMessage*>( | localInstance.setPath(static_cast<CIMGetInstanceRequestMessage*>( |
getRequest())->instanceName); | getRequest())->instanceName); |
} | } |
#endif |
|
SimpleInstanceResponseHandler::deliver( | SimpleInstanceResponseHandler::deliver( |
_normalizer.processInstance(localInstance)); | _normalizer.processInstance(localInstance)); |
|
#else |
|
SimpleInstanceResponseHandler::deliver(cimInstance); |
|
#endif |
} | } |
| |
void GetInstanceResponseHandler::complete() | void GetInstanceResponseHandler::complete() |
|
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) | PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) |
: OperationResponseHandler(request, response, responseChunkCallback) | : OperationResponseHandler(request, response, responseChunkCallback) |
{ | { |
_initializeNormalizer( |
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
request, |
// Attempt to get the cached class definition used to validate results of |
|
// this operation. If it does not exist, then this feature is disabled |
|
// for this operation. |
|
CIMClass cimClass; |
|
|
|
if (request->operationContext.contains( |
|
CachedClassDefinitionContainer::NAME)) |
|
{ |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get( |
|
CachedClassDefinitionContainer::NAME); |
|
cimClass = container.getClass(); |
|
} |
|
|
|
SharedPtr<NormalizerContext> tmpContext(new CIMOMHandleContext()); |
|
ObjectNormalizer tmpNormalizer( |
|
cimClass, |
request->includeQualifiers, | request->includeQualifiers, |
request->includeClassOrigin, | request->includeClassOrigin, |
_normalizer); |
request->nameSpace, |
|
tmpContext); |
|
_normalizer = tmpNormalizer; |
|
#endif |
} | } |
| |
void EnumerateInstancesResponseHandler::deliver(const CIMInstance& cimInstance) | void EnumerateInstancesResponseHandler::deliver(const CIMInstance& cimInstance) |
|
|
throw CIMException(CIM_ERR_FAILED, message); | throw CIMException(CIM_ERR_FAILED, message); |
} | } |
| |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
SimpleInstanceResponseHandler::deliver( | SimpleInstanceResponseHandler::deliver( |
_normalizer.processInstance(cimInstance)); | _normalizer.processInstance(cimInstance)); |
|
#else |
|
SimpleInstanceResponseHandler::deliver(cimInstance); |
|
#endif |
} | } |
| |
String EnumerateInstancesResponseHandler::getClass() const | String EnumerateInstancesResponseHandler::getClass() const |
|
|
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) | PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback) |
: OperationResponseHandler(request, response, responseChunkCallback) | : OperationResponseHandler(request, response, responseChunkCallback) |
{ | { |
_initializeNormalizer( |
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
request, |
// Attempt to get the cached class definition used to validate results of |
|
// this operation. If it does not exist, then this feature is disabled |
|
// for this operation. |
|
CIMClass cimClass; |
|
|
|
if (request->operationContext.contains( |
|
CachedClassDefinitionContainer::NAME)) |
|
{ |
|
CachedClassDefinitionContainer container = |
|
request->operationContext.get( |
|
CachedClassDefinitionContainer::NAME); |
|
|
|
cimClass = container.getClass(); |
|
} |
|
|
|
SharedPtr<NormalizerContext> tmpContext(new CIMOMHandleContext()); |
|
ObjectNormalizer tmpNormalizer( |
|
cimClass, |
false, | false, |
false, | false, |
_normalizer); |
request->nameSpace, |
|
tmpContext); |
|
_normalizer = tmpNormalizer; |
|
#endif |
} | } |
| |
void EnumerateInstanceNamesResponseHandler::deliver( | void EnumerateInstanceNamesResponseHandler::deliver( |
|
|
throw CIMException(CIM_ERR_FAILED, message); | throw CIMException(CIM_ERR_FAILED, message); |
} | } |
| |
|
#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION |
SimpleObjectPathResponseHandler::deliver( | SimpleObjectPathResponseHandler::deliver( |
_normalizer.processInstanceObjectPath(cimObjectPath)); | _normalizer.processInstanceObjectPath(cimObjectPath)); |
|
#else |
|
SimpleObjectPathResponseHandler::deliver(cimObjectPath); |
|
#endif |
} | } |
| |
String EnumerateInstanceNamesResponseHandler::getClass() const | String EnumerateInstanceNamesResponseHandler::getClass() const |