⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 internalcimomhandlerep.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    try    {        response.reset(dynamic_cast<CIMAssociatorNamesResponseMessage*>(            do_request(request)));        if (response.get() == 0)        {            PEG_TRACE_STRING(                TRC_CIMOM_HANDLE,                Tracer::LEVEL2,                "Incorrect response type in CIMOMHandle");            throw CIMException(CIM_ERR_FAILED);        }    }    catch (CIMException &)    {        PEG_METHOD_EXIT();        throw;    }    catch (...)    {        PEG_TRACE_STRING(            TRC_CIMOM_HANDLE,            Tracer::LEVEL2,            "Exception caught in CIMOMHandle");        PEG_METHOD_EXIT();        throw CIMException(            CIM_ERR_FAILED,            MessageLoaderParms(                "Provider.CIMOMHandle.CAUGHT_EXCEPTION",                "Exception caught in CIMOMHandle"));    }    Array<CIMObjectPath> cimObjectPaths = response->objectNames;    PEG_METHOD_EXIT();    return cimObjectPaths;}Array<CIMObject> InternalCIMOMHandleRep::references(    const OperationContext & context,    const CIMNamespaceName &nameSpace,    const CIMObjectPath& objectName,    const CIMName& resultClass,    const String& role,    Boolean includeQualifiers,    Boolean includeClassOrigin,    const CIMPropertyList& propertyList){    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE, "InternalCIMOMHandleRep::references");#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        Array<CIMObject> cimObjects =            _chOS400.references(                context,                nameSpace,                objectName,                resultClass,                role,                includeQualifiers,                includeClassOrigin,                propertyList);        PEG_METHOD_EXIT();        return cimObjects;    }#endif    CIMReferencesRequestMessage* request =        new CIMReferencesRequestMessage(            XmlWriter::getNextMessageId(),            nameSpace,            objectName,            resultClass,            role,            includeQualifiers,            includeClassOrigin,            propertyList,            QueueIdStack());    // copy and adjust, as needed, the operation context    request->operationContext = _filterOperationContext(context);    AutoPtr<CIMReferencesResponseMessage> response;    try    {        response.reset(dynamic_cast<CIMReferencesResponseMessage*>(            do_request(request)));        if (response.get() == 0)        {            PEG_TRACE_STRING(                TRC_CIMOM_HANDLE,                Tracer::LEVEL2,                "Incorrect response type in CIMOMHandle");            throw CIMException(CIM_ERR_FAILED);        }    }    catch (CIMException &)    {        PEG_METHOD_EXIT();        throw;    }    catch (...)    {        PEG_TRACE_STRING(            TRC_CIMOM_HANDLE,            Tracer::LEVEL2,            "Exception caught in CIMOMHandle");        PEG_METHOD_EXIT();        throw CIMException(            CIM_ERR_FAILED,            MessageLoaderParms(                "Provider.CIMOMHandle.CAUGHT_EXCEPTION",                "Exception caught in CIMOMHandle"));    }    Array<CIMObject> cimObjects = response->cimObjects;    PEG_METHOD_EXIT();    return cimObjects;}Array<CIMObjectPath> InternalCIMOMHandleRep::referenceNames(    const OperationContext & context,    const CIMNamespaceName &nameSpace,    const CIMObjectPath& objectName,    const CIMName& resultClass,    const String& role){    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE,        "InternalCIMOMHandleRep::referenceNames");#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        Array<CIMObjectPath> cimObjectPaths =            _chOS400.referenceNames(                context,                nameSpace,                objectName,                resultClass,                role);        PEG_METHOD_EXIT();        return cimObjectPaths;    }#endif    CIMReferenceNamesRequestMessage* request =        new CIMReferenceNamesRequestMessage(            XmlWriter::getNextMessageId(),            nameSpace,            objectName,            resultClass,            role,            QueueIdStack());    // copy and adjust, as needed, the operation context    request->operationContext = _filterOperationContext(context);    AutoPtr<CIMReferenceNamesResponseMessage> response;    try    {        response.reset(dynamic_cast<CIMReferenceNamesResponseMessage*>(            do_request(request)));        if (response.get() == 0)        {            PEG_TRACE_STRING(                TRC_CIMOM_HANDLE,                Tracer::LEVEL2,                "Incorrect response type in CIMOMHandle");            throw CIMException(CIM_ERR_FAILED);        }    }    catch (CIMException &)    {        PEG_METHOD_EXIT();        throw;    }    catch (...)    {        PEG_TRACE_STRING(            TRC_CIMOM_HANDLE,            Tracer::LEVEL2,            "Exception caught in CIMOMHandle");        PEG_METHOD_EXIT();        throw CIMException(            CIM_ERR_FAILED,            MessageLoaderParms(                "Provider.CIMOMHandle.CAUGHT_EXCEPTION",                "Exception caught in CIMOMHandle"));    }    Array<CIMObjectPath> cimObjectPaths = response->objectNames;    PEG_METHOD_EXIT();    return cimObjectPaths;}CIMValue InternalCIMOMHandleRep::getProperty(    const OperationContext & context,    const CIMNamespaceName &nameSpace,    const CIMObjectPath& instanceName,    const CIMName& propertyName){    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE, "InternalCIMOMHandleRep::getProperty");#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        CIMValue cimValue =            _chOS400.getProperty(                context,                nameSpace,                instanceName,                propertyName);        PEG_METHOD_EXIT();        return cimValue;    }#endif    CIMGetPropertyRequestMessage* request =        new CIMGetPropertyRequestMessage(            XmlWriter::getNextMessageId(),            nameSpace,            instanceName,            propertyName,            QueueIdStack());    // copy and adjust, as needed, the operation context    request->operationContext = _filterOperationContext(context);    AutoPtr<CIMGetPropertyResponseMessage> response;    try    {        response.reset(dynamic_cast<CIMGetPropertyResponseMessage*>(            do_request(request)));        if (response.get() == 0)        {            PEG_TRACE_STRING(                TRC_CIMOM_HANDLE,                Tracer::LEVEL2,                "Incorrect response type in CIMOMHandle");            throw CIMException(CIM_ERR_FAILED);        }    }    catch (CIMException &)    {        PEG_METHOD_EXIT();        throw;    }    catch (...)    {        PEG_TRACE_STRING(            TRC_CIMOM_HANDLE,            Tracer::LEVEL2,            "Exception caught in CIMOMHandle");        PEG_METHOD_EXIT();        throw CIMException(            CIM_ERR_FAILED,            MessageLoaderParms(                "Provider.CIMOMHandle.CAUGHT_EXCEPTION",                "Exception caught in CIMOMHandle"));    }    CIMValue cimValue = response->value;    PEG_METHOD_EXIT();    return cimValue;}void InternalCIMOMHandleRep::setProperty(    const OperationContext & context,    const CIMNamespaceName &nameSpace,    const CIMObjectPath& instanceName,    const CIMName& propertyName,    const CIMValue& newValue){    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE, "InternalCIMOMHandleRep::setProperty");#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        _chOS400.setProperty(            context,            nameSpace,            instanceName,            propertyName,            newValue);        PEG_METHOD_EXIT();        return;    }#endif    CIMSetPropertyRequestMessage* request =        new CIMSetPropertyRequestMessage(            XmlWriter::getNextMessageId(),            nameSpace,            instanceName,            propertyName,            newValue,            QueueIdStack());    // copy and adjust, as needed, the operation context    request->operationContext = _filterOperationContext(context);    AutoPtr<CIMSetPropertyResponseMessage> response;    try    {        response.reset(dynamic_cast<CIMSetPropertyResponseMessage*>(            do_request(request)));        if (response.get() == 0)        {            PEG_TRACE_STRING(                TRC_CIMOM_HANDLE,                Tracer::LEVEL2,                "Incorrect response type in CIMOMHandle");            throw CIMException(CIM_ERR_FAILED);        }    }    catch (CIMException &)    {        PEG_METHOD_EXIT();        throw;    }    catch (...)    {        PEG_TRACE_STRING(            TRC_CIMOM_HANDLE,            Tracer::LEVEL2,            "Exception caught in CIMOMHandle");        PEG_METHOD_EXIT();        throw CIMException(            CIM_ERR_FAILED,            MessageLoaderParms(                "Provider.CIMOMHandle.CAUGHT_EXCEPTION",                "Exception caught in CIMOMHandle"));    }    PEG_METHOD_EXIT();    return;}CIMValue InternalCIMOMHandleRep::invokeMethod(    const OperationContext & context,    const CIMNamespaceName &nameSpace,    const CIMObjectPath& instanceName,    const CIMName& methodName,    const Array<CIMParamValue>& inParameters,    Array<CIMParamValue>& outParameters){    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE, "InternalCIMOMHandleRep::invokeMethod");#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        CIMValue cimValue =            _chOS400.invokeMethod(                context,                nameSpace,                instanceName,                methodName,                inParameters,                outParameters);        PEG_METHOD_EXIT();        return cimValue;    }#endif    CIMInvokeMethodRequestMessage* request =        new CIMInvokeMethodRequestMessage(            XmlWriter::getNextMessageId(),            nameSpace,            instanceName,            methodName,            inParameters,            QueueIdStack());    // copy and adjust, as needed, the operation context    request->operationContext = _filterOperationContext(context);    AutoPtr<CIMInvokeMethodResponseMessage> response;    try    {        response.reset(dynamic_cast<CIMInvokeMethodResponseMessage*>(            do_request(request)));        if (response.get() == 0)        {            PEG_TRACE_STRING(                TRC_CIMOM_HANDLE,                Tracer::LEVEL2,                "Incorrect response type in CIMOMHandle");            throw CIMException(CIM_ERR_FAILED);        }    }    catch (CIMException &)    {        PEG_METHOD_EXIT();        throw;    }    catch (...)    {        PEG_TRACE_STRING(            TRC_CIMOM_HANDLE,            Tracer::LEVEL2,            "Exception caught in CIMOMHandle");        PEG_METHOD_EXIT();        throw CIMException(            CIM_ERR_FAILED,            MessageLoaderParms(                "Provider.CIMOMHandle.CAUGHT_EXCEPTION",                "Exception caught in CIMOMHandle"));    }    CIMValue cimValue = response->retValue;    outParameters = response->outParameters;    PEG_METHOD_EXIT();    return cimValue;}//// Public CIMOMHandle Methods//void InternalCIMOMHandleRep::disallowProviderUnload(){#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        _chOS400.disallowProviderUnload();        return;    }#endif    CIMOMHandleRep::disallowProviderUnload();}void InternalCIMOMHandleRep::allowProviderUnload(){#ifdef PEGASUS_OS_OS400    // If this is running in user-state, then run the request    // through the user-state layer    if (_chOS400.hasKey())    {        _chOS400.allowProviderUnload();        return;    }#endif    CIMOMHandleRep::allowProviderUnload();}#ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACESOperationContext InternalCIMOMHandleRep::getResponseContext(){    OperationContext ctx;    Thread* curThrd = Thread::getCurrent();    if (curThrd == NULL)    {        ctx.insert(ContentLanguageListContainer(ContentLanguageList()));    }    else    {        ContentLanguageList* contentLangs = (ContentLanguageList*)            curThrd->reference_tsd("cimomHandleContentLanguages");        curThrd->dereference_tsd();        if (contentLangs == NULL)        {            ctx.insert(ContentLanguageListContainer(ContentLanguageList()));        }        else        {            ctx.insert(ContentLanguageListContainer(*contentLangs));            // delete the old tsd to free the memory            curThrd->delete_tsd("cimomHandleContentLanguages");        }    }    return ctx;}#endifPEGASUS_NAMESPACE_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -