📄 cmpiprovidermanager.cpp
字号:
} // 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();#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION // If normalization is enabled, then the normalizer will take care of // any EmbeddedInstance / EmbeddedObject mismatches, and we don't need // to add a NormalizerContextContainer. The presence of an // ObjectNormalizer is determined by the presence of the // CachedClassDefinitionContainer if(request->operationContext.contains(CachedClassDefinitionContainer::NAME)) { request->operationContext.get(CachedClassDefinitionContainer::NAME); } else#endif // PEGASUS_ENABLE_OBJECT_NORMALIZATION { // If a mechanism is needed to correct mismatches between the // EmbeddedInstance and EmbeddedObject types, then insert // containers for the class definition and a NormalizerContext. AutoPtr<NormalizerContext> tmpNormalizerContext( new CIMOMHandleContext(*pr._cimom_handle)); CIMClass classDef(tmpNormalizerContext->getClass( request->nameSpace, request->className)); request->operationContext.insert(CachedClassDefinitionContainer(classDef)); request->operationContext.insert( NormalizerContextContainer(tmpNormalizerContext)); }#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.associators: " + pr.getName()); DDD(cerr<<"--- CMPIProviderManager::associators"<<" role: >"<<request->role<<"< aCls "<< request->assocClass<<endl); 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 aClass=request->assocClass.getString().getCString(); const CString rClass=request->resultClass.getString().getCString(); const CString rRole=request->role.getCString(); const CString resRole=request->resultRole.getCString(); CMPIPropertyList props(request->propertyList); CMPIFlags flgs=0; if (request->includeQualifiers) flgs|=CMPI_FLAG_IncludeQualifiers; if (request->includeClassOrigin) flgs|=CMPI_FLAG_IncludeClassOrigin; 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.assocMI==0) { _throw_MINotInitializedException(); } { StatProviderTimeMeasurement providerTime(response); rc = pr.miVector.assocMI->ft->associators( pr.miVector.assocMI,&eCtx,&eRes,&eRef, CHARS(aClass),CHARS(rClass),CHARS(rRole),CHARS(resRole), (const char **)props.getList()); }// 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::handleAssociatorNamesRequest(const Message * message){ PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleAssociatorNamesRequest"); HandlerIntro(AssociatorNames,message,request,response,handler); try { Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, "CMPIProviderManager::handleAssociatorNamesRequest - 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()); } // 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.associatorNames: " + pr.getName()); DDD(cerr<<"--- CMPIProviderManager::associatorNames"<<" role: >"<<request->role<<"< aCls "<< request->assocClass<<endl); 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 aClass=request->assocClass.getString().getCString(); const CString rClass=request->resultClass.getString().getCString(); const CString rRole=request->role.getCString(); const CString resRole=request->resultRole.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); 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.assocMI==0) { _throw_MINotInitializedException(); } { StatProviderTimeMeasurement providerTime(response); rc = pr.miVector.assocMI->ft->associatorNames( pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass), CHARS(rClass),CHARS(rRole),CHARS(resRole)); }// 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::handleReferencesRequest(const Message * message){ PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "CMPIProviderManager::handleReferencesRequest"); HandlerIntro(References,message,request,response,handler); try { Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, "CMPIProviderManager::handleReferencesRequest - 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 resultPath( System::getHostName(), request->nameSpace, request->resultClass.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()); } // 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();#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT#ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION // If normalization is enabled, then the normalizer will take care of // any EmbeddedInstance / EmbeddedObject mismatches, and we don't need // to add a NormalizerContextContainer. The presence of an // ObjectNormalizer is determined by the presence of the // CachedClassDefinitionContainer if(request->operationContext
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -