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))
    {
        CachedClassDefinitionContainer container =
            request->operationContext.get(
                CachedClassDefinitionContainer::NAME);
        CIMClass cimClass = container.getClass().clone();
        container = CachedClassDefinitionContainer(cimClass);
        std::shared_ptr<NormalizerContext> tmpContext(new CIMOMHandleContext());
        ObjectNormalizer tmpNormalizer(
            cimClass,
            includeQualifiers,
            includeClassOrigin,
            request->nameSpace,
            tmpContext);
        normalizer = tmpNormalizer;
    }
}
EnumerateInstanceNamesResponseHandler::EnumerateInstanceNamesResponseHandler(
    CIMEnumerateInstanceNamesRequestMessage * request,
    CIMEnumerateInstanceNamesResponseMessage * response)
    : OperationResponseHandler(request, response)
{
    #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
    // 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;

    try
    {
        CachedClassDefinitionContainer container =
            request->operationContext.get(CachedClassDefinitionContainer::NAME);

        cimClass = container.getClass();
    }
    catch(Exception &)
    {
        // Do nothing. Container is missing, which implies normalization is disabled
        // for this operation.
    }

    _normalizer =
        ObjectNormalizer(
            cimClass,
            false,
            false);
    #endif
}