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

📄 jmpiprovidermanager.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    METHOD_VERSION   eMethodFound  = METHOD_UNKNOWN;    JNIEnv          *env           = NULL;    try {        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,            "JMPIProviderManager::handleGetInstanceRequest - Host name: $0  Name space: $1  Class name: $2",            System::getHostName(),            request->nameSpace.getString(),            request->instanceName.getClassName().getString());        DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->instanceName.getClassName().getString()<<PEGASUS_STD(endl));        // make target object path        CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(),                                                       request->nameSpace,                                                       request->instanceName.getClassName(),                                                       request->instanceName.getKeyBindings());        // resolve provider name        ProviderName name = _resolveProviderName(            request->operationContext.get(ProviderIdContainer::NAME));        // get cached or load new provider module        JMPIProvider::OpProviderHolder ph = providerManager.getProvider (name.getPhysicalName(),                                                                         name.getLogicalName());        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        JMPIProvider &pr=ph.GetProvider();        PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.getInstance: " + pr.getName());        DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: Calling provider getInstance: "<<pr.getName()<<PEGASUS_STD(endl));        JvmVector *jv = 0;        env = JMPIjvm::attachThread(&jv);        if (!env)        {            PEG_METHOD_EXIT();            throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,                                           MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED",                                                              "Could not initialize the JVM (Java Virtual Machine) runtime environment."));        }////////DDD(debugPrintMethodPointers (env, (jclass)pr.jProviderClass));        JMPIProvider::pm_service_op_lock op_lock(&pr);        jmethodID id               = NULL;        String    interfaceType;        String    interfaceVersion;        getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME),                          interfaceType,                          interfaceVersion);        if (interfaceType == "JMPI")        {           // public org.pegasus.jmpi.CIMInstance getInstance (org.pegasus.jmpi.CIMObjectPath cop,           //                                                  org.pegasus.jmpi.CIMClass      cimClass,           //                                                  boolean                        localOnly)           //        throws org.pegasus.jmpi.CIMException           id = env->GetMethodID((jclass)pr.jProviderClass,                                 "getInstance",                                 "(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;Z)Lorg/pegasus/jmpi/CIMInstance;");           if (id != NULL)           {               eMethodFound = METHOD_INSTANCEPROVIDER;               DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl));           }           if (id == NULL)           {               env->ExceptionClear();               // public org.pegasus.jmpi.CIMInstance getInstance (org.pegasus.jmpi.CIMObjectPath op,               //                                                  boolean                        localOnly,               //                                                  boolean                        includeQualifiers,               //                                                  boolean                        includeClassOrigin,               //                                                  java.lang.String[]             propertyList,               //                                                  org.pegasus.jmpi.CIMClass      cc)               //        throws org.pegasus.jmpi.CIMException               id = env->GetMethodID((jclass)pr.jProviderClass,                                     "getInstance",                                     "(Lorg/pegasus/jmpi/CIMObjectPath;ZZZ[Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)Lorg/pegasus/jmpi/CIMInstance;");               if (id != NULL)               {                   eMethodFound = METHOD_CIMINSTANCEPROVIDER;                   DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl));               }           }        }        else if (interfaceType == "JMPIExperimental")        {           /* Fix for 4238 */           // public org.pegasus.jmpi.CIMInstance getInstance (org.pegasus.jmpi.OperationContext oc           //                                                  org.pegasus.jmpi.CIMObjectPath    cop,           //                                                  org.pegasus.jmpi.CIMClass         cimClass,           //                                                  boolean                           includeQualifiers,           //                                                  boolean                           includeClassOrigin,           //                                                  String                            propertyList[])           //        throws org.pegasus.jmpi.CIMException           id = env->GetMethodID((jclass)pr.jProviderClass,                                 "getInstance",                                 "(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;ZZ[Ljava/lang/String;)Lorg/pegasus/jmpi/CIMInstance;");           if (id != NULL)           {               eMethodFound = METHOD_INSTANCEPROVIDER2;               DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl));           }           /* Fix for 4238 */        }        if (id == NULL)        {           DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: No method found!"<<PEGASUS_STD(endl));           PEG_METHOD_EXIT();           throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,                                          MessageLoaderParms ("ProviderManager.JMPI.METHOD_NOT_FOUND",                                                              "Could not find a method for the provider based on InterfaceType."));        }        JMPIjvm::checkException(env);        switch (eMethodFound)        {        case METHOD_CIMINSTANCEPROVIDER:        {            jlong   jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath);            jobject jop    = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef);            JMPIjvm::checkException(env);            CIMClass cls;            try            {               DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl));               AutoMutex lock (pr._cimomMutex);               cls = pr._cimom_handle->getClass(context,                                                request->nameSpace,                                                request->instanceName.getClassName(),                                                false,                                                true,                                                true,                                                CIMPropertyList());               DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl));            }            catch (CIMException e)            {               DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl));               throw;            }            CIMClass *pcls = new CIMClass (cls);            JMPIjvm::checkException(env);            jlong   jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls);            jobject jcimClass    = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef);            JMPIjvm::checkException(env);            jobjectArray jPropertyList = getList(jv,env,request->propertyList);            StatProviderTimeMeasurement providerTime(response);            jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider,                                                   id,                                                   jop,                                                   JMPI_LOCALONLY,                                                   JMPI_INCLUDE_QUALIFIERS,                                                   request->includeClassOrigin,                                                   jPropertyList,                                                   jcimClass);            JMPIjvm::checkException(env);            handler.processing();            if (jciRet) {               jlong        jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst);               CIMInstance *ciRet     = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef);               handler.deliver(*ciRet);            }            handler.complete();            break;        }        /* Fix for 4238 */        case METHOD_INSTANCEPROVIDER2:        {            jlong   jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext);            jobject joc    = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef);            jlong   jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath);            jobject jop    = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef);            JMPIjvm::checkException(env);            CIMClass cls;            try            {               DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl));               AutoMutex lock (pr._cimomMutex);               cls = pr._cimom_handle->getClass(context,                                                request->nameSpace,                                                request->instanceName.getClassName(),                                                false,                                                true,                                                true,                                                CIMPropertyList());               DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl));            }            catch (CIMException e)            {               DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl));               throw;            }            CIMClass *pcls = new CIMClass (cls);            JMPIjvm::checkException(env);            jlong   jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls);            jobject jcimClass    = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef);            JMPIjvm::checkException(env);            jobjectArray jPropertyList = getList(jv,env,request->propertyList);            StatProviderTimeMeasurement providerTime(response);            jobject      jciRet        = env->CallObjectMethod((jobject)pr.jProvider,                                                               id,                                                               joc,                                                               jop,                                                               jcimClass,                                                               JMPI_INCLUDE_QUALIFIERS,                                                               request->includeClassOrigin,                                                               jPropertyList);            JMPIjvm::checkException(env);            if (joc)            {               env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate);               JMPIjvm::checkException(env);            }            handler.processing();            if (jciRet) {               jlong        jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst);               CIMInstance *ciRet     = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef);               handler.deliver(*ciRet);            }            handler.complete();            break;        }        /* Fix for 4238 */        case METHOD_INSTANCEPROVIDER:        {            jlong   jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath);            jobject jop    = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef);            JMPIjvm::checkException(env);            CIMClass cls;            try            {

⌨️ 快捷键说明

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