📄 jmpiprovidermanager.cpp
字号:
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::handleGetInstancesRequest: 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); StatProviderTimeMeasurement providerTime(response); // Modified for Bugzilla# 3679 jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider, id, jop, jcimClass, JMPI_LOCALONLY); 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; } case METHOD_UNKNOWN: { DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: should not be here!"<<PEGASUS_STD(endl)); break; } } } HandlerCatch(handler); if (env) JMPIjvm::detachThread(); PEG_METHOD_EXIT(); return(response);}Message * JMPIProviderManager::handleEnumerateInstancesRequest(const Message * message) throw(){ PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleEnumerateInstanceRequest"); HandlerIntro(EnumerateInstances,message,request,response,handler); typedef enum { METHOD_UNKNOWN = 0, METHOD_CIMINSTANCEPROVIDER, METHOD_CIMINSTANCEPROVIDER2, METHOD_INSTANCEPROVIDER, METHOD_INSTANCEPROVIDER2, } METHOD_VERSION; METHOD_VERSION eMethodFound = METHOD_UNKNOWN; JNIEnv *env = NULL; try { Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, "JMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2", System::getHostName(), request->nameSpace.getString(), request->className.getString()); DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->className.getString()<<PEGASUS_STD(endl)); // make target object path CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), request->nameSpace, request->className); // 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(), String::EMPTY); // 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 JMPIProvider &pr = ph.GetProvider(); PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.enumerateInstances: " + pr.getName()); DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Calling provider enumerateInstances: "<<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.")); } 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 abstract java.util.Vector enumInstances (org.pegasus.jmpi.CIMObjectPath cop, // boolean deep, // org.pegasus.jmpi.CIMClass cimClass, // boolean localOnly) // throws org.pegasus.jmpi.CIMException id = env->GetMethodID((jclass)pr.jProviderClass, "enumInstances", "(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;Z)Ljava/util/Vector;"); if (id != NULL) { eMethodFound = METHOD_INSTANCEPROVIDER; DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); } if (id == NULL) { env->ExceptionClear(); // public org.pegasus.jmpi.CIMInstance[] enumerateInstances (org.pegasus.jmpi.CIMObjectPath cop, // boolean localOnly, // boolean includeQualifiers, // boolean includeClassOrigin, // java.lang.String[] propertyList, // org.pegasus.jmpi.CIMClass cimClass) // throws org.pegasus.jmpi.CIMException id = env->GetMethodID((jclass)pr.jProviderClass, "enumerateInstances", "(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::handleEnumerateInstancesRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); } } } else if (interfaceType == "JMPIExperimental") { /* Fix for 4189 */ // public abstract java.util.Vector enumerateInstances (org.pegasus.jmpi.OperationContext oc // org.pegasus.jmpi.CIMObjectPath cop, // org.pegasus.jmpi.CIMClass cimClass, // boolean includeQualifiers, // boolean includeClassOrigin, // java.lang.String[] propertyList) // throws org.pegasus.jmpi.CIMException id = env->GetMethodID((jclass)pr.jProviderClass, "enumerateInstances", "(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); if (id != NULL) { eMethodFound = METHOD_INSTANCEPROVIDER2; DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); } /* Fix for 4189 */ if (id == NULL) { env->ExceptionClear(); // public abstract org.pegasus.jmpi.CIMInstance[] enumerateInstances (org.pegasus.jmpi.OperationContext oc // org.pegasus.jmpi.CIMObjectPath cop, // org.pegasus.jmpi.CIMClass cimClass, // boolean includeQualifiers, // boolean includeClassOrigin, // java.lang.String[] propertyList) // throws org.pegasus.jmpi.CIMException id = env->GetMethodID((jclass)pr.jProviderClass, "enumerateInstances", "(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_CIMINSTANCEPROVIDER2; DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_CIMINSTANCEPROVIDER2."<<PEGASUS_STD(endl)); } } } if (id == NULL) { DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: 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 jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); JMPIjvm::checkException(env); CIMClass cls; try { DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); AutoMutex lock (pr._cimomMutex); cls = pr._cimom_handle->getClass(context, request->nameSpace, request->className, false, true, true, CIMPropertyList()); DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); } catch (CIMException e) { DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); throw; } CIMClass *pcls = new CIMClass (cls); JMPIjvm::checkException(env); jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); JMPIjvm::checkException(env); jobjectArray jPropertyList = getList(jv,env,request->propertyList); StatProviderTimeMeasurement providerTime(response); jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, id, jcop, JMPI_LOCALONLY, JMPI_INCLUDE_QUALIFIERS, request->includeClassOrigin, jPropertyList, jcc);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -