version 1.19, 2005/02/14 12:11:30
|
version 1.59.4.1, 2007/04/04 11:04:51
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Adrian Schuur, schuur@de.ibm.com |
|
// |
|
// Modified By: Seema Gupta (gseema@in.ibm.com) for PEP135 |
|
// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for PEP#101 |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "JMPIProviderManager.h" | #include "JMPIProviderManager.h" |
|
|
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
|
#include <Pegasus/Common/FileSystem.h> |
|
#include <Pegasus/Common/ArrayInternal.h> |
| |
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
| |
#include <Pegasus/ProviderManager2/ProviderName.h> | #include <Pegasus/ProviderManager2/ProviderName.h> |
#include <Pegasus/ProviderManager2/JMPI/JMPIProvider.h> | #include <Pegasus/ProviderManager2/JMPI/JMPIProvider.h> |
#include <Pegasus/ProviderManager2/ProviderManagerService.h> |
#include <Pegasus/ProviderManager2/JMPI/JMPIProviderModule.h> |
|
|
#include <Pegasus/ProviderManager2/CMPI/CMPI_SelectExp.h> |
|
|
|
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
int _jmpi_trace=0; |
int JMPIProviderManager::trace=0; |
|
|
|
#ifdef PEGASUS_DEBUG |
|
#define DDD(x) if (JMPIProviderManager::trace) x; |
|
#else |
|
#define DDD(x) |
|
#endif |
|
|
|
// request->localOnly is replaced with JMPI_LOCALONLY for getInstance () and enumerateInstances () |
|
#define JMPI_LOCALONLY false |
|
|
|
/* Fix for 4092 */ |
|
// request->includeQualifiers is replaced with JMPI_INCLUDE_QUALIFIERS for getInstance (), |
|
// setInstance (), enumerateInstances (), associators (), and references () |
|
#define JMPI_INCLUDE_QUALIFIERS false |
|
|
|
#include "Convert.h" |
|
|
|
void JMPIProviderManager::debugPrintMethodPointers (JNIEnv *env, jclass jc) |
|
{ |
|
// cd ${PEGAUSE_HOME}/src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests/JMPI_TestPropertyTypes |
|
// javap -s -p JMPI_TestPropertyTypes |
|
static const char *methodNames[][3] = { |
|
// CIMProvider |
|
// cimom-2003-11-24/org/snia/wbem/provider/CIMProvider.java |
|
// src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/CIMProvider.java |
|
{"snia 2.0","initialize","(Lorg/pegasus/jmpi/CIMOMHandle;)V"}, |
|
{"snia 2.0","cleanup","()V"}, |
|
// InstanceProvider |
|
// cimom-2003-11-24/org/snia/wbem/provider/InstanceProvider.java |
|
// src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/CIMInstanceProvider.java |
|
{"snia 2.0","enumInstances","(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;Z)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","enumInstances","(Lorg/pegasus/jmpi/CIMObjectPath;ZZZ[Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)[Lorg/pegasus/jmpi/CIMInstance;"}, |
|
/* Begin Fix for 4189 */ |
|
{"pegasus 2.5","enumerateInstances","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;ZZ[Ljava/lang/String;)Ljava/util/Vector;"}, |
|
/* End Fix for 4189 */ |
|
{"snia 2.0","enumInstances","(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","enumerateInstanceNames","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;)[Lorg/pegasus/jmpi/CIMObjectPath;"}, |
|
{"pegasus 2.5","enumerateInstanceNames","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"}, |
|
{"snia 2.0","getInstance","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;Z)Lorg/pegasus/jmpi/CIMInstance;"}, |
|
{"pegasus 2.4","getInstance","(Lorg/pegasus/jmpi/CIMObjectPath;ZZZ[Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)Lorg/pegasus/jmpi/CIMInstance;"}, |
|
/* Begin Fix for 4238 */ |
|
{"pegasus 2.5","getInstance","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;ZZ[Ljava/lang/String;)Lorg/pegasus/jmpi/CIMInstance;"}, |
|
/* End Fix for 4238 */ |
|
{"snia 2.0","createInstance","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)Lorg/pegasus/jmpi/CIMObjectPath;"}, |
|
{"snia 2.0","setInstance","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)V"}, |
|
{"pegasus 2.4","setInstance","(Lorg/pegasus/jmpi/CIMObjectPath;Z[Ljava/lang/String)V"}, |
|
{"snia 2.0","deleteInstance","(Lorg/pegasus/jmpi/CIMObjectPath;)V"}, |
|
{"snia 2.0","execQuery","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ILorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","execQuery","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)[Lorg/pegasus/jmpi/CIMInstance;"}, |
|
{"pegasus 2.5","execQuery","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;"}, |
|
// MethodProvider |
|
// cimom-2003-11-24/org/snia/wbem/provider/MethodProvider.java |
|
// src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/CIMMethodProvider.java |
|
{"snia 2.0","invokeMethod","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/util/Vector;Ljava/util/Vector;)Lorg/pegasus/jmpi/CIMValue;"}, |
|
{"pegasus 2.4","invokeMethod","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;[Lorg/pegasus/jmpi/CIMArgument;[Lorg/pegasus/jmpi/CIMArgument;)Lorg/pegasus/jmpi/CIMValue;"}, |
|
// PropertyProvider |
|
// cimom-2003-11-24/org/snia/wbem/provider/PropertyProvider.java |
|
// src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/PropertyProvider.java |
|
{"snia 2.0","getPropertyValue","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;)Lorg/pegasus/jmpi/CIMValue;"}, |
|
{"snia 2.0","setPropertyValue","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Lorg/pegasus/jmpi/CIMValue;)V"}, |
|
// AssociatorProvider |
|
// cimom-2003-11-24/org/snia/wbem/provider20/AssociatorProvider.java |
|
// src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/AssociatorProvider.java |
|
{"snia 2.0","associators","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","associators","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"snia 2.0","associatorNames","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","associatorNames","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"snia 2.0","references","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","references","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"snia 2.0","referenceNames","(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)Ljava/util/Vector;"}, |
|
{"pegasus 2.4","referenceNames","(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)Ljava/util/Vector;"}, |
|
// CIMProviderRouter |
|
// cimom-2003-11-24/org/snia/wbem/provider20/CIMProviderRouter.java |
|
// EventProvider |
|
// cimom-2003-11-24/org/snia/wbem/provider20/EventProvider.java |
|
// src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/EventProvider.java |
|
{"snia 2.0","activateFilter","(Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;Lorg/pegasus/jmpi/CIMObjectPath;Z)V"}, |
|
{"snia 2.0","deActivateFilter","(Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;Lorg/pegasus/jmpi/CIMObjectPath;Z)V"}, |
|
// IndicationHandler |
|
// cimom-2003-11-24/org/snia/wbem/provider20/IndicationHandler.java |
|
// ProviderAdapter |
|
// cimom-2003-11-24/org/snia/wbem/provider20/ProviderAdapter.java |
|
// JMPI_TestPropertyTypes |
|
{"JMPI_TestPropertyTypes","findObjectPath","(Lorg/pegasus/jmpi/CIMObjectPath;)I"}, |
|
{"JMPI_TestPropertyTypes","testPropertyTypesValue","(Lorg/pegasus/jmpi/CIMInstance;)V"} |
|
}; |
|
|
|
if (!env) |
|
{ |
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::debugPrintMethodPointers: env is NULL!"<<PEGASUS_STD(endl)); |
|
return; |
|
} |
|
if (!jc) |
|
{ |
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::debugPrintMethodPointers: jc is NULL!"<<PEGASUS_STD(endl)); |
|
return; |
|
} |
|
|
|
for (int i = 0; i < (int)(sizeof (methodNames)/sizeof (methodNames[0])); i++) |
|
{ |
|
jmethodID id = env->GetMethodID(jc,methodNames[i][1], methodNames[i][2]); |
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::debugPrintMethodPointers: "<<methodNames[i][0]<<", "<<methodNames[i][1]<<", id = "<<PEGASUS_STD(hex)<<(long)id<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
|
env->ExceptionClear(); |
|
} |
|
|
|
env->ExceptionClear(); |
|
} |
|
|
|
void |
|
debugIntrospectJavaObject (JNIEnv *env, jobject jInst) |
|
{ |
|
jclass jInstClass = env->GetObjectClass(jInst); |
|
jclass jInstSuperClass = env->GetSuperclass(jInstClass); |
|
jmethodID jmidGetDeclaredMethods = env->GetMethodID(jInstClass, "getDeclaredMethods", "()[Ljava/lang/reflect/Method;"); |
|
|
|
if (!jmidGetDeclaredMethods) |
|
{ |
|
env->ExceptionClear(); |
|
jmidGetDeclaredMethods = env->GetMethodID(jInstSuperClass, "getDeclaredMethods", "()[Ljava/lang/reflect/Method;"); |
|
} |
|
|
|
if (jmidGetDeclaredMethods) |
|
{ |
|
jobjectArray jarrayDeclaredMethods = (jobjectArray)env->CallObjectMethod(jInstClass, |
|
jmidGetDeclaredMethods); |
|
|
|
if (jarrayDeclaredMethods) |
|
{ |
|
for (int i = 0, iLen = env->GetArrayLength (jarrayDeclaredMethods); i < iLen; i++) |
|
{ |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jDeclaredMethod = env->GetObjectArrayElement (jarrayDeclaredMethods, i); |
|
jclass jDeclaredMethodClass = env->GetObjectClass (jDeclaredMethod); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jmethodID jmidToString = env->GetMethodID (jDeclaredMethodClass, "toString", "()Ljava/lang/String;"); |
|
jstring jstringResult = (jstring)env->CallObjectMethod (jDeclaredMethod, jmidToString); |
|
const char *pszResult = env->GetStringUTFChars(jstringResult, 0); |
|
|
|
PEGASUS_STD(cout)<<"--- JMPIProviderManager::debugIntrospectJavaObject: "<<pszResult<<PEGASUS_STD(endl); |
|
|
|
env->ReleaseStringUTFChars (jstringResult, pszResult); |
|
} |
|
} |
|
} |
|
|
|
|
|
env->ExceptionClear(); |
|
} |
|
|
|
void |
|
debugDumpJavaObject (JNIEnv *env, jobject jInst) |
|
{ |
|
jclass jInstClass = env->GetObjectClass(jInst); |
|
jclass jInstSuperClass = env->GetSuperclass(jInstClass); |
|
jmethodID jmidToString1 = env->GetMethodID(jInstClass, "toString", "()Ljava/lang/String;"); |
|
jmethodID jmidToString2 = env->GetMethodID(jInstSuperClass, "toString", "()Ljava/lang/String;"); |
|
if (!jmidToString1 || !jmidToString2) |
|
{ |
|
env->ExceptionClear(); |
|
return; |
|
} |
|
jstring jstringResult1 = (jstring)env->CallObjectMethod(jInstClass, jmidToString1); |
|
jstring jstringResult2 = (jstring)env->CallObjectMethod(jInstSuperClass, jmidToString2); |
|
jstring jstringResult3 = (jstring)env->CallObjectMethod(jInst, jmidToString1); |
|
const char *pszResult1 = env->GetStringUTFChars(jstringResult1, 0); |
|
const char *pszResult2 = env->GetStringUTFChars(jstringResult2, 0); |
|
const char *pszResult3 = env->GetStringUTFChars(jstringResult3, 0); |
|
|
|
jmethodID jmidCInst = env->GetMethodID(env->GetObjectClass(jInst),JMPIjvm::jv.instanceMethodNames[22].methodName, JMPIjvm::jv.instanceMethodNames[22].signature); |
|
|
|
PEGASUS_STD(cout)<<"--- JMPIProviderManager::debugIntrospectJavaObject: jInstClass = "<<jInstClass<<", jInstSuperClass = "<<jInstSuperClass<<", jClassShouldBe = "<<JMPIjvm::jv.classRefs[18]<<", jmidCInst = "<<jmidCInst<<PEGASUS_STD(endl); |
|
PEGASUS_STD(cout)<<"pszResult1 = "<<pszResult1<<PEGASUS_STD(endl); |
|
PEGASUS_STD(cout)<<"pszResult2 = "<<pszResult2<<PEGASUS_STD(endl); |
|
PEGASUS_STD(cout)<<"pszResult3 = "<<pszResult3<<PEGASUS_STD(endl); |
|
|
|
env->ReleaseStringUTFChars (jstringResult1, pszResult1); |
|
env->ReleaseStringUTFChars (jstringResult2, pszResult2); |
|
env->ReleaseStringUTFChars (jstringResult3, pszResult3); |
|
|
|
env->ExceptionClear(); |
|
} |
|
|
|
bool JMPIProviderManager::getInterfaceType (ProviderIdContainer pidc, |
|
String& interfaceType, |
|
String& interfaceVersion) |
|
{ |
|
///CIMInstance ciProvider = pidc.getProvider (); |
|
CIMInstance ciProviderModule = pidc.getModule (); |
|
Uint32 idx; |
|
bool fRet = true; |
|
|
|
///PEGASUS_STD(cout)<<"--- JMPIProviderManager::getInterfaceType: ciProvider = "<<ciProvider.getPath ().toString ()<<PEGASUS_STD(endl); |
|
///PEGASUS_STD(cout)<<"--- JMPIProviderManager::getInterfaceType: ciProviderModule = "<<ciProviderModule.getPath ().toString ()<<PEGASUS_STD(endl); |
|
|
|
idx = ciProviderModule.findProperty ("InterfaceType"); |
|
|
|
if (idx != PEG_NOT_FOUND) |
|
{ |
|
CIMValue itValue; |
|
|
|
itValue = ciProviderModule.getProperty (idx).getValue (); |
| |
#define DDD(x) if (_jmpi_trace) x; |
itValue.get (interfaceType); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::getInterfaceType: interfaceType = "<<interfaceType<<PEGASUS_STD(endl)); |
|
} |
|
else |
|
{ |
|
fRet = false; |
|
} |
|
|
|
idx = ciProviderModule.findProperty ("InterfaceVersion"); |
|
|
|
if (idx != PEG_NOT_FOUND) |
|
{ |
|
CIMValue itValue; |
|
|
|
itValue = ciProviderModule.getProperty (idx).getValue (); |
|
|
|
itValue.get (interfaceVersion); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::getInterfaceType: interfaceVersion = "<<interfaceVersion<<PEGASUS_STD(endl)); |
|
} |
|
else |
|
{ |
|
fRet = false; |
|
} |
|
|
|
return fRet; |
|
} |
|
|
|
bool JMPIProviderManager::interfaceIsUsed (JNIEnv *env, |
|
jobject jObject, |
|
String searchInterfaceName) |
|
{ |
|
jobjectArray jInterfaces = 0; |
|
jsize jInterfacesLength = 0; |
|
bool fFound = false; |
|
|
|
if (!jObject) |
|
{ |
|
return false; |
|
} |
|
|
|
jInterfaces = (jobjectArray)env->CallObjectMethod (env->GetObjectClass (jObject), |
|
JMPIjvm::jv.ClassGetInterfaces); |
|
|
|
if (!jInterfaces) |
|
{ |
|
return false; |
|
} |
|
|
|
jInterfacesLength = env->GetArrayLength (jInterfaces); |
|
|
|
for (jsize i = 0; !fFound && i < jInterfacesLength; i++) |
|
{ |
|
jobject jInterface = env->GetObjectArrayElement (jInterfaces, i); |
|
|
|
if (jInterface) |
|
{ |
|
jstring jInterfaceName = (jstring)env->CallObjectMethod (jInterface, |
|
JMPIjvm::jv.ClassGetName); |
|
|
|
if (jInterfaceName) |
|
{ |
|
const char *pszInterfaceName = env->GetStringUTFChars (jInterfaceName, |
|
0); |
|
String interfaceName = pszInterfaceName; |
|
|
|
if (String::equal (interfaceName, searchInterfaceName)) |
|
{ |
|
fFound = true; |
|
} |
|
|
|
env->ReleaseStringUTFChars (jInterfaceName, pszInterfaceName); |
|
} |
|
} |
|
} |
|
|
|
return fFound; |
|
} |
| |
JMPIProviderManager::IndProvTab JMPIProviderManager::provTab; | JMPIProviderManager::IndProvTab JMPIProviderManager::provTab; |
|
Mutex JMPIProviderManager::mutexProvTab; |
JMPIProviderManager::IndSelectTab JMPIProviderManager::selxTab; | JMPIProviderManager::IndSelectTab JMPIProviderManager::selxTab; |
|
Mutex JMPIProviderManager::mutexSelxTab; |
JMPIProviderManager::ProvRegistrar JMPIProviderManager::provReg; | JMPIProviderManager::ProvRegistrar JMPIProviderManager::provReg; |
|
Mutex JMPIProviderManager::mutexProvReg; |
| |
JMPIProviderManager::JMPIProviderManager(Mode m) |
JMPIProviderManager::JMPIProviderManager() |
{ | { |
mode=m; |
_subscriptionInitComplete = false; |
if (getenv("JMPI_TRACE")) _jmpi_trace=1; |
|
else _jmpi_trace=0; |
#ifdef PEGASUS_DEBUG |
|
if (getenv("PEGASUS_JMPI_TRACE")) |
|
JMPIProviderManager::trace = 1; |
|
else |
|
JMPIProviderManager::trace = 0; |
|
#else |
|
JMPIProviderManager::trace = 0; |
|
#endif |
} | } |
| |
JMPIProviderManager::~JMPIProviderManager(void) | JMPIProviderManager::~JMPIProviderManager(void) |
|
|
const String &ns, const String &cn) | const String &ns, const String &cn) |
{ | { |
String key(ns+String("::")+cn+String("::")+CIMValue(name.getCapabilitiesMask()).toString()); | String key(ns+String("::")+cn+String("::")+CIMValue(name.getCapabilitiesMask()).toString()); |
return provReg.insert(key,name); |
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::insertProvider: "<<key<<PEGASUS_STD(endl)); |
|
|
|
Boolean ret = false; |
|
|
|
{ |
|
AutoMutex lock (mutexProvReg); |
|
|
|
ret = provReg.insert(key,name); |
} | } |
| |
|
return ret; |
|
} |
| |
Message * JMPIProviderManager::processMessage(Message * request) throw() | Message * JMPIProviderManager::processMessage(Message * request) throw() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::processMessage()"); |
"JMPIProviderManager::processMessage()"); |
|
| |
Message * response = 0; | Message * response = 0; |
| |
|
|
{ | { |
case CIM_GET_INSTANCE_REQUEST_MESSAGE: | case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
response = handleGetInstanceRequest(request); | response = handleGetInstanceRequest(request); |
|
|
break; | break; |
|
|
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: | case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
response = handleEnumerateInstancesRequest(request); | response = handleEnumerateInstancesRequest(request); |
|
|
break; | break; |
|
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: | case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
response = handleEnumerateInstanceNamesRequest(request); | response = handleEnumerateInstanceNamesRequest(request); |
|
|
break; | break; |
|
|
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: | case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
response = handleCreateInstanceRequest(request); | response = handleCreateInstanceRequest(request); |
|
|
break; | break; |
|
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: | case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
response = handleModifyInstanceRequest(request); | response = handleModifyInstanceRequest(request); |
|
|
break; | break; |
|
|
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: | case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
response = handleDeleteInstanceRequest(request); | response = handleDeleteInstanceRequest(request); |
|
break; |
| |
|
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
|
response = handleExecQueryRequest(request); |
break; | break; |
/* case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
|
response = handleExecuteQueryRequest(request); |
|
| |
*/ break; |
|
case CIM_ASSOCIATORS_REQUEST_MESSAGE: | case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
response = handleAssociatorsRequest(request); | response = handleAssociatorsRequest(request); |
|
|
break; | break; |
|
|
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: | case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
response = handleAssociatorNamesRequest(request); | response = handleAssociatorNamesRequest(request); |
|
|
break; | break; |
|
|
case CIM_REFERENCES_REQUEST_MESSAGE: | case CIM_REFERENCES_REQUEST_MESSAGE: |
response = handleReferencesRequest(request); | response = handleReferencesRequest(request); |
|
|
break; | break; |
|
|
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: | case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
response = handleReferenceNamesRequest(request); | response = handleReferenceNamesRequest(request); |
|
break; |
| |
|
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
|
response = handleGetPropertyRequest(request); |
break; | break; |
|
|
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
response = handleSetPropertyRequest(request); |
|
break; |
|
|
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: | case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
response = handleInvokeMethodRequest(request); | response = handleInvokeMethodRequest(request); |
|
|
break; | break; |
|
|
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: | case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleCreateSubscriptionRequest(request); | response = handleCreateSubscriptionRequest(request); |
|
|
break; | break; |
|
|
/* case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: | /* case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleModifySubscriptionRequest(request); | response = handleModifySubscriptionRequest(request); |
break; | break; |
*/ | */ |
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: | case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleDeleteSubscriptionRequest(request); | response = handleDeleteSubscriptionRequest(request); |
|
|
break; | break; |
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
|
response = handleEnableIndicationsRequest(request); |
|
| |
break; |
|
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
|
response = handleDisableIndicationsRequest(request); |
|
|
|
break; |
|
/* case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: | /* case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
response = handleExportIndicationRequest(request); | response = handleExportIndicationRequest(request); |
break; | break; |
*/ | */ |
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: | case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
response = handleDisableModuleRequest(request); | response = handleDisableModuleRequest(request); |
|
|
break; | break; |
|
|
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: | case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
response = handleEnableModuleRequest(request); | response = handleEnableModuleRequest(request); |
|
|
break; | break; |
|
|
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: | case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
response = handleStopAllProvidersRequest(request); | response = handleStopAllProvidersRequest(request); |
|
|
break; | break; |
|
|
case CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE: | case CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE: |
response = handleInitializeProviderRequest(request); | response = handleInitializeProviderRequest(request); |
|
break; |
| |
|
case CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE: |
|
response = handleSubscriptionInitCompleteRequest (request); |
break; | break; |
|
|
default: | default: |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, | PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"*** Unsupported Request "+request->getType()); | "*** Unsupported Request "+request->getType()); |
response = handleUnsupportedRequest(request); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::processMessage: Unsupported request "<<request->getType ()<<PEGASUS_STD(endl)); |
| |
|
response = handleUnsupportedRequest(request); |
break; | break; |
} | } |
| |
|
|
#define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL) | #define CHARS(cstring) (char*)(strlen(cstring)?(const char*)cstring:NULL) |
| |
| |
#define HandlerIntroBase(type,type1,message,request,response,handler,respType) \ |
#define HandlerIntroBase(type,type1,message,request,response,handler) \ |
CIM##type##RequestMessage * request = \ | CIM##type##RequestMessage * request = \ |
dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *>(message)); \ | dynamic_cast<CIM##type##RequestMessage *>(const_cast<Message *>(message)); \ |
PEGASUS_ASSERT(request != 0); \ | PEGASUS_ASSERT(request != 0); \ |
CIM##type##ResponseMessage * response = \ | CIM##type##ResponseMessage * response = \ |
new CIM##type##ResponseMessage( \ |
dynamic_cast<CIM##type##ResponseMessage*>(request->buildResponse()); \ |
request->messageId, \ |
|
CIMException(), \ |
|
request->queueIds.copyAndPop() \ |
|
respType \ |
|
PEGASUS_ASSERT(response != 0); \ | PEGASUS_ASSERT(response != 0); \ |
response->setKey(request->getKey()); \ |
type1##ResponseHandler handler(request, response, _responseChunkCallback); |
response->setHttpMethod(request->getHttpMethod()); \ |
|
type1##ResponseHandler handler(request, response); |
|
|
|
#define VOIDINTRO ); |
|
#define NOVOIDINTRO(type) ,type); |
|
#define METHODINTRO ,CIMValue(), Array<CIMParamValue>(), request->methodName ); |
|
|
|
|
|
#define HandlerIntroVoid(type,message,request,response,handler) \ |
|
HandlerIntroBase(type,type,message,request,response,handler,VOIDINTRO) |
|
|
|
#define HandlerIntroMethod(type,message,request,response,handler) \ |
|
HandlerIntroBase(type,type,message,request,response,handler,METHODINTRO) |
|
| |
#define HandlerIntroInd(type,message,request,response,handler) \ | #define HandlerIntroInd(type,message,request,response,handler) \ |
HandlerIntroBase(type,Operation,message,request,response,handler,VOIDINTRO) |
HandlerIntroBase(type,Operation,message,request,response,handler) |
| |
#define HandlerIntroInit(type,message,request,response,handler) \ | #define HandlerIntroInit(type,message,request,response,handler) \ |
HandlerIntroBase(type,Operation,message,request,response,handler,VOIDINTRO) |
HandlerIntroBase(type,Operation,message,request,response,handler) |
| |
#define HandlerIntro(type,message,request,response,handler,respType) \ |
#define HandlerIntro(type,message,request,response,handler) \ |
HandlerIntroBase(type,type,message,request,response,handler,NOVOIDINTRO(respType)) |
HandlerIntroBase(type,type,message,request,response,handler) |
| |
#define HandlerCatch(handler) \ | #define HandlerCatch(handler) \ |
catch(CIMException & e) \ | catch(CIMException & e) \ |
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); \ | handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); \ |
} \ | } \ |
catch(...) \ | catch(...) \ |
{ PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \ |
{ PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, \ |
"Exception: Unknown"); \ | "Exception: Unknown"); \ |
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \ | handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \ |
} | } |
|
|
jobjectArray pl=NULL; | jobjectArray pl=NULL; |
if (s) { | if (s) { |
jstring initial=env->NewString(NULL,0); | jstring initial=env->NewString(NULL,0); |
pl=env->NewObjectArray(s,jv->StringClassRef,initial); |
pl=(jobjectArray)env->NewObjectArray(s,jv->StringClassRef,initial); |
for (Uint32 i=0; i<s; i++) { | for (Uint32 i=0; i<s; i++) { |
env->SetObjectArrayElement | env->SetObjectArrayElement |
(pl,i,env->NewStringUTF(list[i].getString().getCString())); | (pl,i,env->NewStringUTF(list[i].getString().getCString())); |
|
|
| |
Message * JMPIProviderManager::handleGetInstanceRequest(const Message * message) throw() | Message * JMPIProviderManager::handleGetInstanceRequest(const Message * message) throw() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleGetInstanceRequest"); |
"JMPIProviderManager::handleGetInstanceRequest"); |
|
| |
HandlerIntro(GetInstance,message,request,response,handler,CIMInstance()); |
HandlerIntro(GetInstance,message,request,response,handler); |
| |
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMINSTANCEPROVIDER, |
|
METHOD_INSTANCEPROVIDER, |
|
METHOD_INSTANCEPROVIDER2, // same as METHOD_CIMINSTANCEPROVIDER2 |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
JNIEnv *env=NULL; | JNIEnv *env=NULL; |
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
| |
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
|
request->nameSpace.getString(), | request->nameSpace.getString(), |
request->instanceName.getClassName().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 | // make target object path |
CIMObjectPath objectPath( |
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->instanceName.getClassName(), | request->instanceName.getClassName(), |
request->instanceName.getKeyBindings()); | request->instanceName.getKeyBindings()); |
|
|
name.getLogicalName()); | name.getLogicalName()); |
OperationContext context; | 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 | // forward request |
JMPIProvider & pr=ph.GetProvider(); | JMPIProvider & pr=ph.GetProvider(); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.getInstance: " + pr.getName()); |
"Calling provider.getInstance: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::getInstance"<<endl); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: Calling provider getInstance: "<<pr.getName()<<PEGASUS_STD(endl)); |
| |
JvmVector *jv; |
JvmVector *jv = 0; |
JNIEnv *env=JMPIjvm::attachThread(&jv); |
|
JMPIjvm::checkException(env); |
|
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); |
|
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
env = JMPIjvm::attachThread(&jv); |
request->instanceName.getClassName(), |
|
false,true,true,CIMPropertyList()); |
if (!env) |
JMPIjvm::checkException(env); |
{ |
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,(jint)&cls); |
PEG_METHOD_EXIT(); |
JMPIjvm::checkException(env); |
|
|
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); | JMPIProvider::pm_service_op_lock op_lock(&pr); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"getInstance", |
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;"); | "(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;Z)Lorg/pegasus/jmpi/CIMInstance;"); |
| |
if (id==NULL) { |
if (id != NULL) |
env->ExceptionClear(); |
{ |
id=env->GetMethodID((jclass)pr.jProviderClass,"getInstance", |
eMethodFound = METHOD_INSTANCEPROVIDER; |
"(Lorg/pegasus/jmpi/CIMObjectPath;ZZZ[Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)" |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
"Lorg/pegasus/jmpi/CIMInstance;"); |
|
JMPIjvm::checkException(env); |
|
mode24=true; |
|
pl=getList(jv,env,request->propertyList); |
|
} | } |
JMPIjvm::checkException(env); |
|
| |
STAT_GETSTARTTIME; |
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
| |
jobject inst=NULL; |
// public org.pegasus.jmpi.CIMInstance getInstance (org.pegasus.jmpi.CIMObjectPath op, |
if (mode24) inst=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
// boolean localOnly, |
request->localOnly,request->includeQualifiers,request->includeClassOrigin,pl,jCc); |
// boolean includeQualifiers, |
else inst=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,jCc,true); |
// 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;"); |
| |
STAT_PMS_PROVIDEREND; |
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;"); |
| |
JMPIjvm::checkException(env); |
if (id != NULL) |
handler.processing(); |
{ |
if (inst) { |
eMethodFound = METHOD_INSTANCEPROVIDER2; |
CIMInstance *ci=((CIMInstance*)env->CallIntMethod(inst,JMPIjvm::jv.CIMInstanceCInst)); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
handler.deliver(*ci); |
|
} | } |
handler.complete(); |
/* Fix for 4238 */ |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
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.")); |
} | } |
| |
Message * JMPIProviderManager::handleEnumerateInstancesRequest(const Message * message) throw() |
JMPIjvm::checkException(env); |
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"JMPIProviderManager::handleEnumerateInstanceRequest"); |
|
|
|
HandlerIntro(EnumerateInstances,message,request,response, |
|
handler,Array<CIMInstance>()); |
|
JNIEnv *env=NULL; |
|
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
| |
try { |
switch (eMethodFound) |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
{ |
"JMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2", |
case METHOD_CIMINSTANCEPROVIDER: |
System::getHostName(), |
{ |
request->nameSpace.getString(), |
jlong jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
request->className.getString()); |
jobject jop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef); |
| |
// make target object path |
JMPIjvm::checkException(env); |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->className); |
|
| |
// resolve provider name |
CIMClass cls; |
ProviderName name = _resolveProviderName( |
|
request->operationContext.get(ProviderIdContainer::NAME)); |
|
| |
// get cached or load new provider module |
try |
JMPIProvider::OpProviderHolder ph = |
{ |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl)); |
String::EMPTY); |
AutoMutex lock (pr._cimomMutex); |
| |
// convert arguments |
cls = pr._cimom_handle->getClass(context, |
OperationContext 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; |
|
} |
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
CIMClass *pcls = new CIMClass (cls); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
| |
CIMPropertyList propertyList(request->propertyList); |
JMPIjvm::checkException(env); |
| |
// forward request |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
JMPIProvider & pr=ph.GetProvider(); |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JMPIjvm::checkException(env); |
"Calling provider.enumerateInstances: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::enumerateInstances"<<endl); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
|
StatProviderTimeMeasurement providerTime(response); |
| |
JvmVector *jv; |
jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider, |
env=JMPIjvm::attachThread(&jv); |
id, |
|
jop, |
|
JMPI_LOCALONLY, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList, |
|
jcimClass); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
handler.processing(); |
request->className, |
|
false,true,true,CIMPropertyList()); |
|
JMPIjvm::checkException(env); |
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,(jint)&cls); |
|
JMPIjvm::checkException(env); |
|
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
if (jciRet) { |
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
STAT_GETSTARTTIME; |
handler.deliver(*ciRet); |
|
} |
|
handler.complete(); |
|
break; |
|
} |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"enumInstances", |
/* Fix for 4238 */ |
"(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;Z)Ljava/util/Vector;"); |
case METHOD_INSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
if (id==NULL) { |
jlong jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
env->ExceptionClear(); |
jobject jop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef); |
id=env->GetMethodID((jclass)pr.jProviderClass,"enumerateInstances", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;ZZZ[Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)" |
|
"[Lorg/pegasus/jmpi/CIMInstance;"); |
|
JMPIjvm::checkException(env); |
|
mode24=true; |
|
pl=getList(jv,env,request->propertyList); |
|
} |
|
JMPIjvm::checkException(env); |
|
| |
if (!mode24) { |
|
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,false,jCc,true); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
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); |
| |
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jInst=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
|
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); | JMPIjvm::checkException(env); |
| |
handler.deliver(inst); |
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(); | 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); |
| |
else { |
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
|
request->localOnly,request->includeQualifiers,request->includeClassOrigin,pl,jCc); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
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::handleGetInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
| |
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jInst=env->GetObjectArrayElement(jAr,i); |
|
|
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
// Modified for Bugzilla# 3679 |
|
jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jop, |
|
jcimClass, |
|
JMPI_LOCALONLY); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
handler.deliver(inst); |
handler.processing(); |
} |
|
|
if (jciRet) { |
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
|
|
handler.deliver(*ciRet); |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
} | } |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
|
|
return(response); | return(response); |
} | } |
| |
Message * JMPIProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw() |
Message * JMPIProviderManager::handleEnumerateInstancesRequest(const Message * message) throw() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleEnumerateInstanceNamesRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleEnumerateInstanceRequest"); |
| |
HandlerIntro(EnumerateInstanceNames,message,request,response, |
HandlerIntro(EnumerateInstances,message,request,response,handler); |
handler,Array<CIMObjectPath>()); |
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMINSTANCEPROVIDER, |
|
METHOD_CIMINSTANCEPROVIDER2, |
|
METHOD_INSTANCEPROVIDER, |
|
METHOD_INSTANCEPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
JNIEnv *env=NULL; | JNIEnv *env=NULL; |
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
| |
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"JMPIProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
"JMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2", |
System::getHostName(), | System::getHostName(), |
request->nameSpace.getString(), | request->nameSpace.getString(), |
request->className.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 | // make target object path |
CIMObjectPath objectPath( |
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->className); | request->className); |
| |
|
|
request->operationContext.get(ProviderIdContainer::NAME)); | request->operationContext.get(ProviderIdContainer::NAME)); |
| |
// get cached or load new provider module | // get cached or load new provider module |
JMPIProvider::OpProviderHolder ph = |
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (name.getPhysicalName(), |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName()); |
name.getLogicalName(), |
|
String::EMPTY); |
| |
// convert arguments | // convert arguments |
OperationContext context; | OperationContext context; |
|
|
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); | context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); | context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
| |
|
// forward request |
JMPIProvider & pr=ph.GetProvider(); | JMPIProvider & pr=ph.GetProvider(); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.enumerateInstances: " + pr.getName()); |
"Calling provider.enumerateInstanceNames: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::enumerateInstanceNames"<<endl); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Calling provider enumerateInstances: "<<pr.getName()<<PEGASUS_STD(endl)); |
| |
|
JvmVector *jv = 0; |
| |
JvmVector *jv; |
|
env=JMPIjvm::attachThread(&jv); | env=JMPIjvm::attachThread(&jv); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
if (!env) |
jv->CIMObjectPathNewI,(jint)&objectPath); |
{ |
JMPIjvm::checkException(env); |
PEG_METHOD_EXIT(); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
request->className, |
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
false,true,true,CIMPropertyList()); |
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
JMPIjvm::checkException(env); |
} |
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,(jint)&cls); |
|
JMPIjvm::checkException(env); |
|
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); | JMPIProvider::pm_service_op_lock op_lock(&pr); |
| |
STAT_GETSTARTTIME; |
jmethodID id = NULL; |
|
String interfaceType; |
|
String interfaceVersion; |
|
|
|
getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME), |
|
interfaceType, |
|
interfaceVersion); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"enumInstances", |
if (interfaceType == "JMPI") |
"(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"); |
{ |
|
// 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) { |
if (id != NULL) |
env->ExceptionClear(); |
{ |
id=env->GetMethodID((jclass)pr.jProviderClass,"enumerateInstanceNames", |
eMethodFound = METHOD_INSTANCEPROVIDER; |
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;)" |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
"[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
JMPIjvm::checkException(env); |
|
mode24=true; |
|
} | } |
JMPIjvm::checkException(env); |
|
| |
if (!mode24) { |
if (id == NULL) |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,true,jCc); |
{ |
JMPIjvm::checkException(env); |
env->ExceptionClear(); |
| |
STAT_PMS_PROVIDEREND; |
// 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;"); |
| |
handler.processing(); |
if (id != NULL) |
if (jVec) { |
{ |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
JMPIjvm::checkException(env); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
jobject jCop=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
JMPIjvm::checkException(env); |
|
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
|
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
|
JMPIjvm::checkException(env); |
|
handler.deliver(*cop); |
|
} | } |
} | } |
handler.complete(); |
|
} | } |
else { |
else if (interfaceType == "JMPIExperimental") |
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider,id,jRef,jCc); |
{ |
JMPIjvm::checkException(env); |
/* Fix for 4189 */ |
|
// public abstract java.util.Vector enumerateInstances (org.pegasus.jmpi.OperationContext oc |
STAT_PMS_PROVIDEREND; |
// 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;"); |
| |
handler.processing(); |
if (id != NULL) |
if (jAr) { |
{ |
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
eMethodFound = METHOD_INSTANCEPROVIDER2; |
JMPIjvm::checkException(env); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
jobject jCop=env->GetObjectArrayElement(jAr,i); |
|
JMPIjvm::checkException(env); |
|
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
|
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
|
JMPIjvm::checkException(env); |
|
handler.deliver(*cop); |
|
} | } |
|
/* 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)); |
} | } |
handler.complete(); |
|
} | } |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
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.")); |
} | } |
| |
Message * JMPIProviderManager::handleCreateInstanceRequest(const Message * message) throw() |
JMPIjvm::checkException(env); |
|
|
|
switch (eMethodFound) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
case METHOD_CIMINSTANCEPROVIDER: |
"JMPIProviderManager::handleCreateInstanceRequest"); |
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
HandlerIntro(CreateInstance,message,request,response, |
JMPIjvm::checkException(env); |
handler,CIMObjectPath()); |
|
JNIEnv *env=NULL; |
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleCreateInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->newInstance.getPath().getClassName().getString()); |
|
| |
// make target object path |
CIMClass cls; |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->newInstance.getPath().getClassName(), |
|
request->newInstance.getPath().getKeyBindings()); |
|
| |
// resolve provider name |
try |
ProviderName name = _resolveProviderName( |
{ |
request->operationContext.get(ProviderIdContainer::NAME)); |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
// get cached or load new provider module |
cls = pr._cimom_handle->getClass(context, |
JMPIProvider::OpProviderHolder ph = |
request->nameSpace, |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), |
request->className, |
String::EMPTY); |
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; |
|
} |
| |
// convert arguments |
CIMClass *pcls = new CIMClass (cls); |
OperationContext context; |
|
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
JMPIjvm::checkException(env); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
| |
// forward request |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
JMPIProvider & pr=ph.GetProvider(); |
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JMPIjvm::checkException(env); |
"Calling provider.createInstance: " + |
|
ph.GetProvider().getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::createInstances"<<endl); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
JvmVector *jv; |
StatProviderTimeMeasurement providerTime(response); |
env=JMPIjvm::attachThread(&jv); |
|
|
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
JMPI_LOCALONLY, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList, |
|
jcc); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); |
|
jobject jInst=env->NewObject(jv->CIMInstanceClassRef, |
|
jv->CIMInstanceNewI,(jint)&request->newInstance); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
| |
STAT_GETSTARTTIME; |
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"createInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobject jCop=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,jInst); |
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
STAT_PMS_PROVIDEREND; |
/* Fix for 4237 */ |
|
CIMClass cls; |
| |
JMPIjvm::checkException(env); |
try |
handler.processing(); |
{ |
if (jCop) { |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
CIMObjectPath cop=*((CIMObjectPath*)env->CallIntMethod(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
AutoMutex lock (pr._cimomMutex); |
handler.deliver(cop); |
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
} | } |
handler.complete(); |
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
| |
PEG_METHOD_EXIT(); |
JMPIjvm::checkException(env); |
| |
return(response); |
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
} | } |
| |
Message * JMPIProviderManager::handleModifyInstanceRequest(const Message * message) throw() |
case METHOD_CIMINSTANCEPROVIDER2: |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
"JMPIProviderManager::handleModifyInstanceRequest"); |
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
HandlerIntroVoid(ModifyInstance,message,request,response,handler); |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
JNIEnv *env=NULL; |
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
| |
try { |
JMPIjvm::checkException(env); |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleModifyInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->modifiedInstance.getPath().getClassName().getString()); |
|
| |
// make target object path |
CIMClass cls; |
CIMObjectPath objectPath( |
|
System::getHostName(), |
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->nameSpace, |
request->modifiedInstance.getPath ().getClassName(), |
request->className, |
request->modifiedInstance.getPath ().getKeyBindings()); |
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; |
|
} |
| |
// resolve provider name |
CIMClass *pcls = new CIMClass (cls); |
ProviderName name = _resolveProviderName( |
|
request->operationContext.get(ProviderIdContainer::NAME)); |
|
| |
// get cached or load new provider module |
JMPIjvm::checkException(env); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
| |
// convert arguments |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
OperationContext context; |
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
JMPIjvm::checkException(env); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
| |
CIMPropertyList propertyList(request->propertyList); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
// forward request |
StatProviderTimeMeasurement providerTime(response); |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
"Calling provider.modifyInstance: " + pr.getName()); |
id, |
|
joc, |
|
jcop, |
|
jcc, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
| |
DDD(cerr<<"--- JMPIProviderManager::modifyInstance"<<endl); |
JMPIjvm::checkException(env); |
| |
JvmVector *jv; |
if (joc) |
env=JMPIjvm::attachThread(&jv); |
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
handler.processing(); |
jv->CIMObjectPathNewI,(jint)&objectPath); |
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jInst=env->NewObject(jv->CIMInstanceClassRef, |
|
jv->CIMInstanceNewI,(jint)&request->modifiedInstance); |
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
STAT_GETSTARTTIME; |
/* Fix for 4237 */ |
|
CIMClass cls; |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"setInstance", |
try |
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)V"); |
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
if (id==NULL) { |
cls = pr._cimom_handle->getClass(context, |
env->ExceptionClear(); |
request->nameSpace, |
id=env->GetMethodID((jclass)pr.jProviderClass,"setInstance", |
ciRet->getClassName(), |
"(Lorg/pegasus/jmpi/CIMObjectPath;Z[Ljava/lang/String)V"); |
false, |
JMPIjvm::checkException(env); |
true, |
mode24=true; |
true, |
pl=getList(jv,env,request->propertyList); |
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
} | } |
JMPIjvm::checkException(env); |
|
|
|
if (!mode24) env->CallVoidMethod((jobject)pr.jProvider,id,jRef,jInst); |
|
else env->CallVoidMethod((jobject)pr.jProvider,id,jRef,jInst,pl); |
|
| |
STAT_PMS_PROVIDEREND; |
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
JMPIjvm::detachThread(); |
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
/* Fix for 4189 */ |
|
case METHOD_INSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
PEG_METHOD_EXIT(); |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
return(response); |
JMPIjvm::checkException(env); |
} |
|
| |
Message * JMPIProviderManager::handleDeleteInstanceRequest(const Message * message) throw() |
CIMClass cls; |
|
|
|
try |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
"JMPIProviderManager::handleDeleteInstanceRequest"); |
AutoMutex lock (pr._cimomMutex); |
| |
HandlerIntroVoid(DeleteInstance,message,request,response, |
cls = pr._cimom_handle->getClass (context, |
handler); |
|
JNIEnv *env=NULL; |
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::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->nameSpace, |
request->instanceName.getClassName(), |
request->className, |
request->instanceName.getKeyBindings()); |
false, |
|
true, |
// resolve provider name |
true, |
ProviderName name = _resolveProviderName( |
CIMPropertyList()); |
request->operationContext.get(ProviderIdContainer::NAME)); |
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; |
|
} |
| |
// get cached or load new provider module |
CIMClass *pcls = new CIMClass (cls); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
| |
// convert arguments |
JMPIjvm::checkException(env); |
OperationContext context; |
|
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
| |
// forward request |
JMPIjvm::checkException(env); |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
"Calling provider.deleteInstance: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::modifyInstance"<<endl); |
StatProviderTimeMeasurement providerTime(response); |
| |
JvmVector *jv; |
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
env=JMPIjvm::attachThread(&jv); |
id, |
|
joc, |
|
jcop, |
|
jcc, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
if (joc) |
|
{ |
STAT_GETSTARTTIME; |
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"deleteInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;)V"); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
|
} |
| |
env->CallVoidMethod((jobject)pr.jProvider,id,jRef); |
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
JMPIjvm::detachThread(); |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
PEG_METHOD_EXIT(); |
|
| |
return(response); |
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
} |
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
|
/* Fix for 4237 */ |
|
CIMClass cls; |
| |
Message * JMPIProviderManager::handleAssociatorsRequest(const Message * message) throw() |
try |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
"JMPIProviderManager::handleAssociatorsRequest"); |
AutoMutex lock (pr._cimomMutex); |
|
|
HandlerIntro(Associators,message,request,response, |
|
handler,Array<CIMObject>()); |
|
JNIEnv *env=NULL; |
|
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleAssociatorsRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
| |
// make target object path |
cls = pr._cimom_handle->getClass(context, |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->objectName.getClassName()); |
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
| |
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
| |
CIMObjectPath assocPath( |
JMPIjvm::checkException(env); |
System::getHostName(), |
|
request->nameSpace, |
|
request->assocClass.getString()); |
|
| |
// resolve provider name |
iop.setNameSpace(op.getNameSpace()); |
ProviderName name = _resolveProviderName( |
|
request->operationContext.get(ProviderIdContainer::NAME)); |
|
| |
// get cached or load new provider module |
ciRet->setPath(iop); |
JMPIProvider::OpProviderHolder ph = |
/* Fix for 4237*/ |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
| |
// convert arguments |
handler.deliver(*ciRet); |
OperationContext context; |
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
/* Fix for 4189 */ |
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
case METHOD_INSTANCEPROVIDER: |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
{ |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
// forward request |
JMPIjvm::checkException(env); |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
CIMClass cls; |
"Calling provider.associators: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::associators"<< |
try |
" role: >"<<request->role<<"< aCls "<< |
{ |
request->assocClass<<endl); |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
JvmVector *jv; |
cls = pr._cimom_handle->getClass(context, |
env=JMPIjvm::attachThread(&jv); |
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; |
|
} |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
CIMClass *pcls = new CIMClass (cls); |
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); |
|
| |
jstring rClass=env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring rRole=env->NewStringUTF(request->role.getCString()); |
|
jstring resRole=env->NewStringUTF(request->resultRole.getCString()); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
STAT_GETSTARTTIME; |
|
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"associators", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;" |
|
"Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id==NULL) { |
|
env->ExceptionClear(); |
|
id=env->GetMethodID((jclass)pr.jProviderClass,"associators", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;" |
|
"Ljava/lang/String;ZZ[Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
JMPIjvm::checkException(env); |
|
mode24=true; |
|
} |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
pl=getList(jv,env,request->propertyList); |
StatProviderTimeMeasurement providerTime(response); |
| |
if (!mode24) { |
// Modified for Bugzilla# 3679 |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
rClass,rRole,resRole,false,false,pl); |
id, |
JMPIjvm::checkException(env); |
jcop, |
|
request->deepInheritance, |
|
jcc, |
|
JMPI_LOCALONLY); |
| |
STAT_PMS_PROVIDEREND; |
JMPIjvm::checkException(env); |
| |
handler.processing(); | handler.processing(); |
if (jVec) { | if (jVec) { |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { | for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jInst=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
JMPIjvm::checkException(env); |
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
inst.getClassName(),false,true,true,CIMPropertyList()); |
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
const CIMObjectPath& op=inst.getPath(); |
|
CIMObjectPath iop=inst.buildPath(cls); |
|
iop.setNameSpace(op.getNameSpace()); |
|
inst.setPath(iop); |
|
| |
handler.deliver(inst); |
/* Fix for 4237 */ |
} |
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
} | } |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
} | } |
| |
else { |
const CIMObjectPath& op = ciRet->getPath(); |
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
CIMObjectPath iop = ciRet->buildPath(cls); |
rClass,rRole,resRole,false,false,pl); |
|
JMPIjvm::checkException(env); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
| |
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
jobject jInst=env->GetObjectArrayElement(jAr,i); |
|
JMPIjvm::checkException(env); |
|
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
|
inst.getClassName(),false,true,true,CIMPropertyList()); |
|
const CIMObjectPath& op=inst.getPath(); |
|
CIMObjectPath iop=inst.buildPath(cls); |
|
iop.setNameSpace(op.getNameSpace()); | iop.setNameSpace(op.getNameSpace()); |
inst.setPath(iop); |
|
| |
handler.deliver(inst); |
ciRet->setPath(iop); |
} |
/* Fix for 4237*/ |
|
|
|
handler.deliver(*ciRet); |
} | } |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
| |
|
|
return(response); | return(response); |
} | } |
| |
|
Message * JMPIProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw() |
|
|
Message * JMPIProviderManager::handleAssociatorNamesRequest(const Message * message) throw() |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleEnumerateInstanceNamesRequest"); |
"JMPIProviderManager::handleAssociatorNamesRequest"); |
|
|
HandlerIntro(EnumerateInstanceNames,message,request,response, handler); |
| |
HandlerIntro(AssociatorNames,message,request,response, |
typedef enum { |
handler,Array<CIMObjectPath>()); |
METHOD_UNKNOWN = 0, |
|
METHOD_CIMINSTANCEPROVIDER, |
|
METHOD_CIMINSTANCEPROVIDER2, |
|
METHOD_INSTANCEPROVIDER, |
|
METHOD_INSTANCEPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
JNIEnv *env=NULL; | JNIEnv *env=NULL; |
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
| |
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"JMPIProviderManager::handleAssociatorNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
"JMPIProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
System::getHostName(), | System::getHostName(), |
request->nameSpace.getString(), | request->nameSpace.getString(), |
request->objectName.getClassName().getString()); |
request->className.getString()); |
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName()); |
|
| |
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->className.getString()<<PEGASUS_STD(endl)); |
| |
CIMObjectPath assocPath( |
// make target object path |
System::getHostName(), |
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
request->nameSpace, | request->nameSpace, |
request->assocClass.getString()); |
request->className); |
| |
// resolve provider name | // resolve provider name |
ProviderName name = _resolveProviderName( | ProviderName name = _resolveProviderName( |
request->operationContext.get(ProviderIdContainer::NAME)); | request->operationContext.get(ProviderIdContainer::NAME)); |
| |
// get cached or load new provider module | // get cached or load new provider module |
JMPIProvider::OpProviderHolder ph = |
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (name.getPhysicalName(), |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
name.getLogicalName()); |
| |
// convert arguments | // convert arguments |
OperationContext context; | OperationContext context; |
|
|
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); | context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); | context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
| |
// forward request |
|
JMPIProvider & pr=ph.GetProvider(); | JMPIProvider & pr=ph.GetProvider(); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.enumerateInstanceNames: " + pr.getName()); |
"Calling provider.associatorNames: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::associatorNames"<< |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: Calling provider : enumerateInstanceNames: "<<pr.getName()<<PEGASUS_STD(endl)); |
" role: >"<<request->role<<"< aCls "<< |
|
request->assocClass<<endl); |
JvmVector *jv = 0; |
| |
JvmVector *jv; |
|
env=JMPIjvm::attachThread(&jv); | env=JMPIjvm::attachThread(&jv); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
if (!env) |
jv->CIMObjectPathNewI,(jint)&objectPath); |
{ |
JMPIjvm::checkException(env); |
PEG_METHOD_EXIT(); |
| |
jstring rClass=env->NewStringUTF(request->resultClass.getString().getCString()); |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
jstring rRole=env->NewStringUTF(request->role.getCString()); |
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
jstring resRole=env->NewStringUTF(request->resultRole.getCString()); |
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
JMPIjvm::checkException(env); |
} |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); | JMPIProvider::pm_service_op_lock op_lock(&pr); |
| |
STAT_GETSTARTTIME; |
jmethodID id = NULL; |
|
String interfaceType; |
|
String interfaceVersion; |
|
|
|
getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME), |
|
interfaceType, |
|
interfaceVersion); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"associatorNames", |
if (interfaceType == "JMPI") |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;" |
{ |
"Ljava/lang/String;)Ljava/util/Vector;"); |
// public abstract java.util.Vector enumInstances (org.pegasus.jmpi.CIMObjectPath cop, |
|
// boolean deep, |
|
// org.pegasus.jmpi.CIMClass cimClass) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"enumInstances", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"); |
| |
if (id==NULL) { |
if (id != NULL) |
env->ExceptionClear(); |
{ |
id=env->GetMethodID((jclass)pr.jProviderClass,"associatorNames", |
eMethodFound = METHOD_INSTANCEPROVIDER; |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;" |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
"Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
JMPIjvm::checkException(env); |
|
mode24=true; |
|
} | } |
JMPIjvm::checkException(env); |
|
| |
if (!mode24) { |
if (id == NULL) |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
{ |
rClass,rRole,resRole); |
env->ExceptionClear(); |
JMPIjvm::checkException(env); |
|
| |
STAT_PMS_PROVIDEREND; |
// public org.pegasus.jmpi.CIMObjectPath[] enumerateInstanceNames (org.pegasus.jmpi.CIMObjectPath op, |
|
// org.pegasus.jmpi.CIMClass cc) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"enumerateInstanceNames", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
| |
handler.processing(); |
if (id != NULL) |
if (jVec) { |
{ |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
JMPIjvm::checkException(env); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
jobject jCop=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
JMPIjvm::checkException(env); |
|
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
|
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
|
JMPIjvm::checkException(env); |
|
handler.deliver(*cop); |
|
} | } |
} | } |
handler.complete(); |
|
} | } |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract java.util.Vector enumerateInstanceNames (org.pegasus.jmpi.OperationContext oc |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// org.pegasus.jmpi.CIMClass cimClass) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"enumerateInstanceNames", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"); |
| |
else { |
if (id != NULL) |
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
{ |
rClass,rRole,resRole); |
eMethodFound = METHOD_INSTANCEPROVIDER2; |
JMPIjvm::checkException(env); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
| |
STAT_PMS_PROVIDEREND; |
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
| |
handler.processing(); |
// public abstract org.pegasus.jmpi.CIMObjectPath[] enumerateInstanceNames (org.pegasus.jmpi.OperationContext oc |
if (jAr) { |
// org.pegasus.jmpi.CIMObjectPath cop, |
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
// org.pegasus.jmpi.CIMClass cimClass) |
JMPIjvm::checkException(env); |
// throws org.pegasus.jmpi.CIMException |
jobject jCop=env->GetObjectArrayElement(jAr,i); |
id = env->GetMethodID((jclass)pr.jProviderClass, |
JMPIjvm::checkException(env); |
"enumerateInstanceNames", |
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
|
JMPIjvm::checkException(env); |
if (id != NULL) |
handler.deliver(*cop); |
{ |
} |
eMethodFound = METHOD_CIMINSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_CIMINSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
} | } |
handler.complete(); |
|
} | } |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
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); |
| |
Message * JMPIProviderManager::handleReferencesRequest(const Message * message) throw() |
switch (eMethodFound) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
case METHOD_CIMINSTANCEPROVIDER: |
"JMPIProviderManager::handleReferencesRequest"); |
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
HandlerIntro(References,message,request,response, |
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
handler,Array<CIMObject>()); |
|
JNIEnv *env=NULL; |
|
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
| |
try { |
JMPIjvm::checkException(env); |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleReferencesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
| |
// make target object path |
CIMClass cls; |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName()); |
|
| |
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
CIMObjectPath resultPath( |
cls = pr._cimom_handle->getClass(context, |
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->resultClass.getString()); |
request->className, |
|
false, |
// resolve provider name |
true, |
ProviderName name = _resolveProviderName( |
true, |
request->operationContext.get(ProviderIdContainer::NAME)); |
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
// get cached or load new provider module |
} |
JMPIProvider::OpProviderHolder ph = |
catch (CIMException e) |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
| |
// convert arguments |
CIMClass *pcls = new CIMClass (cls); |
OperationContext context; |
|
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
JMPIjvm::checkException(env); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
| |
// forward request |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
JMPIProvider & pr=ph.GetProvider(); |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JMPIjvm::checkException(env); |
"Calling provider.references: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::references"<<" role: >"<<request->role<<"< aCls "<< |
StatProviderTimeMeasurement providerTime(response); |
request->resultClass<<endl); |
|
| |
JvmVector *jv; |
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
env=JMPIjvm::attachThread(&jv); |
id, |
|
jcop, |
|
jcimClass); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jstring rRole=env->NewStringUTF(request->role.getCString()); |
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
| |
STAT_GETSTARTTIME; |
JMPIjvm::checkException(env); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"references", |
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;" |
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
"ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
| |
if (id==NULL) { |
|
env->ExceptionClear(); |
|
id=env->GetMethodID((jclass)pr.jProviderClass,"references", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;" |
|
"ZZ[Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
mode24=true; |
|
|
handler.deliver(*copRet); |
} | } |
JMPIjvm::checkException(env); |
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMINSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
pl=getList(jv,env,request->propertyList); |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
if (!mode24) { |
|
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
|
rRole,false,false,pl); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
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::handleEnumerateInstanceNamesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
| |
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
jobject jInst=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
|
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
StatProviderTimeMeasurement providerTime(response); |
inst.getClassName(),false,true,true,CIMPropertyList()); |
|
const CIMObjectPath& op=inst.getPath(); |
|
CIMObjectPath iop=inst.buildPath(cls); |
|
iop.setNameSpace(op.getNameSpace()); |
|
inst.setPath(iop); |
|
| |
handler.deliver(inst); |
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
} |
id, |
} |
joc, |
handler.complete(); |
jcop, |
} |
jcimClass); |
| |
else { |
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
|
rRole,false,false,pl); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
| |
handler.processing(); | handler.processing(); |
if (jAr) { | if (jAr) { |
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { | for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jInst=env->GetObjectArrayElement(jAr,i); |
|
JMPIjvm::checkException(env); |
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
inst.getClassName(),false,true,true,CIMPropertyList()); |
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
const CIMObjectPath& op=inst.getPath(); |
|
CIMObjectPath iop=inst.buildPath(cls); |
JMPIjvm::checkException(env); |
iop.setNameSpace(op.getNameSpace()); |
|
inst.setPath(iop); |
|
| |
handler.deliver(inst); |
handler.deliver(*copRet); |
} | } |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
} | } |
| |
} |
case METHOD_INSTANCEPROVIDER2: |
HandlerCatch(handler); |
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
if (env) JMPIjvm::detachThread(); |
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
PEG_METHOD_EXIT(); |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
return(response); |
JMPIjvm::checkException(env); |
} |
|
| |
|
CIMClass cls; |
| |
Message * JMPIProviderManager::handleReferenceNamesRequest(const Message * message) throw() |
try |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
"JMPIProviderManager::handleReferenceNamesRequest"); |
AutoMutex lock (pr._cimomMutex); |
|
|
HandlerIntro(ReferenceNames,message,request,response, |
|
handler,Array<CIMObjectPath>()); |
|
JNIEnv *env=NULL; |
|
Boolean mode24=false; |
|
CIMPropertyList propertyList; |
|
jobjectArray pl=NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleReferenceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
| |
// make target object path |
cls = pr._cimom_handle->getClass(context, |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->objectName.getClassName()); |
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::handleEnumerateInstanceNamesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
| |
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
CIMClass *pcls = new CIMClass (cls); |
| |
CIMObjectPath resultPath( |
JMPIjvm::checkException(env); |
System::getHostName(), |
|
request->nameSpace, |
|
request->resultClass.getString()); |
|
| |
// resolve provider name |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
ProviderName name = _resolveProviderName( |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
request->operationContext.get(ProviderIdContainer::NAME)); |
|
| |
// get cached or load new provider module |
JMPIjvm::checkException(env); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
| |
// convert arguments |
StatProviderTimeMeasurement providerTime(response); |
OperationContext context; |
|
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
id, |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
joc, |
|
jcop, |
|
jcimClass); |
| |
JMPIProvider & pr=ph.GetProvider(); |
JMPIjvm::checkException(env); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
if (joc) |
"Calling provider.referenceNames: " + pr.getName()); |
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
|
JMPIjvm::checkException(env); |
|
} |
| |
DDD(cerr<<"--- JMPIProviderManager::referenceNames"<<" role: >"<<request->role<<"< aCls "<< |
handler.processing(); |
request->resultClass<<endl); |
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
| |
JvmVector *jv; |
jobject jcopRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
env=JMPIjvm::attachThread(&jv); |
|
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jstring rRole=env->NewStringUTF(request->role.getCString()); |
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
JMPIjvm::checkException(env); |
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
JMPIjvm::checkException(env); |
| |
STAT_GETSTARTTIME; |
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"referenceNames", |
case METHOD_INSTANCEPROVIDER: |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)Ljava/util/Vector;"); |
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
if (id==NULL) { |
|
env->ExceptionClear(); |
|
id=env->GetMethodID((jclass)pr.jProviderClass,"referenceNames", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
mode24=true; |
|
|
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::handleEnumerateInstanceNamesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
} | } |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
if (!mode24) { |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,rRole); |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
true, |
|
jcimClass); |
|
|
|
JMPIjvm::checkException(env); |
| |
handler.processing(); | handler.processing(); |
if (jVec) { | if (jVec) { |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { | for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jCop=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
JMPIjvm::checkException(env); |
|
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
|
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
|
JMPIjvm::checkException(env); |
|
handler.deliver(*cop); |
|
} |
|
} |
|
handler.complete(); |
|
} |
|
| |
else { |
jobject jcopRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider,id,jRef,rRole); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
| |
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
jobject jCop=env->GetObjectArrayElement(jAr,i); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
|
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
handler.deliver(*copRet); |
JMPIjvm::checkException(env); |
|
handler.deliver(*cop); |
|
} | } |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
} | } |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
|
|
return(response); | return(response); |
} | } |
| |
|
Message * JMPIProviderManager::handleCreateInstanceRequest(const Message * message) throw() |
Message * JMPIProviderManager::handleInvokeMethodRequest(const Message * message) throw() |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleCreateInstanceRequest"); |
"JMPIProviderManager::handleInvokeMethodRequest"); |
|
| |
HandlerIntroMethod(InvokeMethod,message,request,response, |
HandlerIntro(CreateInstance,message,request,response,handler); |
handler); |
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_INSTANCEPROVIDER, // same as METHOD_CIMINSTANCEPROVIDER |
|
METHOD_INSTANCEPROVIDER2 // same as METHOD_CIMINSTANCEPROVIDER2 |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
JNIEnv *env=NULL; | JNIEnv *env=NULL; |
Boolean mode24=false; |
|
| |
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"JMPIProviderManager::handleInvokeMethodRequest - Host name: $0 Name space: $1 Class name: $2", |
"JMPIProviderManager::handleCreateInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
System::getHostName(), | System::getHostName(), |
request->nameSpace.getString(), | request->nameSpace.getString(), |
request->instanceName.getClassName().getString()); |
request->newInstance.getPath().getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->newInstance.getPath().getClassName().getString()<<PEGASUS_STD(endl)); |
| |
// make target object path | // make target object path |
CIMObjectPath objectPath( |
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->instanceName.getClassName(), |
request->newInstance.getPath().getClassName(), |
request->instanceName.getKeyBindings()); |
request->newInstance.getPath().getKeyBindings()); |
| |
// resolve provider name | // resolve provider name |
ProviderName name = _resolveProviderName( | ProviderName name = _resolveProviderName( |
request->operationContext.get(ProviderIdContainer::NAME)); | request->operationContext.get(ProviderIdContainer::NAME)); |
| |
// get cached or load new provider module | // get cached or load new provider module |
JMPIProvider::OpProviderHolder ph = |
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (name.getPhysicalName(), |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
name.getLogicalName(), |
|
String::EMPTY); |
| |
// convert arguments |
// forward request |
OperationContext context; |
JMPIProvider &pr = ph.GetProvider(); |
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.createInstance: " + ph.GetProvider().getName()); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
| |
JMPIProvider & pr=ph.GetProvider(); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: Calling provider createInstance: "<<pr.getName()<<PEGASUS_STD(endl)); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JvmVector *jv = 0; |
"Calling provider.invokeMethod: " + pr.getName()); |
|
| |
JvmVector *jv; |
|
env=JMPIjvm::attachThread(&jv); | env=JMPIjvm::attachThread(&jv); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
if (!env) |
jv->CIMObjectPathNewI,(jint)&objectPath); |
{ |
JMPIjvm::checkException(env); |
PEG_METHOD_EXIT(); |
| |
jstring jMethod=env->NewStringUTF(request->methodName.getString().getCString()); |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
JMPIjvm::checkException(env); |
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
|
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
|
} |
| |
STAT_GETSTARTTIME; |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"invokeMethod", |
jmethodID id = NULL; |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;" |
String interfaceType; |
"Ljava/util/Vector;Ljava/util/Vector;)Lorg/pegasus/jmpi/CIMValue;"); |
String interfaceVersion; |
|
|
|
getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME), |
|
interfaceType, |
|
interfaceVersion); |
| |
if (id==NULL) { |
if (interfaceType == "JMPI") |
env->ExceptionClear(); |
{ |
id=env->GetMethodID((jclass)pr.jProviderClass,"invokeMethod", |
// public org.pegasus.jmpi.CIMObjectPath createInstance (org.pegasus.jmpi.CIMObjectPath cop, |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;" |
// org.pegasus.jmpi.CIMInstance cimInstance) |
"[Lorg/pegasus/jmpi/CIMArgument;[Lorg/pegasus/jmpi/CIMArgument;)Lorg/pegasus/jmpi/CIMValue;"); |
// throws org.pegasus.jmpi.CIMException |
JMPIjvm::checkException(env); |
id = env->GetMethodID((jclass)pr.jProviderClass, |
mode24=true; |
"createInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
} | } |
JMPIjvm::checkException(env); |
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public org.pegasus.jmpi.CIMObjectPath createInstance (org.pegasus.jmpi.OperationContext oc |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// org.pegasus.jmpi.CIMInstance cimInstance) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"createInstance", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)Lorg/pegasus/jmpi/CIMObjectPath;"); |
| |
if (!mode24) { |
if (id != NULL) |
jobject jVecIn=env->NewObject(jv->VectorClassRef,jv->VectorNew); |
{ |
JMPIjvm::checkException(env); |
eMethodFound = METHOD_INSTANCEPROVIDER2; |
for (int i=0,m=request->inParameters.size(); i<m; i++) { |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
const CIMParamValue & parm=request->inParameters[i]; |
} |
const CIMValue v=parm.getValue(); |
|
CIMProperty *p=new CIMProperty(parm.getParameterName(),v,v.getArraySize()); |
|
jobject prop=env->NewObject(jv->CIMPropertyClassRef, |
|
jv->CIMPropertyNewI,(jint)p); |
|
env->CallVoidMethod(jVecIn,jv->VectorAddElement,prop); |
|
} | } |
| |
jobject jVecOut=env->NewObject(jv->VectorClassRef,jv->VectorNew); |
if (id == NULL) |
JMPIjvm::checkException(env); |
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
jobject jValue=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,jMethod,jVecIn,jVecOut); |
PEG_METHOD_EXIT(); |
JMPIjvm::checkException(env); |
|
| |
STAT_PMS_PROVIDEREND; |
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.")); |
|
} |
| |
handler.processing(); |
JMPIjvm::checkException(env); |
| |
CIMValue *v=((CIMValue*)env->CallIntMethod(jValue,JMPIjvm::jv.CIMValueCInst)); |
switch (eMethodFound) |
handler.deliver(*v); |
{ |
|
case METHOD_INSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
for (int i=0,m=env->CallIntMethod(jVecOut,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jProp=env->CallObjectMethod(jVecOut,JMPIjvm::jv.VectorElementAt,i); |
|
|
CIMInstance *ci = new CIMInstance (request->newInstance); |
|
jlong jciRef = DEBUG_ConvertCToJava (CIMInstance*, jlong, ci); |
|
jobject jci = env->NewObject(jv->CIMInstanceClassRef,jv->CIMInstanceNewJ,jciRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMProperty *p=((CIMProperty*)env->CallIntMethod(jProp,JMPIjvm::jv.PropertyCInst)); |
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: id = "<<id<<", jcop = "<<jcop<<", jci = "<<jci<<PEGASUS_STD(endl)); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jcopRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jci); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
handler.deliverParamValue(CIMParamValue(p->getName().getString(),p->getValue())); |
|
|
handler.processing(); |
|
|
|
if (jcopRet) { |
|
jlong jCopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jCopRetRef); |
|
|
|
handler.deliver(*copRet); |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
} | } |
else { |
|
Uint32 m=request->inParameters.size(); |
|
| |
jobjectArray jArIn=env->NewObjectArray(m,jv->CIMArgumentClassRef,NULL); |
case METHOD_INSTANCEPROVIDER2: |
for (Uint32 i=0; i<m; i++) { |
{ |
CIMParamValue *parm=new CIMParamValue(request->inParameters[i]); |
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
jobject jArg=env->NewObject(jv->CIMArgumentClassRef,jv->CIMArgumentNewI,(jint)parm); |
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
env->SetObjectArrayElement(jArIn,i,jArg); |
|
} |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
jobjectArray jArOut=env->NewObjectArray(24,jv->CIMArgumentClassRef,NULL); |
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
jobject jValue=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,jMethod,jArIn,jArOut); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
CIMInstance *ci = new CIMInstance (request->newInstance); |
|
jlong jciRef = DEBUG_ConvertCToJava (CIMInstance*, jlong, ci); |
|
jobject jci = env->NewObject(jv->CIMInstanceClassRef,jv->CIMInstanceNewJ,jciRef); |
| |
handler.processing(); |
JMPIjvm::checkException(env); |
| |
CIMValue *v=((CIMValue*)env->CallIntMethod(jValue,JMPIjvm::jv.CIMValueCInst)); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: id = "<<id<<", jcop = "<<jcop<<", jci = "<<jci<<PEGASUS_STD(endl)); |
handler.deliver(*v); |
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jcopRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jci); |
| |
for (int i=0; i<24; i++) { |
|
jobject jArg=env->GetObjectArrayElement(jArOut,i); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
if (jArg==NULL) break; |
|
CIMParamValue *p=((CIMParamValue*)env->CallIntMethod(jArg,JMPIjvm::jv.ArgumentCInst)); |
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
handler.deliverParamValue(*p); |
} |
|
|
|
handler.processing(); |
|
|
|
if (jcopRet) { |
|
jlong jCopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jCopRetRef); |
|
|
|
handler.deliver(*copRet); |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
} | } |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
| |
if (env) JMPIjvm::detachThread(); |
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleModifyInstanceRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleModifyInstanceRequest"); |
|
|
|
HandlerIntro(ModifyInstance,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMINSTANCEPROVIDER, |
|
METHOD_INSTANCEPROVIDER, |
|
METHOD_INSTANCEPROVIDER2, // same as METHOD_CIMINSTANCEPROVIDER2 |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleModifyInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->modifiedInstance.getPath().getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->modifiedInstance.getPath().getClassName().getString()<<PEGASUS_STD(endl)); |
|
|
|
// make target object path |
|
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->modifiedInstance.getPath ().getClassName(), |
|
request->modifiedInstance.getPath ().getKeyBindings()); |
|
|
|
// resolve provider name |
|
ProviderName name = _resolveProviderName( |
|
request->operationContext.get(ProviderIdContainer::NAME)); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: provider name physical = "<<name.getPhysicalName()<<", logical = "<<name.getLogicalName()<<PEGASUS_STD(endl)); |
|
|
|
// get cached or load new provider module |
|
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (name.getPhysicalName(), |
|
name.getLogicalName(), |
|
String::EMPTY); |
|
|
|
// forward request |
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Calling provider.modifyInstance: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: Calling provider "<<PEGASUS_STD(hex)<<(long)&pr<<PEGASUS_STD(dec)<<", name = "<<pr.getName ()<<", module = "<<pr.getModule()<<" modifyInstance: "<<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 void setInstance (org.pegasus.jmpi.CIMObjectPath cop, |
|
// org.pegasus.jmpi.CIMInstance cimInstance) |
|
// org.pegasus.jmpi.throws CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"setInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public void setInstance (org.pegasus.jmpi.CIMObjectPath op, |
|
// org.pegasus.jmpi.CIMInstance ci, |
|
// boolean includeQualifiers, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"setInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Z[Ljava/lang/String)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract void setInstance (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath op, |
|
// org.pegasus.jmpi.CIMInstance cimInstance); |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"setInstance", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: 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_INSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ci = new CIMInstance (request->modifiedInstance); |
|
jlong jciRef = DEBUG_ConvertCToJava (CIMInstance*, jlong, ci); |
|
jobject jci = env->NewObject(jv->CIMInstanceClassRef,jv->CIMInstanceNewJ,jciRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jci); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
break; |
|
} |
|
|
|
case METHOD_CIMINSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ci = new CIMInstance (request->modifiedInstance); |
|
jlong jciRef = DEBUG_ConvertCToJava (CIMInstance*, jlong, ci); |
|
jobject jci = env->NewObject(jv->CIMInstanceClassRef,jv->CIMInstanceNewJ,jciRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jci, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
break; |
|
} |
|
|
|
case METHOD_INSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ci = new CIMInstance (request->modifiedInstance); |
|
jlong jciRef = DEBUG_ConvertCToJava (CIMInstance*, jlong, ci); |
|
jobject jci = env->NewObject(jv->CIMInstanceClassRef,jv->CIMInstanceNewJ,jciRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jci); |
|
|
|
JMPIjvm::checkException(env); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleModifyInstanceRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleDeleteInstanceRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleDeleteInstanceRequest"); |
|
|
|
HandlerIntro(DeleteInstance,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_INSTANCEPROVIDER, // same as METHOD_CIMINSTANCEPROVIDER |
|
METHOD_INSTANCEPROVIDER2, // same as METHOD_CIMINSTANCEPROVIDER2 |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleDeleteInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteInstanceRequest: 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(), |
|
String::EMPTY); |
|
|
|
// forward request |
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.deleteInstance: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteInstanceRequest: Calling provider deleteInstance: "<<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 void deleteInstance (org.pegasus.jmpi.CIMObjectPath cop) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"deleteInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteInstanceRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract void deleteInstance (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath cop) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"deleteInstance", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteInstanceRequest: 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_INSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
break; |
|
} |
|
|
|
case METHOD_INSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod((jobject)pr.jProvider, |
|
id, |
|
jcop); |
|
|
|
JMPIjvm::checkException(env); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteInstanceRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleExecQueryRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleExecQueryRequest"); |
|
|
|
HandlerIntro(ExecQuery,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::handleExecQueryRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->className.getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: 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.execQuery: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: Calling provider execQuery: "<<pr.getName()<<", queryLanguage: "<<request->queryLanguage<<", query: "<<request->query<<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 execQuery (org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String queryStatement, |
|
// int ql, |
|
// org.pegasus.jmpi.CIMClass cimClass) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"execQuery", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ILorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public abstract org.pegasus.jmpi.CIMInstance[] execQuery(org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String query, |
|
// java.lang.String ql, |
|
// org.pegasus.jmpi.CIMClass cimClass) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"execQuery", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract java.util.Vector execQuery (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// org.pegasus.jmpi.CIMClass cimClass, |
|
// java.lang.String queryStatement, |
|
// java.lang.String queryLanguage) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"execQuery", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public abstract org.pegasus.jmpi.CIMInstance[] execQuery (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// org.pegasus.jmpi.CIMClass cimClass, |
|
// java.lang.String queryStatement, |
|
// java.lang.String queryLanguage) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"execQuery", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;Ljava/lang/String;Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: found METHOD_CIMINSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: found no method!"<<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); |
|
|
|
jstring jqueryLanguage = env->NewStringUTF(request->queryLanguage.getCString()); |
|
jstring jquery = env->NewStringUTF(request->query.getCString()); |
|
|
|
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::handleExecQueryRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcls = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
|
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jquery, |
|
jqueryLanguage, |
|
jCc); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMINSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jqueryLanguage = env->NewStringUTF(request->queryLanguage.getCString()); |
|
jstring jquery = env->NewStringUTF(request->query.getCString()); |
|
|
|
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::handleExecQueryRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcls = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
|
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jquery, |
|
jqueryLanguage, |
|
jCc); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_INSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jqueryLanguage = env->NewStringUTF(request->queryLanguage.getCString()); |
|
jstring jquery = env->NewStringUTF(request->query.getCString()); |
|
|
|
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::handleExecQueryRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
|
|
|
jlong jcls = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
|
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jVec = env->CallObjectMethod ((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jCc, |
|
jquery, |
|
jqueryLanguage); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jVec) |
|
{ |
|
for (int i = 0, m = env->CallIntMethod (jVec, JMPIjvm::jv.VectorSize); i < m; i++) |
|
{ |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: jciRet = "<<jciRet<<PEGASUS_STD(endl)); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: done!"<<PEGASUS_STD(endl)); |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_INSTANCEPROVIDER: |
|
{ |
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jqueryLanguage = env->NewStringUTF(request->queryLanguage.getCString()); |
|
jstring jquery = env->NewStringUTF(request->query.getCString()); |
|
|
|
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::handleExecQueryRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcls = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
|
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jql = 0; // @BUG - how to convert? |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jVec = env->CallObjectMethod ((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jquery, |
|
jql, |
|
jCc); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleExecQueryRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleAssociatorsRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleAssociatorsRequest"); |
|
|
|
HandlerIntro(Associators,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMASSOCIATORPROVIDER, |
|
METHOD_CIMASSOCIATORPROVIDER2, |
|
METHOD_ASSOCIATORPROVIDER, |
|
METHOD_ASSOCIATORPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleAssociatorsRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->objectName.getClassName().getString()<<PEGASUS_STD(endl)); |
|
|
|
// make target object path |
|
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName(), |
|
request->objectName.getKeyBindings()); |
|
CIMObjectPath *assocPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->assocClass.getString()); |
|
|
|
// 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.associators: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: Calling provider associators: "<<pr.getName()<<", role: "<<request->role<<", aCls: "<<request->assocClass<<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 java.util.Vector associators (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associators", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: found METHOD_ASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMInstance[] associators (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associators", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ[Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: found METHOD_CIMASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public java.util.Vector associators (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associators", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: found METHOD_ASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMInstance[] associators (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associators", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ[Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: found METHOD_CIMASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: found no method!"<<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_CIMASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorsRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorsRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleAssociatorNamesRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleAssociatorNamesRequest"); |
|
|
|
HandlerIntro(AssociatorNames,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMASSOCIATORPROVIDER, |
|
METHOD_CIMASSOCIATORPROVIDER2, |
|
METHOD_ASSOCIATORPROVIDER, |
|
METHOD_ASSOCIATORPROVIDER2 |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleAssociatorNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->objectName.getClassName().getString()<<", assocName = "<<request->assocClass.getString()<<PEGASUS_STD(endl)); |
|
|
|
// make target object path |
|
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName(), |
|
request->objectName.getKeyBindings()); |
|
CIMObjectPath *assocPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->assocClass.getString()); |
|
|
|
// 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); |
|
|
|
// forward request |
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Calling provider.associatorNames: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: Calling provider associatorNames: "<<pr.getName()<<", role: "<<request->role<<", aCls: "<<request->assocClass<<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 java.util.Vector associatorNames (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associatorNames", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: found METHOD_ASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMObjectPath[] associatorNames (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associatorNames", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: found METHOD_CIMASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public java.util.Vector associatorNames (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associatorNames", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: found METHOD_ASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMObjectPath[] associatorNames (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String resultClass, |
|
// java.lang.String role, |
|
// java.lang.String resultRole) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"associatorNames", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: found METHOD_CIMASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: found no method!"<<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_CIMASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, assocPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jResultClass = env->NewStringUTF(request->resultClass.getString().getCString()); |
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
jstring jResultRole = env->NewStringUTF(request->resultRole.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: assocName = "<<assocPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultClass = "<<request->resultClass<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: resultRole = "<<request->resultRole<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jResultClass, |
|
jRole, |
|
jResultRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleAssociatorNamesRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleReferencesRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleReferencesRequest"); |
|
|
|
HandlerIntro(References,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMASSOCIATORPROVIDER, |
|
METHOD_CIMASSOCIATORPROVIDER2, |
|
METHOD_ASSOCIATORPROVIDER, |
|
METHOD_ASSOCIATORPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleReferencesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->objectName.getClassName().getString()<<", result = "<<request->resultClass.getString()<<PEGASUS_STD(endl)); |
|
|
|
// make target object path |
|
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName(), |
|
request->objectName.getKeyBindings()); |
|
CIMObjectPath *resultPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->resultClass.getString()); |
|
|
|
// 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.references: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: Calling provider references: "<<pr.getName()<<", role: "<<request->role<<" aCls: "<<request->resultClass<<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 java.util.Vector references (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"references", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: found METHOD_ASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMInstance[] references (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"references", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ZZ[Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: found METHOD_CIMASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public java.util.Vector references (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"references", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: found METHOD_ASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMInstance[] references (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"references", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;ZZ[Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMInstance;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: found METHOD_CIMASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: found no method!"<<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_CIMASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: assocName = "<<resultPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: assocName = "<<resultPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: assocName = "<<resultPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: assocName = "<<resultPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: pathName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeQualifiers = "<<false<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferencesRequest: includeClassOrigin = "<<false<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jRole, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
ciRet->getClassName(), |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<ciRet->getClassName()<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
iop.setNameSpace(op.getNameSpace()); |
|
ciRet->setPath(iop); |
|
|
|
handler.deliver(*ciRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferencesRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleReferenceNamesRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleReferenceNamesRequest"); |
|
|
|
HandlerIntro(ReferenceNames,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMASSOCIATORPROVIDER, |
|
METHOD_CIMASSOCIATORPROVIDER2, |
|
METHOD_ASSOCIATORPROVIDER, |
|
METHOD_ASSOCIATORPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleReferenceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: hostname = "<<System::getHostName()<<", namespace = "<<request->nameSpace.getString()<<", classname = "<<request->objectName.getClassName().getString()<<PEGASUS_STD(endl)); |
|
|
|
// make target object path |
|
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName(), |
|
request->objectName.getKeyBindings()); |
|
CIMObjectPath *resultPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->resultClass.getString()); |
|
|
|
// 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); |
|
|
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.referenceNames: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: Calling provider referenceNames: "<<pr.getName()<<", role: "<<request->role<<", aCls: "<<request->resultClass<<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 java.util.Vector referenceNames (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"referenceNames", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: found METHOD_ASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMObjectPath[] referenceNames (org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"referenceNames", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: found METHOD_CIMASSOCIATORPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public java.util.Vector referenceNames (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"referenceNames", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_ASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: found METHOD_ASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMObjectPath[] referenceNames (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath assocName, |
|
// org.pegasus.jmpi.CIMObjectPath pathName, |
|
// java.lang.String role) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"referenceNames", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMASSOCIATORPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: found METHOD_CIMASSOCIATORPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: found no method!"<<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_CIMASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: assocName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jPathName, |
|
jAssociationName, |
|
jRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: assocName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jPathName, |
|
jAssociationName, |
|
jRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER: |
|
{ |
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: assocName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: pathName = "<<resultPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jAssociationName, |
|
jPathName, |
|
jRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_ASSOCIATORPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jAssociationNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, resultPath); |
|
jobject jAssociationName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jAssociationNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jPathNameRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jPathName = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jPathNameRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jRole = env->NewStringUTF(request->role.getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
#ifdef PEGASUS_DEBUG |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: assocName = "<<objectPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: pathName = "<<resultPath->toString ()<<PEGASUS_STD(endl)); |
|
DDD(PEGASUS_STD(cerr)<<"--- JMPIProviderManager::handleReferenceNamesRequest: role = "<<request->role<<PEGASUS_STD(endl)); |
|
#endif |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jVec=(jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jAssociationName, |
|
jPathName, |
|
jRole); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jcopRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleReferenceNamesRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleGetPropertyRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleGetPropertyRequest"); |
|
|
|
HandlerIntro(GetProperty,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_PROPERTYPROVIDER, |
|
METHOD_PROPERTYPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleGetPropertyRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetPropertyRequest: 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->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(), |
|
String::EMPTY); |
|
|
|
// forward request |
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Calling provider.getPropertyValue: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetPropertyRequest: Calling provider getPropertyValue: "<<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 org.pegasus.jmpi.CIMValue getPropertyValue (org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String oclass, |
|
// java.lang.String pName) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"getPropertyValue", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;)Lorg/pegasus/jmpi/CIMValue;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_PROPERTYPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetPropertyRequest: found METHOD_PROPERTYPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract org.pegasus.jmpi.CIMValue getPropertyValue (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String oclass, |
|
// java.lang.String pName) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"getPropertyValue", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;)Lorg/pegasus/jmpi/CIMValue;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_PROPERTYPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetPropertyRequest: found METHOD_PROPERTYPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetPropertyRequest: found no method!"<<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_PROPERTYPROVIDER: |
|
{ |
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring joclass = env->NewStringUTF(request->instanceName.getClassName().getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jpName = env->NewStringUTF(request->propertyName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jvalRet = env->CallObjectMethod ((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
joclass, |
|
jpName); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
|
|
if (jvalRet) |
|
{ |
|
jlong jvalRetRef = env->CallLongMethod(jvalRet,JMPIjvm::jv.CIMValueCInst); |
|
CIMValue *valRet = DEBUG_ConvertJavaToC (jlong, CIMValue*, jvalRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*valRet); |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_PROPERTYPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring joclass = env->NewStringUTF(request->instanceName.getClassName().getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jpName = env->NewStringUTF(request->propertyName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jvalRet = env->CallObjectMethod ((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
joclass, |
|
jpName); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
|
|
if (jvalRet) |
|
{ |
|
jlong jvalRetRef = env->CallLongMethod(jvalRet,JMPIjvm::jv.CIMValueCInst); |
|
CIMValue *valRet = DEBUG_ConvertJavaToC (jlong, CIMValue*, jvalRetRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliver(*valRet); |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetPropertyRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleSetPropertyRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleSetPropertyRequest"); |
|
|
|
HandlerIntro(SetProperty,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_PROPERTYPROVIDER, |
|
METHOD_PROPERTYPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleSetPropertyRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSetPropertyRequest: 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->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(), |
|
String::EMPTY); |
|
|
|
// forward request |
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Calling provider.setPropertyValue: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSetPropertyRequest: Calling provider setPropertyValue: "<<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 void setPropertyValue (org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String oclass, |
|
// java.lang.String pName, |
|
// org.pegasus.jmpi.CIMValue val) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"setPropertyValue", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Lorg/pegasus/jmpi/CIMValue;)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_PROPERTYPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSetPropertyRequest: found METHOD_PROPERTYPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract void setPropertyValue (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String oclass, |
|
// java.lang.String pName, |
|
// org.pegasus.jmpi.CIMValue val) |
|
// throws org.pegasus.jmpi.CIMException |
|
// |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"setPropertyValue", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;Lorg/pegasus/jmpi/CIMValue;)V"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_PROPERTYPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSetPropertyRequest: found METHOD_PROPERTYPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSetPropertyRequest: found no method!"<<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_PROPERTYPROVIDER: |
|
{ |
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring joclass = env->NewStringUTF(request->instanceName.getClassName().getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jpName = env->NewStringUTF(request->propertyName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMValue *val = new CIMValue (request->newValue); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jvalref = DEBUG_ConvertCToJava (CIMValue*, jlong, val); |
|
jobject jval = env->NewObject(jv->CIMValueClassRef, jv->CIMValueNewJ, jvalref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
joclass, |
|
jpName, |
|
jval); |
|
|
|
JMPIjvm::checkException(env); |
|
break; |
|
} |
|
|
|
case METHOD_PROPERTYPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopref = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef, jv->CIMObjectPathNewJ, jcopref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring joclass = env->NewStringUTF(request->instanceName.getClassName().getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jpName = env->NewStringUTF(request->propertyName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMValue *val = new CIMValue (request->newValue); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jvalref = DEBUG_ConvertCToJava (CIMValue*, jlong, val); |
|
jobject jval = env->NewObject(jv->CIMValueClassRef, jv->CIMValueNewJ, jvalref); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
joclass, |
|
jpName, |
|
jval); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSetPropertyRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleInvokeMethodRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleInvokeMethodRequest"); |
|
|
|
HandlerIntro(InvokeMethod,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_CIMMETHODPROVIDER, |
|
METHOD_CIMMETHODPROVIDER2, |
|
METHOD_METHODPROVIDER, |
|
METHOD_METHODPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleInvokeMethodRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: 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(), |
|
String::EMPTY); |
|
|
|
JMPIProvider &pr=ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.invokeMethod: " + pr.getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: Calling provider invokeMethod: "<<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 org.pegasus.jmpi.CIMValue invokeMethod (org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String name, |
|
// java.util.Vector in, |
|
// java.util.Vector out) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"invokeMethod", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/util/Vector;Ljava/util/Vector;)Lorg/pegasus/jmpi/CIMValue;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_METHODPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: found METHOD_METHODPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMValue invokeMethod (org.pegasus.jmpi.CIMObjectPath op, |
|
// java.lang.String methodName, |
|
// org.pegasus.jmpi.CIMArgument[] inArgs, |
|
// org.pegasus.jmpi.CIMArgument[] outArgs) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"invokeMethod", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;[Lorg/pegasus/jmpi/CIMArgument;[Lorg/pegasus/jmpi/CIMArgument;)Lorg/pegasus/jmpi/CIMValue;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMMETHODPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: found METHOD_CIMMETHODPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public abstract org.pegasus.jmpi.CIMValue invokeMethod (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// java.lang.String name, |
|
// java.util.Vector in, |
|
// java.util.Vector out) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"invokeMethod", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/util/Vector;Ljava/util/Vector;)Lorg/pegasus/jmpi/CIMValue;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_METHODPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: found METHOD_METHODPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public org.pegasus.jmpi.CIMValue invokeMethod (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.CIMObjectPath op, |
|
// java.lang.String methodName, |
|
// org.pegasus.jmpi.CIMArgument[] inArgs, |
|
// org.pegasus.jmpi.CIMArgument[] outArgs) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"invokeMethod", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;[Lorg/pegasus/jmpi/CIMArgument;[Lorg/pegasus/jmpi/CIMArgument;)Lorg/pegasus/jmpi/CIMValue;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMMETHODPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: found METHOD_CIMMETHODPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: 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_CIMMETHODPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jMethod = env->NewStringUTF(request->methodName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
Uint32 m=request->inParameters.size(); |
|
|
|
jobjectArray jArIn=(jobjectArray)env->NewObjectArray(m,jv->CIMArgumentClassRef,NULL); |
|
|
|
for (Uint32 i=0; i<m; i++) { |
|
CIMParamValue *parm = new CIMParamValue(request->inParameters[i]); |
|
jlong jArgRef = DEBUG_ConvertCToJava (CIMParamValue*, jlong, parm); |
|
jobject jArg = env->NewObject(jv->CIMArgumentClassRef,jv->CIMArgumentNewJ,jArgRef); |
|
|
|
env->SetObjectArrayElement(jArIn,i,jArg); |
|
} |
|
|
|
jobjectArray jArOut=(jobjectArray)env->NewObjectArray(24,jv->CIMArgumentClassRef,NULL); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jValueRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jMethod, |
|
jArIn, |
|
jArOut); |
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
|
|
jlong jValueRetRef = env->CallLongMethod(jValueRet,JMPIjvm::jv.CIMValueCInst); |
|
CIMValue *valueRet = DEBUG_ConvertJavaToC (jlong, CIMValue*, jValueRetRef); |
|
|
|
handler.deliver(*valueRet); |
|
|
|
for (int i=0; i<24; i++) { |
|
jobject jArg = env->GetObjectArrayElement(jArOut,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (jArg==NULL) |
|
break; |
|
|
|
jlong jpRef = env->CallLongMethod(jArg,JMPIjvm::jv.CIMArgumentCInst); |
|
CIMParamValue *p = DEBUG_ConvertJavaToC (jlong, CIMParamValue*, jpRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliverParamValue(*p); |
|
} |
|
|
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_CIMMETHODPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jMethod = env->NewStringUTF(request->methodName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
Uint32 m=request->inParameters.size(); |
|
|
|
jobjectArray jArIn=(jobjectArray)env->NewObjectArray(m,jv->CIMArgumentClassRef,NULL); |
|
|
|
for (Uint32 i=0; i<m; i++) { |
|
CIMParamValue *parm = new CIMParamValue(request->inParameters[i]); |
|
jlong jArgRef = DEBUG_ConvertCToJava (CIMParamValue*, jlong, parm); |
|
jobject jArg = env->NewObject(jv->CIMArgumentClassRef,jv->CIMArgumentNewJ,jArgRef); |
|
|
|
env->SetObjectArrayElement(jArIn,i,jArg); |
|
} |
|
|
|
jobjectArray jArOut=(jobjectArray)env->NewObjectArray(24,jv->CIMArgumentClassRef,NULL); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jValueRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jMethod, |
|
jArIn, |
|
jArOut); |
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
|
|
jlong jValueRetRef = env->CallLongMethod(jValueRet,JMPIjvm::jv.CIMValueCInst); |
|
CIMValue *valueRet = DEBUG_ConvertJavaToC (jlong, CIMValue*, jValueRetRef); |
|
|
|
handler.deliver(*valueRet); |
|
|
|
for (int i=0; i<24; i++) { |
|
jobject jArg = env->GetObjectArrayElement(jArOut,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (jArg==NULL) |
|
break; |
|
|
|
jlong jpRef = env->CallLongMethod(jArg,JMPIjvm::jv.CIMArgumentCInst); |
|
CIMParamValue *p = DEBUG_ConvertJavaToC (jlong, CIMParamValue*, jpRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliverParamValue(*p); |
|
} |
|
|
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_METHODPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jMethod = env->NewStringUTF(request->methodName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobject jVecIn = env->NewObject(jv->VectorClassRef,jv->VectorNew); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
for (int i=0,m=request->inParameters.size(); i<m; i++) |
|
{ |
|
const CIMParamValue &parm = request->inParameters[i]; |
|
const CIMValue v = parm.getValue(); |
|
CIMProperty *p = new CIMProperty(parm.getParameterName(),v,v.getArraySize()); |
|
jlong jpRef = DEBUG_ConvertCToJava (CIMProperty*, jlong, p); |
|
jobject jp = env->NewObject(jv->CIMPropertyClassRef,jv->CIMPropertyNewJ,jpRef); |
|
|
|
env->CallVoidMethod(jVecIn,jv->VectorAddElement,jp); |
|
} |
|
|
|
jobject jVecOut=env->NewObject(jv->VectorClassRef,jv->VectorNew); |
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jValueRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jMethod, |
|
jVecIn, |
|
jVecOut); |
|
JMPIjvm::checkException(env); |
|
|
|
handler.processing(); |
|
|
|
jlong jValueRetRef = env->CallLongMethod(jValueRet,JMPIjvm::jv.CIMValueCInst); |
|
CIMValue *valueRet = DEBUG_ConvertJavaToC (jlong, CIMValue*, jValueRetRef); |
|
|
|
handler.deliver(*valueRet); |
|
|
|
for (int i=0,m=env->CallIntMethod(jVecOut,JMPIjvm::jv.VectorSize); i<m; i++) |
|
{ |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jProp = env->CallObjectMethod(jVecOut,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jpRef = env->CallLongMethod(jProp,JMPIjvm::jv.CIMPropertyCInst); |
|
CIMProperty *p = DEBUG_ConvertJavaToC (jlong, CIMProperty*, jpRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliverParamValue(CIMParamValue(p->getName().getString(),p->getValue())); |
|
} |
|
|
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_METHODPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
|
|
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jstring jMethod = env->NewStringUTF(request->methodName.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jobject jVecIn = env->NewObject(jv->VectorClassRef,jv->VectorNew); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
for (int i=0,m=request->inParameters.size(); i<m; i++) |
|
{ |
|
const CIMParamValue &parm = request->inParameters[i]; |
|
const CIMValue v = parm.getValue(); |
|
CIMProperty *p = new CIMProperty(parm.getParameterName(),v,v.getArraySize()); |
|
jlong jpRef = DEBUG_ConvertCToJava (CIMProperty*, jlong, p); |
|
jobject jp = env->NewObject(jv->CIMPropertyClassRef,jv->CIMPropertyNewJ,jpRef); |
|
|
|
env->CallVoidMethod(jVecIn,jv->VectorAddElement,jp); |
|
} |
|
|
|
jobject jVecOut=env->NewObject(jv->VectorClassRef,jv->VectorNew); |
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jValueRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jMethod, |
|
jVecIn, |
|
jVecOut); |
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
|
|
jlong jValueRetRef = env->CallLongMethod(jValueRet,JMPIjvm::jv.CIMValueCInst); |
|
CIMValue *valueRet = DEBUG_ConvertJavaToC (jlong, CIMValue*, jValueRetRef); |
|
|
|
handler.deliver(*valueRet); |
|
|
|
for (int i=0,m=env->CallIntMethod(jVecOut,JMPIjvm::jv.VectorSize); i<m; i++) |
|
{ |
|
JMPIjvm::checkException(env); |
|
|
|
jobject jProp = env->CallObjectMethod(jVecOut,JMPIjvm::jv.VectorElementAt,i); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jpRef = env->CallLongMethod(jProp,JMPIjvm::jv.CIMPropertyCInst); |
|
CIMProperty *p = DEBUG_ConvertJavaToC (jlong, CIMProperty*, jpRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
handler.deliverParamValue(CIMParamValue(p->getName().getString(),p->getValue())); |
|
} |
|
|
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleInvokeMethodRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
int LocateIndicationProviderNames(const CIMInstance& pInstance, const CIMInstance& pmInstance, |
|
String& providerName, String& location) |
|
{ |
|
Uint32 pos = pInstance.findProperty(CIMName ("Name")); |
|
pInstance.getProperty(pos).getValue().get(providerName); |
|
|
|
pos = pmInstance.findProperty(CIMName ("Location")); |
|
pmInstance.getProperty(pos).getValue().get(location); |
|
return 0; |
|
} |
|
|
|
WQLSelectStatement * |
|
newSelectExp (String& query, |
|
String& queryLanguage) |
|
{ |
|
WQLSelectStatement *stmt = new WQLSelectStatement (queryLanguage, query); |
|
|
|
try |
|
{ |
|
WQLParser::parse (query, *stmt); |
|
} |
|
catch (const Exception &e) |
|
{ |
|
cerr << "Error: newSelectExp caught: " << e.getMessage () << endl; |
|
} |
|
|
|
return stmt; |
|
} |
|
|
|
Message * JMPIProviderManager::handleCreateSubscriptionRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleCreateSubscriptionRequest"); |
|
|
|
HandlerIntroInd(CreateSubscription,message,request,response,handler); |
|
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_EVENTPROVIDER, |
|
METHOD_EVENTPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
|
|
try { |
|
String fileName, |
|
providerName, |
|
providerLocation; |
|
CIMInstance req_provider, |
|
req_providerModule; |
|
ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME); |
|
|
|
req_provider = pidc.getProvider (); |
|
req_providerModule = pidc.getModule (); |
|
|
|
LocateIndicationProviderNames (req_provider, |
|
req_providerModule, |
|
providerName, |
|
providerLocation); |
|
|
|
fileName = resolveFileName (providerLocation); |
|
|
|
Logger::put (Logger::STANDARD_LOG, |
|
System::CIMSERVER, |
|
Logger::TRACE, |
|
"JMPIProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
providerName); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: hostname = " |
|
<<System::getHostName() |
|
<<", namespace = " |
|
<<request->nameSpace.getString() |
|
<<", providername = " |
|
<<providerName |
|
<<", fileName = " |
|
<<fileName |
|
<<PEGASUS_STD(endl)); |
|
|
|
// get cached or load new provider module |
|
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (fileName, |
|
providerName, |
|
String::EMPTY); |
|
|
|
// |
|
// Save the provider instance from the request |
|
// |
|
ph.GetProvider ().setProviderInstance (req_provider); |
|
|
|
JMPIProvider &pr = ph.GetProvider (); |
|
|
|
// |
|
// Increment count of current subscriptions for this provider |
|
// |
|
pr.testIfZeroAndIncrementSubscriptions (); |
|
|
|
SubscriptionFilterConditionContainer sub_cntr = request->operationContext.get (SubscriptionFilterConditionContainer::NAME); |
|
indProvRecord *prec = NULL; |
|
bool fNewPrec = false; |
|
|
|
{ |
|
AutoMutex lock (mutexProvTab); |
|
|
|
provTab.lookup (providerName, prec); |
|
|
|
if (!prec) |
|
{ |
|
fNewPrec = true; |
|
|
|
prec = new indProvRecord (); |
|
|
|
// convert arguments |
|
prec->ctx = new OperationContext (); |
|
|
|
prec->ctx->insert (request->operationContext.get (IdentityContainer::NAME)); |
|
prec->ctx->insert (request->operationContext.get (AcceptLanguageListContainer::NAME)); |
|
prec->ctx->insert (request->operationContext.get (ContentLanguageListContainer::NAME)); |
|
prec->ctx->insert (request->operationContext.get (SubscriptionInstanceContainer::NAME)); |
|
prec->ctx->insert (request->operationContext.get (SubscriptionFilterConditionContainer::NAME)); |
|
|
|
prec->enabled = true; |
|
|
|
prec->handler = new EnableIndicationsResponseHandler (0, |
|
0, |
|
req_provider, |
|
_indicationCallback, |
|
_responseChunkCallback); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: Adding to provTab "<<providerName<<PEGASUS_STD(endl)); |
|
|
|
provTab.insert (providerName, prec); |
|
} |
|
} |
|
|
|
{ |
|
AutoMutex lock (prec->mutex); |
|
|
|
prec->count++; |
|
} |
|
|
|
// Add a selection record for JNI CIMOMHandle deliverEvent calls |
|
indSelectRecord *srec = new indSelectRecord (); |
|
|
|
{ |
|
srec->query = request->query; |
|
srec->queryLanguage = sub_cntr.getQueryLanguage (); |
|
srec->propertyList = request->propertyList; |
|
|
|
CIMOMHandleQueryContext *qContext = new CIMOMHandleQueryContext (CIMNamespaceName (request->nameSpace.getString ()), |
|
*pr._cimom_handle); |
|
srec->qContext = qContext; |
|
|
|
CIMObjectPath sPath (request->subscriptionInstance.getPath ().getClassName ().getString ()); |
|
|
|
sPath.setNameSpace (request->subscriptionInstance.getPath ().getNameSpace ()); |
|
|
|
AutoMutex lock (mutexSelxTab); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: Adding to selxTab "<<sPath.toString ()<<PEGASUS_STD(endl)); |
| |
PEG_METHOD_EXIT(); |
selxTab.insert (sPath.toString (), srec); |
| |
return(response); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: For selxTab "<<sPath.toString ()<<", srec = "<<PEGASUS_STD(hex)<<(long)srec<<PEGASUS_STD(dec)<<", qContext = "<<PEGASUS_STD(hex)<<(long)qContext<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
} | } |
| |
int LocateIndicationProviderNames(const CIMInstance& pInstance, const CIMInstance& pmInstance, |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.createSubscriptionRequest: " + pr.getName()); |
String& providerName, String& location) |
|
{ |
|
Uint32 pos = pInstance.findProperty(CIMName ("Name")); |
|
pInstance.getProperty(pos).getValue().get(providerName); |
|
| |
pos = pmInstance.findProperty(CIMName ("Location")); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: Calling provider createSubscriptionRequest: "<<pr.getName()<<PEGASUS_STD(endl)); |
pmInstance.getProperty(pos).getValue().get(location); |
|
return 0; |
|
} |
|
| |
Message * JMPIProviderManager::handleCreateSubscriptionRequest(const Message * message) throw() |
JvmVector *jv = 0; |
|
|
|
env = JMPIjvm::attachThread(&jv); |
|
|
|
if (!env) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleCreateSubscriptionRequest"); |
PEG_METHOD_EXIT(); |
| |
HandlerIntroInd(CreateSubscription,message,request,response, |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
handler); |
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
JNIEnv *env=NULL; |
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
try { |
} |
const CIMObjectPath &x=request->subscriptionInstance.getPath(); |
|
| |
String providerName,providerLocation; |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
CIMInstance req_provider, req_providerModule; |
|
ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME); |
|
req_provider = pidc.getProvider(); |
|
req_providerModule = pidc.getModule(); |
|
LocateIndicationProviderNames(req_provider, req_providerModule,providerName,providerLocation); |
|
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
jmethodID id = NULL; |
"JMPIProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2", |
String interfaceType; |
System::getHostName(), |
String interfaceVersion; |
request->nameSpace.getString(), |
|
providerName); |
getInterfaceType (pidc, |
|
interfaceType, |
|
interfaceVersion); |
| |
String fileName = resolveFileName(providerLocation); |
if (interfaceType == "JMPI") |
|
{ |
|
// public void activateFilter (org.pegasus.jmpi.SelectExp filter, |
|
// java.lang.String eventType, |
|
// org.pegasus.jmpi.CIMObjectPath classPath, |
|
// boolean firstActivation) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID ((jclass)pr.jProviderClass, |
|
"activateFilter", |
|
"(Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;Lorg/pegasus/jmpi/CIMObjectPath;Z)V"); |
| |
// get cached or load new provider module |
if (id != NULL) |
JMPIProvider::OpProviderHolder ph = |
{ |
providerManager.getProvider(fileName, providerName, String::EMPTY); |
eMethodFound = METHOD_EVENTPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: found METHOD_EVENTPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public void activateFilter (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.SelectExp filter, |
|
// java.lang.String eventType, |
|
// org.pegasus.jmpi.CIMObjectPath classPath, |
|
// boolean firstActivation) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID ((jclass)pr.jProviderClass, |
|
"activateFilter", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;Lorg/pegasus/jmpi/CIMObjectPath;Z)V"); |
| |
indProvRecord *prec=NULL; |
if (id != NULL) |
provTab.lookup(providerName,prec); |
{ |
if (prec) prec->count++; |
eMethodFound = METHOD_EVENTPROVIDER2; |
else { |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: found METHOD_EVENTPROVIDER2."<<PEGASUS_STD(endl)); |
prec=new indProvRecord(); |
} |
provTab.insert(providerName,prec); |
|
} | } |
| |
indSelectRecord *srec=new indSelectRecord(); |
if (id == NULL) |
const CIMObjectPath &sPath=request->subscriptionInstance.getPath(); |
{ |
selxTab.insert(sPath.toString(),srec); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
// convert arguments |
PEG_METHOD_EXIT(); |
OperationContext *context=new OperationContext(); |
|
| |
if (prec->ctx==NULL) { |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
prec->ctx=context; |
MessageLoaderParms ("ProviderManager.JMPI.METHOD_NOT_FOUND", |
|
"Could not find a method for the provider based on InterfaceType.")); |
} | } |
| |
context->insert(request->operationContext.get(IdentityContainer::NAME)); |
JMPIjvm::checkException(env); |
context->insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context->insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
switch (eMethodFound) |
context->insert(request->operationContext.get(SubscriptionInstanceContainer::NAME)); |
{ |
context->insert(request->operationContext.get(SubscriptionLanguageListContainer::NAME)); |
case METHOD_EVENTPROVIDER: |
context->insert(request->operationContext.get(SubscriptionFilterConditionContainer::NAME)); |
{ |
|
WQLSelectStatement *stmt = newSelectExp (srec->query, |
|
srec->queryLanguage); |
|
jlong jStmtRef = DEBUG_ConvertCToJava (WQLSelectStatement *, jlong, stmt); |
|
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewJ,jStmtRef); |
| |
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
JMPIjvm::checkException(env); |
| |
SubscriptionFilterConditionContainer sub_cntr = request->operationContext.get |
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
(SubscriptionFilterConditionContainer::NAME); |
|
| |
CMPI_SelectExp *eSelx=new CMPI_SelectExp(*context,request->query, |
JMPIjvm::checkException(env); |
sub_cntr.getQueryLanguage()); |
|
srec->eSelx=eSelx; |
|
| |
JMPIProvider & pr=ph.GetProvider(); |
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0]); |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JMPIjvm::checkException(env); |
"Calling provider.createSubscriptionRequest: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::createSubscriptionRequest"<<endl); |
StatProviderTimeMeasurement providerTime(response); |
| |
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) { |
env->CallVoidMethod ((jobject)pr.jProvider, |
CIMObjectPath className( |
id, |
System::getHostName(), |
jSelectExp, |
request->nameSpace, |
jType, |
request->classNames[i]); |
jcop, |
eSelx->classNames.append(className); |
(jboolean)fNewPrec); |
} |
|
| |
CIMPropertyList propertyList = request->propertyList; |
JMPIjvm::checkException(env); |
if (!propertyList.isNull()) { |
break; |
Array<CIMName> p=propertyList.getPropertyNameArray(); |
|
int pCount=p.size(); |
|
eSelx->props=(const char**)malloc((1+pCount)*sizeof(char*)); |
|
for (int i=0; i<pCount; i++) { |
|
eSelx->props[i]=strdup(p[i].getString().getCString()); |
|
} |
|
eSelx->props[pCount]=NULL; |
|
} | } |
| |
JvmVector *jv; |
case METHOD_EVENTPROVIDER2: |
env=JMPIjvm::attachThread(&jv); |
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
jobject jSel=env->NewObject(jv->SelectExpClassRef, |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
jv->SelectExpNewI,(jint)eSelx); |
srec->queryLanguage); |
JMPIjvm::checkException(env); |
jlong jStmtRef = DEBUG_ConvertCToJava (WQLSelectStatement *, jlong, stmt); |
|
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewJ,jStmtRef); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&eSelx->classNames[0]); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jstring jType=env->NewStringUTF(request->nameSpace.getString().getCString()); | jstring jType=env->NewStringUTF(request->nameSpace.getString().getCString()); |
JMPIjvm::checkException(env); |
|
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
JMPIjvm::checkException(env); |
| |
STAT_GETSTARTTIME; |
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0]); |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"activateFilter", |
|
"(Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;" |
|
"Lorg/pegasus/jmpi/CIMObjectPath;Z)V"); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
env->CallVoidMethod((jobject)pr.jProvider,id,jSel,jType, |
StatProviderTimeMeasurement providerTime(response); |
jRef,(jboolean)0); |
|
|
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jSelectExp, |
|
jType, |
|
jcop, |
|
(jboolean)fNewPrec); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
break; |
|
} |
| |
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
| |
|
if (env) JMPIjvm::detachThread(); |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); | return(response); |
|
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleDeleteSubscriptionRequest"); | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleDeleteSubscriptionRequest"); |
| |
HandlerIntroInd(DeleteSubscription,message,request,response, |
HandlerIntroInd(DeleteSubscription,message,request,response,handler); |
handler); |
|
|
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_EVENTPROVIDER, |
|
METHOD_EVENTPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
JNIEnv *env=NULL; | JNIEnv *env=NULL; |
|
bool fFreePrec = false; |
|
indProvRecord *prec = NULL; |
|
indSelectRecord *srec = NULL; |
|
|
try { | try { |
String providerName,providerLocation; |
String fileName, |
CIMInstance req_provider, req_providerModule; |
providerName, |
|
providerLocation; |
|
CIMInstance req_provider, |
|
req_providerModule; |
ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME); | ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME); |
|
|
req_provider = pidc.getProvider(); | req_provider = pidc.getProvider(); |
req_providerModule = pidc.getModule(); | req_providerModule = pidc.getModule(); |
| |
LocateIndicationProviderNames(req_provider, req_providerModule, |
LocateIndicationProviderNames (req_provider, |
providerName,providerLocation); |
req_providerModule, |
|
providerName, |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
providerLocation); |
|
|
|
fileName = resolveFileName (providerLocation); |
|
|
|
Logger::put (Logger::STANDARD_LOG, |
|
System::CIMSERVER, |
|
Logger::TRACE, |
"JMPIProviderManager::handleDeleteSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2", | "JMPIProviderManager::handleDeleteSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2", |
System::getHostName(), | System::getHostName(), |
request->nameSpace.getString(), | request->nameSpace.getString(), |
providerName); | providerName); |
| |
String fileName = resolveFileName(providerLocation); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: hostname = " |
|
<<System::getHostName() |
|
<<", namespace = " |
|
<<request->nameSpace.getString() |
|
<<", providername = " |
|
<<providerName |
|
<<", fileName = " |
|
<<fileName |
|
<<PEGASUS_STD(endl)); |
| |
// get cached or load new provider module | // get cached or load new provider module |
JMPIProvider::OpProviderHolder ph = |
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (fileName, |
providerManager.getProvider(fileName, providerName, String::EMPTY); |
providerName, |
|
String::EMPTY); |
| |
|
JMPIProvider &pr = ph.GetProvider (); |
|
|
|
{ |
|
AutoMutex lock (mutexProvTab); |
| |
indProvRecord *prec=NULL; |
|
provTab.lookup(providerName,prec); | provTab.lookup(providerName,prec); |
if (--prec->count<=0) { |
} |
|
|
|
{ |
|
AutoMutex lock (prec->mutex); |
|
|
|
if (--prec->count <= 0) |
|
{ |
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: Removing provTab "<<providerName<<PEGASUS_STD(endl)); |
|
|
provTab.remove(providerName); | provTab.remove(providerName); |
prec=NULL; |
|
|
fFreePrec = true; |
|
} |
} | } |
| |
indSelectRecord *srec=NULL; |
{ |
const CIMObjectPath &sPath=request->subscriptionInstance.getPath(); |
CIMObjectPath sPath (request->subscriptionInstance.getPath ().getClassName ().getString ()); |
String sPathString=sPath.toString(); |
|
selxTab.lookup(sPathString,srec); |
|
| |
CMPI_SelectExp *eSelx=srec->eSelx; |
sPath.setNameSpace (request->subscriptionInstance.getPath ().getNameSpace ()); |
selxTab.remove(sPathString); |
|
| |
// convert arguments |
String sPathString = sPath.toString (); |
OperationContext context; |
|
| |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
AutoMutex lock (mutexSelxTab); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
context.insert(request->operationContext.get(SubscriptionInstanceContainer::NAME)); |
|
context.insert(request->operationContext.get(SubscriptionLanguageListContainer::NAME)); |
|
| |
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: Removing selxTab "<<sPathString<<PEGASUS_STD(endl)); |
| |
JMPIProvider & pr=ph.GetProvider(); |
selxTab.lookup (sPathString, srec); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: For selxTab "<<sPathString<<", srec = "<<PEGASUS_STD(hex)<<(long)srec<<PEGASUS_STD(dec)<<", qContext = "<<PEGASUS_STD(hex)<<(long)srec->qContext<<PEGASUS_STD(dec)<<PEGASUS_STD(endl)); |
"Calling provider.deleteSubscriptionRequest: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::deleteSubscriptionRequest"<<endl); |
selxTab.remove (sPathString); |
|
} |
| |
JvmVector *jv; |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.deleteSubscriptionRequest: " + pr.getName()); |
env=JMPIjvm::attachThread(&jv); |
|
| |
jobject jSel=env->NewObject(jv->SelectExpClassRef, |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: Calling provider deleteSubscriptionRequest: "<<pr.getName()<<PEGASUS_STD(endl)); |
jv->SelectExpNewI,(jint)eSelx); |
|
JMPIjvm::checkException(env); |
|
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
JvmVector *jv = 0; |
jv->CIMObjectPathNewI,(jint)&eSelx->classNames[0]); |
|
JMPIjvm::checkException(env); |
|
| |
jstring jType=env->NewStringUTF(request->nameSpace.getString().getCString()); |
env = JMPIjvm::attachThread(&jv); |
JMPIjvm::checkException(env); |
|
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
if (!env) |
|
{ |
|
PEG_METHOD_EXIT(); |
| |
STAT_GETSTARTTIME; |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
|
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
|
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
|
} |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"deActivateFilter", |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
"(Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;" |
|
"Lorg/pegasus/jmpi/CIMObjectPath;Z)V"); |
|
JMPIjvm::checkException(env); |
|
| |
env->CallVoidMethod((jobject)pr.jProvider,id,jSel,jType, |
jmethodID id = NULL; |
jRef,(jboolean)(prec==NULL)); |
String interfaceType; |
JMPIjvm::checkException(env); |
String interfaceVersion; |
|
|
|
getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME), |
|
interfaceType, |
|
interfaceVersion); |
| |
STAT_PMS_PROVIDEREND; |
if (interfaceType == "JMPI") |
|
{ |
|
// public void deActivateFilter (org.pegasus.jmpi.SelectExp filter, |
|
// java.lang.String eventType, |
|
// org.pegasus.jmpi.CIMObjectPath classPath, |
|
// boolean lastActivation) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"deActivateFilter", |
|
"(Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;Lorg/pegasus/jmpi/CIMObjectPath;Z)V"); |
| |
delete eSelx; |
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_EVENTPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: found METHOD_EVENTPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
// public void deActivateFilter (org.pegasus.jmpi.OperationContext oc, |
|
// org.pegasus.jmpi.SelectExp filter, |
|
// java.lang.String eventType, |
|
// org.pegasus.jmpi.CIMObjectPath classPath, |
|
// boolean lastActivation) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"deActivateFilter", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/SelectExp;Ljava/lang/String;Lorg/pegasus/jmpi/CIMObjectPath;Z)V"); |
| |
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_EVENTPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: found METHOD_EVENTPROVIDER2."<<PEGASUS_STD(endl)); |
} | } |
HandlerCatch(handler); |
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
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.")); |
} | } |
| |
Message * JMPIProviderManager::handleEnableIndicationsRequest(const Message * message) throw() |
JMPIjvm::checkException(env); |
|
|
|
switch (eMethodFound) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager:: handleEnableIndicationsRequest"); |
case METHOD_EVENTPROVIDER: |
|
{ |
|
WQLSelectStatement *stmt = newSelectExp (srec->query, |
|
srec->queryLanguage); |
|
jlong jStmtRef = DEBUG_ConvertCToJava (WQLSelectStatement *, jlong, stmt); |
|
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewJ,jStmtRef); |
| |
HandlerIntroInd(EnableIndications,message,request,response, |
JMPIjvm::checkException(env); |
handler); |
|
try { |
|
String providerName,providerLocation; |
|
CIMInstance req_provider, req_providerModule; |
|
ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME); |
|
req_provider = pidc.getProvider(); |
|
req_providerModule = pidc.getModule(); |
|
| |
LocateIndicationProviderNames(req_provider, req_providerModule, |
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
providerName,providerLocation); |
|
| |
indProvRecord *provRec; |
JMPIjvm::checkException(env); |
if (provTab.lookup(providerName,provRec)) { |
|
provRec->enabled=true; |
|
provRec->handler=new EnableIndicationsResponseHandler( |
|
request, response, req_provider, _indicationCallback); |
|
} |
|
| |
String fileName = resolveFileName(providerLocation); |
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0]); |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
// get cached or load new provider module |
JMPIjvm::checkException(env); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(fileName, providerName, String::EMPTY); |
|
| |
} |
StatProviderTimeMeasurement providerTime(response); |
HandlerCatch(handler); |
|
| |
PEG_METHOD_EXIT(); |
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
jSelectExp, |
|
jType, |
|
jcop, |
|
(jboolean)fFreePrec); |
| |
return(response); |
JMPIjvm::checkException(env); |
|
break; |
} | } |
| |
Message * JMPIProviderManager::handleDisableIndicationsRequest(const Message * message) throw() |
case METHOD_EVENTPROVIDER2: |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager:: handleDisableIndicationsRequest"); |
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
HandlerIntroInd(DisableIndications,message,request,response, |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
handler); |
srec->queryLanguage); |
try { |
jlong jStmtRef = DEBUG_ConvertCToJava (WQLSelectStatement *, jlong, stmt); |
String providerName,providerLocation; |
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewJ,jStmtRef); |
CIMInstance req_provider, req_providerModule; |
|
ProviderIdContainer pidc = (ProviderIdContainer)request->operationContext.get(ProviderIdContainer::NAME); |
|
| |
req_provider = pidc.getProvider(); |
JMPIjvm::checkException(env); |
req_providerModule = pidc.getModule(); |
|
|
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0]); |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jSelectExp, |
|
jType, |
|
jcop, |
|
(jboolean)fFreePrec); |
|
|
|
JMPIjvm::checkException(env); |
| |
LocateIndicationProviderNames(req_provider, req_providerModule, |
if (joc) |
providerName,providerLocation); |
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
indProvRecord *provRec; |
JMPIjvm::checkException(env); |
if (provTab.lookup(providerName,provRec)) { |
} |
provRec->enabled=false; |
break; |
if (provRec->handler) delete provRec->handler; |
|
provRec->handler=NULL; |
|
} | } |
| |
String fileName = resolveFileName(providerLocation); |
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
| |
// get cached or load new provider module |
// |
JMPIProvider::OpProviderHolder ph = |
// Decrement count of current subscriptions for this provider |
providerManager.getProvider(fileName, providerName, String::EMPTY); |
// |
|
pr.decrementSubscriptionsAndTestIfZero (); |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
| |
|
if (srec) |
|
{ |
|
delete srec->qContext; |
|
} |
|
delete srec; |
|
|
|
if (fFreePrec) |
|
{ |
|
delete prec->ctx; |
|
delete prec->handler; |
|
delete prec; |
|
} |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); | return(response); |
|
|
| |
PEGASUS_ASSERT(response != 0); | PEGASUS_ASSERT(response != 0); |
| |
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// | // |
// Set HTTP method in response from request | // Set HTTP method in response from request |
// | // |
|
|
| |
PEGASUS_ASSERT(response != 0); | PEGASUS_ASSERT(response != 0); |
| |
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request | // Set HTTP method in response from request |
response->setHttpMethod (request->getHttpMethod ()); | response->setHttpMethod (request->getHttpMethod ()); |
| |
|
|
| |
PEGASUS_ASSERT(response != 0); | PEGASUS_ASSERT(response != 0); |
| |
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request | // Set HTTP method in response from request |
response->setHttpMethod (request->getHttpMethod ()); | response->setHttpMethod (request->getHttpMethod ()); |
| |
|
|
request->operationContext.get(ProviderIdContainer::NAME)); | request->operationContext.get(ProviderIdContainer::NAME)); |
| |
// get cached or load new provider module | // get cached or load new provider module |
JMPIProvider::OpProviderHolder ph = |
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (name.getPhysicalName(), |
providerManager.getProvider(name.getPhysicalName(), |
name.getLogicalName(), |
name.getLogicalName(), String::EMPTY); |
String::EMPTY); |
| |
} | } |
HandlerCatch(handler); | HandlerCatch(handler); |
|
|
return(response); | return(response); |
} | } |
| |
Message * JMPIProviderManager::handleUnsupportedRequest(const Message * message) throw() |
Message * JMPIProviderManager::handleSubscriptionInitCompleteRequest (const Message * message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"JMPIProviderManager::handleUnsupportedRequest"); |
"JMPIProviderManager::handleSubscriptionInitCompleteRequest"); |
|
|
|
CIMSubscriptionInitCompleteRequestMessage * request = |
|
dynamic_cast <CIMSubscriptionInitCompleteRequestMessage *> |
|
(const_cast <Message *> (message)); |
|
|
|
PEGASUS_ASSERT (request != 0); |
|
|
|
CIMSubscriptionInitCompleteResponseMessage * response = |
|
dynamic_cast <CIMSubscriptionInitCompleteResponseMessage *> |
|
(request->buildResponse ()); |
|
|
|
PEGASUS_ASSERT (response != 0); |
|
|
|
// |
|
// Set indicator |
|
// |
|
_subscriptionInitComplete = true; |
|
|
|
// |
|
// For each provider that has at least one subscription, call |
|
// provider's enableIndications method |
|
// |
|
Array <JMPIProvider *> enableProviders; |
|
|
|
enableProviders = providerManager.getIndicationProvidersToEnable (); |
|
|
|
Uint32 numProviders = enableProviders.size (); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSubscriptionInitCompleteRequest: numProviders = "<<numProviders<<PEGASUS_STD(endl)); |
|
|
|
#if 0 |
|
for (Uint32 i = 0; i < numProviders; i++) |
|
{ |
|
try |
|
{ |
|
CIMInstance provider; |
|
|
|
provider = enableProviders[i]->getProviderInstance (); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleSubscriptionInitCompleteRequest: name = "<<enableProviders[i]->getName ()<<PEGASUS_STD(endl)); |
|
|
|
// |
|
// Get cached or load new provider module |
|
// |
|
JMPIProvider::OpProviderHolder ph = providerManager.getProvider (enableProviders[i]->getModule ()->getFileName (), |
|
enableProviders[i]->getName ()); |
|
indProvRecord *prec = NULL; |
|
|
|
{ |
|
AutoMutex lock (mutexProvTab); |
|
|
|
provTab.lookup (enableProviders[i]->getName (), prec); |
|
} |
|
} |
|
catch (CIMException & e) |
|
{ |
|
PEG_TRACE_STRING (TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"CIMException: " + e.getMessage ()); |
|
} |
|
catch (Exception & e) |
|
{ |
|
PEG_TRACE_STRING (TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Exception: " + e.getMessage ()); |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_CSTRING (TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unknown error in handleSubscriptionInitCompleteRequest"); |
|
} |
|
} |
|
#endif |
|
|
|
PEG_METHOD_EXIT (); |
|
return (response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleUnsupportedRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleUnsupportedRequest"); |
|
|
CIMRequestMessage* request = | CIMRequestMessage* request = |
dynamic_cast<CIMRequestMessage *>(const_cast<Message *>(message)); | dynamic_cast<CIMRequestMessage *>(const_cast<Message *>(message)); |
PEGASUS_ASSERT(request != 0 ); | PEGASUS_ASSERT(request != 0 ); |
|
|
| |
String JMPIProviderManager::resolveFileName(String fileName) | String JMPIProviderManager::resolveFileName(String fileName) |
{ | { |
String name; |
String name = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
// physfilename = everything up to the delimiter pointing at class start |
name = fileName; // + String(".dll"); |
// in case there is no delimiter anymore, it takes the entire filename |
#elif defined(PEGASUS_OS_HPUX) && defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
String physfilename = fileName.subString(0, fileName.find(":")); |
name = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
// look in all(multiple) homed pathes for the physical file |
name.append(String("/") + fileName); // + String(".sl")); |
name = FileSystem::getAbsoluteFileName(name, physfilename); |
#elif defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
// construct back the fully specified jar:<classname> provider name |
name = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
name = FileSystem::extractFilePath(name) + fileName; |
name.append(String("/") + fileName); // + String(".so")); |
|
#elif defined(PEGASUS_OS_OS400) |
|
name = filrName; |
|
#else |
|
name = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
name.append(String("/") + fileName); // + String(".so")); |
|
#endif |
|
return name; | return name; |
} | } |
| |