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

📄 cmpiprovidermanager.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                    ContentLanguageList(                        LanguageParser::parseContentLanguageHeader(                            CMGetCharPtr(cldata.value.string)))));            handler.setContext(response->operationContext);        }        if (rc.rc!=CMPI_RC_OK)        {           CIMException cimException(               (CIMStatusCode)rc.rc,               rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);           if (eRes.resError)           {               for (CMPI_Error* currErr=eRes.resError;                     currErr!=NULL;                     currErr=currErr->nextError)               {                   cimException.addError(((CIMError*)currErr->hdl)->getInstance());               }           }           throw cimException;        }    }    HandlerCatch(handler);    PEG_METHOD_EXIT();    return(response);}Message * CMPIProviderManager::handleDeleteInstanceRequest(const Message * message){    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,       "CMPIProviderManager::handleDeleteInstanceRequest");    HandlerIntro(DeleteInstance,message,request,response,handler);    try {        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,            "CMPIProviderManager::handleDeleteInstanceRequest - Host name: $0  Name space: $1  Class name: $2",            System::getHostName(),            request->nameSpace.getString(),            request->instanceName.getClassName().getString());        // make target object path        CIMObjectPath objectPath(            System::getHostName(),            request->nameSpace,            request->instanceName.getClassName(),            request->instanceName.getKeyBindings());        Boolean remote=false;        CMPIProvider::OpProviderHolder ph;        // resolve provider name        ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);        ProviderName name = _resolveProviderName(pidc);        if ((remote=pidc.isRemoteNameSpace())) {           ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());        }        else {        // get cached or load new provider module           ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());        }        // convert arguments        OperationContext context;        context.insert(request->operationContext.get(IdentityContainer::NAME));        context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));        context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));        // forward request        CMPIProvider & pr=ph.GetProvider();        PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,            "Calling provider.deleteInstance: " + pr.getName());        CMPIStatus rc={CMPI_RC_OK,NULL};        CMPI_ContextOnStack eCtx(context);        CMPI_ObjectPathOnStack eRef(objectPath);        CMPI_ResultOnStack eRes(handler,&pr.broker);        CMPI_ThreadContext thr(&pr.broker,&eCtx);        CMPIFlags flgs=0;        eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);        const IdentityContainer container =           request->operationContext.get(IdentityContainer::NAME);        eCtx.ft->addEntry(&eCtx,                          CMPIPrincipal,                          (CMPIValue*)(const char*)container.getUserName().getCString(),                          CMPI_chars);        const AcceptLanguageListContainer accept_language=                       request->operationContext.get(AcceptLanguageListContainer::NAME);              const AcceptLanguageList acceptLangs = accept_language.getLanguages();        eCtx.ft->addEntry(            &eCtx,            CMPIAcceptLanguage,            (CMPIValue*)(const char*)LanguageParser::buildAcceptLanguageHeader(                acceptLangs).getCString(),            CMPI_chars);        if (remote) {           CString info=pidc.getRemoteInfo().getCString();           eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);        }        CMPIProvider::pm_service_op_lock op_lock(&pr);        AutoPThreadSecurity threadLevelSecurity(context);        if (pr.miVector.instMI==0)        {            _throw_MINotInitializedException();        }         {            StatProviderTimeMeasurement providerTime(response);            rc = pr.miVector.instMI->ft->deleteInstance(                pr.miVector.instMI,&eCtx,&eRes,&eRef);        }//      Need to save ContentLanguage value into operation context of response//      Do this before checking rc from provider to throw exception in case //      rc.msg is also localized.        CMPIStatus tmprc={CMPI_RC_OK,NULL};        CMPIData cldata = eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);        if (tmprc.rc == CMPI_RC_OK)        {            response->operationContext.set(                ContentLanguageListContainer(                    ContentLanguageList(                        LanguageParser::parseContentLanguageHeader(                            CMGetCharPtr(cldata.value.string)))));            handler.setContext(response->operationContext);        }        if (rc.rc!=CMPI_RC_OK)        {           CIMException cimException(               (CIMStatusCode)rc.rc,               rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);           if (eRes.resError)           {               for (CMPI_Error* currErr=eRes.resError;                     currErr!=NULL;                     currErr=currErr->nextError)               {                   cimException.addError(((CIMError*)currErr->hdl)->getInstance());               }           }           throw cimException;        }    }    HandlerCatch(handler);    PEG_METHOD_EXIT();    return(response);}Message * CMPIProviderManager::handleExecQueryRequest(const Message * message){    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,       "CMPIProviderManager::handleExecQueryRequest");    HandlerIntro(ExecQuery,message,request,response,handler);    try {      Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,            "CMPIProviderManager::ExecQueryRequest - Host name: $0  Name space: $1  Class name: $2",            System::getHostName(),            request->nameSpace.getString(),            request->className.getString());        // make target object path        CIMObjectPath objectPath(            System::getHostName(),            request->nameSpace,            request->className);        Boolean remote=false;        CMPIProvider::OpProviderHolder ph;        // resolve provider name        ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);        ProviderName name = _resolveProviderName(pidc);        if ((remote=pidc.isRemoteNameSpace())) {           ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());        }        else {        // get cached or load new provider module           ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());        }        // convert arguments        OperationContext context;        context.insert(request->operationContext.get(IdentityContainer::NAME));        context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME));        context.insert(request->operationContext.get(ContentLanguageListContainer::NAME));        // forward request        CMPIProvider & pr=ph.GetProvider();        PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,            "Calling provider.execQuery: " + pr.getName());        DDD(cerr<<"--- CMPIProviderManager::execQuery"<<endl);        const char **props=NULL;        CMPIStatus rc={CMPI_RC_OK,NULL};        CMPI_ContextOnStack eCtx(context);        CMPI_ObjectPathOnStack eRef(objectPath);        CMPI_ResultOnStack eRes(handler,&pr.broker);        CMPI_ThreadContext thr(&pr.broker,&eCtx);        const CString queryLan=request->queryLanguage.getCString();        const CString query=request->query.getCString();        CMPIFlags flgs=0;        eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32);        const IdentityContainer container =           request->operationContext.get(IdentityContainer::NAME);        eCtx.ft->addEntry(&eCtx,                          CMPIPrincipal,                          (CMPIValue*)(const char*)container.getUserName().getCString(),                          CMPI_chars);		eCtx.ft->addEntry(&eCtx,						  CMPIInitNameSpace,						  (CMPIValue*)(const char*)request->nameSpace.getString().getCString(),						  CMPI_chars);        const AcceptLanguageListContainer accept_language=                       request->operationContext.get(AcceptLanguageListContainer::NAME);              const AcceptLanguageList acceptLangs = accept_language.getLanguages();        eCtx.ft->addEntry(            &eCtx,            CMPIAcceptLanguage,            (CMPIValue*)(const char*)LanguageParser::buildAcceptLanguageHeader(                acceptLangs).getCString(),            CMPI_chars);        if (remote) {           CString info=pidc.getRemoteInfo().getCString();           eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",(CMPIValue*)(const char*)info,CMPI_chars);        }        CMPIProvider::pm_service_op_lock op_lock(&pr);        AutoPThreadSecurity threadLevelSecurity(context);        if (pr.miVector.instMI==0)        {            _throw_MINotInitializedException();        }        {            StatProviderTimeMeasurement providerTime(response);            rc = pr.miVector.instMI->ft->execQuery(                pr.miVector.instMI,&eCtx,&eRes,&eRef,                CHARS(queryLan),CHARS(query));        }//      Need to save ContentLanguage value into operation context of response//      Do this before checking rc from provider to throw exception in case //      rc.msg is also localized.        CMPIStatus tmprc={CMPI_RC_OK,NULL};        CMPIData cldata = eCtx.ft->getEntry (&eCtx, CMPIContentLanguage, &tmprc);        if (tmprc.rc == CMPI_RC_OK)        {            response->operationContext.set(                ContentLanguageListContainer(                    ContentLanguageList(                        LanguageParser::parseContentLanguageHeader(                            CMGetCharPtr(cldata.value.string)))));            handler.setContext(response->operationContext);        }        if (rc.rc!=CMPI_RC_OK)        {           CIMException cimException(               (CIMStatusCode)rc.rc,               rc.msg ? CMGetCharsPtr(rc.msg,NULL) : String::EMPTY);           if (eRes.resError)           {               for (CMPI_Error* currErr=eRes.resError;                     currErr!=NULL;                     currErr=currErr->nextError)               {                   cimException.addError(((CIMError*)currErr->hdl)->getInstance());               }           }           throw cimException;        }    }    HandlerCatch(handler);    PEG_METHOD_EXIT();    return(response);}Message * CMPIProviderManager::handleAssociatorsRequest(const Message * message){    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,       "CMPIProviderManager::handleAssociatorsRequest");    HandlerIntro(Associators,message,request,response,handler);    try {        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,            "CMPIProviderManager::handleAssociatorsRequest - Host name: $0  Name space: $1  Class name: $2",            System::getHostName(),            request->nameSpace.getString(),            request->objectName.getClassName().getString());        // make target object path        CIMObjectPath objectPath(            System::getHostName(),            request->nameSpace,            request->objectName.getClassName());        objectPath.setKeyBindings(request->objectName.getKeyBindings());        CIMObjectPath assocPath(            System::getHostName(),            request->nameSpace,            request->assocClass.getString());        Boolean remote=false;        CMPIProvider::OpProviderHolder ph;        // resolve provider name        ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME);        ProviderName name = _resolveProviderName(pidc);        if ((remote=pidc.isRemoteNameSpace())) {           ph = providerManager.getRemoteProvider(name.getLocation(), name.getLogicalName());        }        else {        // get cached or load new provider module           ph = providerManager.getProvider(name.getPhysicalName(), name.getLogicalName());

⌨️ 快捷键说明

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