version 1.6, 2004/06/04 02:23:59
|
version 1.59, 2006/11/02 16:58:29
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%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. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// 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: |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "JMPIProviderManager.h" | #include "JMPIProviderManager.h" |
|
|
| |
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
#include <Pegasus/Common/OperationContext.h> | #include <Pegasus/Common/OperationContext.h> |
#include <Pegasus/Common/Destroyer.h> |
|
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/StatisticalData.h> | #include <Pegasus/Common/StatisticalData.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/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> |
|
|
| |
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 (); |
|
|
|
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); |
|
} |
|
} |
|
} |
| |
#define DDD(x) if (_jmpi_trace) x; |
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; |
|
|
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
response = handleSetPropertyRequest(request); |
break; | break; |
/* case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
|
response = handleInvokeMethodRequest(request); |
|
| |
|
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
|
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: |
|
response = handleModifySubscriptionRequest(request); |
|
| |
|
/* case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
|
response = handleModifySubscriptionRequest(request); |
break; | break; |
|
*/ |
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: | case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleDeleteSubscriptionRequest(request); | response = handleDeleteSubscriptionRequest(request); |
|
|
break; |
|
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
|
response = handleEnableIndicationsRequest(request); |
|
|
|
break; | break; |
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
|
response = handleDisableIndicationsRequest(request); |
|
| |
|
/* case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
|
response = handleExportIndicationRequest(request); |
break; | break; |
case CIM_CONSUME_INDICATION_REQUEST_MESSAGE: |
*/ |
response = handleConsumeIndicationRequest(request); |
|
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: |
cout<<"*** Unsupported Request ??"<<request->getType()<<endl; |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
asm("int $3"); |
"*** 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, "Unknown error."); \ | handler.setStatus(CIM_ERR_FAILED, "Unknown error."); \ |
} | } |
| |
|
static jobjectArray getList(JvmVector *jv, JNIEnv *env, CIMPropertyList &list) |
|
{ |
|
Uint32 s=list.size(); |
|
jobjectArray pl=NULL; |
|
if (s) { |
|
jstring initial=env->NewString(NULL,0); |
|
pl=(jobjectArray)env->NewObjectArray(s,jv->StringClassRef,initial); |
|
for (Uint32 i=0; i<s; i++) { |
|
env->SetObjectArrayElement |
|
(pl,i,env->NewStringUTF(list[i].getString().getCString())); |
|
} |
|
} |
|
return pl; |
|
} |
| |
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; |
|
|
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"JMPIProviderManager::handleGetInstanceRequest - Host name: $0 Name space: $1 Class name: $2", | "JMPIProviderManager::handleGetInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
|
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 cc=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); |
| |
STAT_GETSTARTTIME; |
jmethodID id = NULL; |
|
String interfaceType; |
|
String interfaceVersion; |
|
|
|
getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME), |
|
interfaceType, |
|
interfaceVersion); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"getInstance", |
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;"); |
JMPIjvm::checkException(env); |
|
jobject inst=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,cc,true); |
|
| |
STAT_PMS_PROVIDEREND; |
if (id != NULL) |
|
{ |
JMPIjvm::checkException(env); |
eMethodFound = METHOD_INSTANCEPROVIDER; |
handler.processing(); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
if (inst) { |
|
CIMInstance *ci=((CIMInstance*)env->CallIntMethod(inst,JMPIjvm::jv.CIMInstanceCInst)); |
|
handler.deliver(*ci); |
|
} |
|
handler.complete(); |
|
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
| |
PEG_METHOD_EXIT(); |
// public org.pegasus.jmpi.CIMInstance getInstance (org.pegasus.jmpi.CIMObjectPath op, |
|
// boolean localOnly, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList, |
|
// org.pegasus.jmpi.CIMClass cc) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"getInstance", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;ZZZ[Ljava/lang/String;Lorg/pegasus/jmpi/CIMClass;)Lorg/pegasus/jmpi/CIMInstance;"); |
| |
return(response); |
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
} | } |
|
} |
Message * JMPIProviderManager::handleEnumerateInstancesRequest(const Message * message) throw() |
} |
|
else if (interfaceType == "JMPIExperimental") |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
/* Fix for 4238 */ |
"JMPIProviderManager::handleEnumerateInstanceRequest"); |
// public org.pegasus.jmpi.CIMInstance getInstance (org.pegasus.jmpi.OperationContext oc |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
HandlerIntro(EnumerateInstances,message,request,response, |
// org.pegasus.jmpi.CIMClass cimClass, |
handler,Array<CIMInstance>()); |
// boolean includeQualifiers, |
JNIEnv *env=NULL; |
// boolean includeClassOrigin, |
try { |
// String propertyList[]) |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
// throws org.pegasus.jmpi.CIMException |
"JMPIProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2", |
id = env->GetMethodID((jclass)pr.jProviderClass, |
System::getHostName(), |
"getInstance", |
request->nameSpace.getString(), |
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;ZZ[Ljava/lang/String;)Lorg/pegasus/jmpi/CIMInstance;"); |
request->className.getString()); |
|
| |
// make target object path |
if (id != NULL) |
CIMObjectPath objectPath( |
{ |
System::getHostName(), |
eMethodFound = METHOD_INSTANCEPROVIDER2; |
request->nameSpace, |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
request->className); |
} |
|
/* Fix for 4238 */ |
|
} |
| |
// resolve provider name |
if (id == NULL) |
ProviderName name = _resolveProviderName( |
{ |
request->operationContext.get(ProviderIdContainer::NAME)); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
// get cached or load new provider module |
PEG_METHOD_EXIT(); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), |
|
String::EMPTY); |
|
| |
// convert arguments |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
OperationContext context; |
MessageLoaderParms ("ProviderManager.JMPI.METHOD_NOT_FOUND", |
|
"Could not find a method for the provider based on InterfaceType.")); |
|
} |
| |
context.insert(IdentityContainer(request->userName)); |
JMPIjvm::checkException(env); |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
CIMPropertyList propertyList(request->propertyList); |
switch (eMethodFound) |
|
{ |
|
case METHOD_CIMINSTANCEPROVIDER: |
|
{ |
|
jlong jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef); |
| |
// forward request |
JMPIjvm::checkException(env); |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
CIMClass cls; |
"Calling provider.enumerateInstances: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::enumerateInstances"<<endl); |
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; |
|
} |
| |
JvmVector *jv; |
CIMClass *pcls = new CIMClass (cls); |
env=JMPIjvm::attachThread(&jv); |
|
| |
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, |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
request->className, |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
false,true,true,CIMPropertyList()); |
|
JMPIjvm::checkException(env); |
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,(jint)&cls); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
STAT_GETSTARTTIME; |
StatProviderTimeMeasurement providerTime(response); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"enumInstances", |
jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider, |
"(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;Z)Ljava/util/Vector;"); |
id, |
JMPIjvm::checkException(env); |
jop, |
|
JMPI_LOCALONLY, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList, |
|
jcimClass); |
| |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,false,jCc,true); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
|
|
|
handler.processing(); | 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); |
|
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
JMPIjvm::checkException(env); |
|
| |
// const CIMObjectPath& op=inst.getPath(); |
if (jciRet) { |
// CIMObjectPath iop=inst.buildPath(cls); |
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
// iop.setNameSpace(op.getNameSpace()); |
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
// inst.setPath(iop); |
|
| |
handler.deliver(inst); |
handler.deliver(*ciRet); |
} |
|
} | } |
handler.complete(); | handler.complete(); |
|
break; |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
/* Fix for 4238 */ |
|
case METHOD_INSTANCEPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
PEG_METHOD_EXIT(); |
jlong jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef); |
| |
return(response); |
JMPIjvm::checkException(env); |
} |
|
| |
Message * JMPIProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw() |
CIMClass cls; |
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleEnumerateInstanceNamesRequest"); |
|
| |
HandlerIntro(EnumerateInstanceNames,message,request,response, |
try |
handler,Array<CIMObjectPath>()); |
{ |
JNIEnv *env=NULL; |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl)); |
try { |
AutoMutex lock (pr._cimomMutex); |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"JMPIProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->className.getString()); |
|
| |
// make target object path |
cls = pr._cimom_handle->getClass(context, |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->className); |
request->instanceName.getClassName(), |
|
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->instanceName.getClassName()<<PEGASUS_STD(endl)); |
// get cached or load new provider module |
} |
JMPIProvider::OpProviderHolder ph = |
catch (CIMException e) |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName()); |
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstanceRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
// convert arguments |
throw; |
OperationContext context; |
} |
| |
context.insert(IdentityContainer(request->userName)); |
CIMClass *pcls = new CIMClass (cls); |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
JMPIProvider & pr=ph.GetProvider(); |
JMPIjvm::checkException(env); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
"Calling provider.enumerateInstanceNames: " + pr.getName()); |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
| |
DDD(cerr<<"--- JMPIProviderManager::enumerateInstanceNames"<<endl); |
JMPIjvm::checkException(env); |
| |
|
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
JvmVector *jv; |
StatProviderTimeMeasurement providerTime(response); |
env=JMPIjvm::attachThread(&jv); |
|
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider, |
jv->CIMObjectPathNewI,(jint)&objectPath); |
id, |
JMPIjvm::checkException(env); |
joc, |
|
jop, |
|
jcimClass, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
| |
CIMClass cls=pr._cimom_handle->getClass(context,request->nameSpace, |
|
request->className, |
|
false,true,true,CIMPropertyList()); |
|
JMPIjvm::checkException(env); |
|
jobject jCc=env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewI,(jint)&cls); |
|
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,"enumInstances", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;)Ljava/util/Vector;"); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
|
} |
| |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,true,jCc); |
handler.processing(); |
JMPIjvm::checkException(env); |
|
| |
STAT_PMS_PROVIDEREND; |
if (jciRet) { |
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
handler.processing(); |
handler.deliver(*ciRet); |
if (jVec) { |
|
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
|
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(); | handler.complete(); |
|
break; |
} | } |
HandlerCatch(handler); |
/* Fix for 4238 */ |
| |
if (env) JMPIjvm::detachThread(); |
case METHOD_INSTANCEPROVIDER: |
|
{ |
|
jlong jopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jopRef); |
| |
PEG_METHOD_EXIT(); |
JMPIjvm::checkException(env); |
| |
return(response); |
CIMClass cls; |
} |
|
| |
Message * JMPIProviderManager::handleCreateInstanceRequest(const Message * message) throw() |
try |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->instanceName.getClassName()<<PEGASUS_STD(endl)); |
"JMPIProviderManager::handleCreateInstanceRequest"); |
AutoMutex lock (pr._cimomMutex); |
|
|
HandlerIntro(CreateInstance,message,request,response, |
|
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 |
cls = pr._cimom_handle->getClass(context, |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->newInstance.getPath().getClassName(), |
request->instanceName.getClassName(), |
request->newInstance.getPath().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->instanceName.getClassName()<<PEGASUS_STD(endl)); |
|
} |
// get cached or load new provider module |
catch (CIMException e) |
JMPIProvider::OpProviderHolder ph = |
{ |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleGetInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
String::EMPTY); |
throw; |
|
} |
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
// forward request |
|
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
CIMClass *pcls = new CIMClass (cls); |
"Calling provider.createInstance: " + |
|
ph.GetProvider().getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::createInstances"<<endl); |
JMPIjvm::checkException(env); |
| |
JvmVector *jv; |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
env=JMPIjvm::attachThread(&jv); |
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
| |
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); |
StatProviderTimeMeasurement providerTime(response); |
| |
STAT_GETSTARTTIME; |
// Modified for Bugzilla# 3679 |
|
jobject jciRet = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jop, |
|
jcimClass, |
|
JMPI_LOCALONLY); |
| |
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); |
handler.processing(); |
| |
STAT_PMS_PROVIDEREND; |
if (jciRet) { |
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
JMPIjvm::checkException(env); |
handler.deliver(*ciRet); |
handler.processing(); |
|
if (jCop) { |
|
CIMObjectPath cop=*((CIMObjectPath*)env->CallIntMethod(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
|
handler.deliver(cop); |
|
} | } |
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::handleModifyInstanceRequest(const Message * message) throw() |
Message * JMPIProviderManager::handleEnumerateInstancesRequest(const Message * message) throw() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleEnumerateInstanceRequest"); |
"JMPIProviderManager::handleModifyInstanceRequest"); |
|
|
HandlerIntro(EnumerateInstances,message,request,response,handler); |
| |
HandlerIntroVoid(ModifyInstance,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; | JNIEnv *env=NULL; |
|
|
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"DefaultProviderManager::handleModifyInstanceRequest - 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->modifiedInstance.getPath().getClassName().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->modifiedInstance.getPath ().getClassName(), |
request->className); |
request->modifiedInstance.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 | // convert arguments |
OperationContext context; | OperationContext context; |
| |
context.insert(IdentityContainer(request->userName)); |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
|
|
CIMPropertyList propertyList(request->propertyList); |
|
| |
// 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.enumerateInstances: " + pr.getName()); |
"Calling provider.modifyInstance: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::modifyInstance"<<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(); |
jobject jInst=env->NewObject(jv->CIMInstanceClassRef, |
|
jv->CIMInstanceNewI,(jint)&request->modifiedInstance); |
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.")); |
|
} |
| |
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,"setInstance", |
if (interfaceType == "JMPI") |
"(Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMInstance;)V"); |
{ |
JMPIjvm::checkException(env); |
// public abstract java.util.Vector enumInstances (org.pegasus.jmpi.CIMObjectPath cop, |
|
// boolean deep, |
|
// org.pegasus.jmpi.CIMClass cimClass, |
|
// boolean localOnly) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"enumInstances", |
|
"(Lorg/pegasus/jmpi/CIMObjectPath;ZLorg/pegasus/jmpi/CIMClass;Z)Ljava/util/Vector;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
| |
env->CallVoidMethod((jobject)pr.jProvider,id,jRef,jInst); |
if (id == NULL) |
|
{ |
|
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;"); |
| |
JMPIjvm::checkException(env); |
if (id != NULL) |
JMPIjvm::detachThread(); |
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
} | } |
HandlerCatch(handler); |
} |
|
} |
|
else if (interfaceType == "JMPIExperimental") |
|
{ |
|
/* Fix for 4189 */ |
|
// public abstract java.util.Vector enumerateInstances (org.pegasus.jmpi.OperationContext oc |
|
// org.pegasus.jmpi.CIMObjectPath cop, |
|
// org.pegasus.jmpi.CIMClass cimClass, |
|
// boolean includeQualifiers, |
|
// boolean includeClassOrigin, |
|
// java.lang.String[] propertyList) |
|
// throws org.pegasus.jmpi.CIMException |
|
id = env->GetMethodID((jclass)pr.jProviderClass, |
|
"enumerateInstances", |
|
"(Lorg/pegasus/jmpi/OperationContext;Lorg/pegasus/jmpi/CIMObjectPath;Lorg/pegasus/jmpi/CIMClass;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
| |
if (env) JMPIjvm::detachThread(); |
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
/* Fix for 4189 */ |
| |
PEG_METHOD_EXIT(); |
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
| |
return(response); |
// 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)); |
|
} |
|
} |
} | } |
| |
Message * JMPIProviderManager::handleDeleteInstanceRequest(const Message * message) throw() |
if (id == NULL) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: No method found!"<<PEGASUS_STD(endl)); |
"JMPIProviderManager::handleDeleteInstanceRequest"); |
|
| |
HandlerIntroVoid(DeleteInstance,message,request,response, |
PEG_METHOD_EXIT(); |
handler); |
|
JNIEnv *env=NULL; |
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleDeleteInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
| |
// make target object path |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
CIMObjectPath objectPath( |
MessageLoaderParms ("ProviderManager.JMPI.METHOD_NOT_FOUND", |
System::getHostName(), |
"Could not find a method for the provider based on InterfaceType.")); |
request->nameSpace, |
} |
request->instanceName.getClassName(), |
|
request->instanceName.getKeyBindings()); |
|
| |
// resolve provider name |
JMPIjvm::checkException(env); |
ProviderName name = _resolveProviderName( |
|
request->operationContext.get(ProviderIdContainer::NAME)); |
|
| |
// get cached or load new provider module |
switch (eMethodFound) |
JMPIProvider::OpProviderHolder ph = |
{ |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
case METHOD_CIMINSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
// convert arguments |
JMPIjvm::checkException(env); |
OperationContext context; |
|
| |
context.insert(IdentityContainer(request->userName)); |
CIMClass cls; |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
// forward request |
try |
JMPIProvider & pr=ph.GetProvider(); |
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
request->className, |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstancesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
CIMClass *pcls = new CIMClass (cls); |
"Calling provider.deleteInstance: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::modifyInstance"<<endl); |
JMPIjvm::checkException(env); |
| |
JvmVector *jv; |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
env=JMPIjvm::attachThread(&jv); |
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
STAT_GETSTARTTIME; |
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
JMPI_LOCALONLY, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList, |
|
jcc); |
| |
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 (jAr) { |
|
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
|
JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
jobject jciRet = env->GetObjectArrayElement(jAr,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; |
|
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 |
handler.deliver(*ciRet); |
ProviderName name = _resolveProviderName( |
} |
request->operationContext.get(ProviderIdContainer::NAME)); |
} |
|
handler.complete(); |
|
break; |
|
} |
| |
// get cached or load new provider module |
case METHOD_CIMINSTANCEPROVIDER2: |
JMPIProvider::OpProviderHolder ph = |
{ |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
// convert arguments |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
OperationContext context; |
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
context.insert(IdentityContainer(request->userName)); |
JMPIjvm::checkException(env); |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
// forward request |
CIMClass cls; |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
try |
"Calling provider.associators: " + pr.getName()); |
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
DDD(cerr<<"--- JMPIProviderManager::associators"<< |
cls = pr._cimom_handle->getClass(context, |
" role: >"<<request->role<<"< aCls "<< |
request->nameSpace, |
request->assocClass<<endl); |
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; |
|
} |
| |
JvmVector *jv; |
CIMClass *pcls = new CIMClass (cls); |
env=JMPIjvm::attachThread(&jv); |
|
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jstring rClass=env->NewStringUTF(request->resultClass.getString().getCString()); |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
jstring rRole=env->NewStringUTF(request->role.getCString()); |
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
jstring resRole=env->NewStringUTF(request->resultRole.getCString()); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
STAT_GETSTARTTIME; |
StatProviderTimeMeasurement providerTime(response); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"associators", |
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;" |
id, |
"Ljava/lang/String;ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
joc, |
|
jcop, |
|
jcc, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
if (joc) |
rClass,rRole,resRole,false,false,NULL); |
{ |
JMPIjvm::checkException(env); |
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
STAT_PMS_PROVIDEREND; |
JMPIjvm::checkException(env); |
|
} |
| |
handler.processing(); | handler.processing(); |
if (jVec) { |
if (jAr) { |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
JMPIjvm::checkException(env); |
|
jobject jInst=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,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, |
jobject jciRet = env->GetObjectArrayElement(jAr,i); |
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); |
JMPIjvm::checkException(env); |
} |
|
} |
|
handler.complete(); |
|
} |
|
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::handleAssociatorNamesRequest(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::handleAssociatorNamesRequest"); |
AutoMutex lock (pr._cimomMutex); |
| |
HandlerIntro(AssociatorNames,message,request,response, |
cls = pr._cimom_handle->getClass(context, |
handler,Array<CIMObjectPath>()); |
|
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()); |
|
|
|
// make target object path |
|
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 |
handler.deliver(*ciRet); |
ProviderName name = _resolveProviderName( |
} |
request->operationContext.get(ProviderIdContainer::NAME)); |
} |
|
handler.complete(); |
|
break; |
|
} |
| |
// get cached or load new provider module |
/* Fix for 4189 */ |
JMPIProvider::OpProviderHolder ph = |
case METHOD_INSTANCEPROVIDER2: |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
// convert arguments |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
OperationContext context; |
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
context.insert(IdentityContainer(request->userName)); |
JMPIjvm::checkException(env); |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
// forward request |
CIMClass cls; |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
try |
"Calling provider.associatorNames: " + pr.getName()); |
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
DDD(cerr<<"--- JMPIProviderManager::associatorNames"<< |
cls = pr._cimom_handle->getClass (context, |
" role: >"<<request->role<<"< aCls "<< |
request->nameSpace, |
request->assocClass<<endl); |
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; |
|
} |
| |
JvmVector *jv; |
CIMClass *pcls = new CIMClass (cls); |
env=JMPIjvm::attachThread(&jv); |
|
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
|
jv->CIMObjectPathNewI,(jint)&objectPath); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jstring rClass=env->NewStringUTF(request->resultClass.getString().getCString()); |
jlong jccRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
jstring rRole=env->NewStringUTF(request->role.getCString()); |
jobject jcc = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jccRef); |
jstring resRole=env->NewStringUTF(request->resultRole.getCString()); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
jobjectArray jPropertyList = getList(jv,env,request->propertyList); |
| |
STAT_GETSTARTTIME; |
StatProviderTimeMeasurement providerTime(response); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"associatorNames", |
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;Ljava/lang/String;" |
id, |
"Ljava/lang/String;)Ljava/util/Vector;"); |
joc, |
|
jcop, |
|
jcc, |
|
JMPI_INCLUDE_QUALIFIERS, |
|
request->includeClassOrigin, |
|
jPropertyList); |
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
if (joc) |
rClass,rRole,resRole); |
{ |
JMPIjvm::checkException(env); |
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
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 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(); |
|
} |
|
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
| |
PEG_METHOD_EXIT(); |
JMPIjvm::checkException(env); |
| |
return(response); |
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
} |
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
| |
|
/* Fix for 4237 */ |
|
CIMClass cls; |
| |
Message * JMPIProviderManager::handleReferencesRequest(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::handleReferencesRequest"); |
AutoMutex lock (pr._cimomMutex); |
|
|
HandlerIntro(References,message,request,response, |
|
handler,Array<CIMObject>()); |
|
JNIEnv *env=NULL; |
|
try { |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleReferencesRequest - 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 resultPath( |
JMPIjvm::checkException(env); |
System::getHostName(), |
|
request->nameSpace, |
|
request->resultClass.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(IdentityContainer(request->userName)); |
case METHOD_INSTANCEPROVIDER: |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
{ |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
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.references: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::references"<<" role: >"<<request->role<<"< aCls "<< |
try |
request->resultClass<<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 rRole=env->NewStringUTF(request->role.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; |
JMPIjvm::checkException(env); |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"references", |
StatProviderTimeMeasurement providerTime(response); |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;" |
|
"ZZ[Ljava/lang/String;)Ljava/util/Vector;"); |
|
| |
JMPIjvm::checkException(env); |
// Modified for Bugzilla# 3679 |
|
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
request->deepInheritance, |
|
jcc, |
|
JMPI_LOCALONLY); |
| |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef, |
|
rRole,false,false,NULL); |
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
|
|
|
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); |
|
|
jobject jciRet = env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMInstance inst=*((CIMInstance*)env->CallIntMethod(jInst,JMPIjvm::jv.CIMInstanceCInst)); |
|
|
jlong jciRetRef = env->CallLongMethod(jciRet,JMPIjvm::jv.CIMInstanceCInst); |
|
CIMInstance *ciRet = DEBUG_ConvertJavaToC (jlong, CIMInstance*, jciRetRef); |
|
|
|
/* 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; |
|
} |
|
|
|
const CIMObjectPath& op = ciRet->getPath(); |
|
CIMObjectPath iop = ciRet->buildPath(cls); |
|
|
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::handleReferenceNamesRequest(const Message * message) throw() |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleEnumerateInstanceNamesRequest"); |
"JMPIProviderManager::handleReferenceNamesRequest"); |
|
|
HandlerIntro(EnumerateInstanceNames,message,request,response, handler); |
| |
HandlerIntro(ReferenceNames,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; |
|
|
try { | try { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"JMPIProviderManager::handleReferenceNamesRequest - 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 resultPath( |
// make target object path |
System::getHostName(), |
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
request->nameSpace, | request->nameSpace, |
request->resultClass.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(IdentityContainer(request->userName)); |
context.insert(request->operationContext.get(IdentityContainer::NAME)); |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
context.insert(request->operationContext.get(AcceptLanguageListContainer::NAME)); |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
context.insert(request->operationContext.get(ContentLanguageListContainer::NAME)); |
| |
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.referenceNames: " + pr.getName()); |
|
| |
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: Calling provider : enumerateInstanceNames: "<<pr.getName()<<PEGASUS_STD(endl)); |
| |
DDD(cerr<<"--- JMPIProviderManager::referenceNames"<<" role: >"<<request->role<<"< aCls "<< |
JvmVector *jv = 0; |
request->resultClass<<endl); |
|
| |
JvmVector *jv; |
|
env=JMPIjvm::attachThread(&jv); | env=JMPIjvm::attachThread(&jv); |
| |
jobject jRef=env->NewObject(jv->CIMObjectPathClassRef, |
if (!env) |
jv->CIMObjectPathNewI,(jint)&objectPath); |
{ |
|
PEG_METHOD_EXIT(); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
|
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
|
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
|
} |
|
|
|
JMPIProvider::pm_service_op_lock op_lock(&pr); |
|
|
|
jmethodID id = NULL; |
|
String interfaceType; |
|
String interfaceVersion; |
|
|
|
getInterfaceType (request->operationContext.get (ProviderIdContainer::NAME), |
|
interfaceType, |
|
interfaceVersion); |
|
|
|
if (interfaceType == "JMPI") |
|
{ |
|
// public abstract java.util.Vector enumInstances (org.pegasus.jmpi.CIMObjectPath cop, |
|
// boolean deep, |
|
// org.pegasus.jmpi.CIMClass cimClass) |
|
// 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) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_INSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// 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;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_CIMINSTANCEPROVIDER."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
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;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
env->ExceptionClear(); |
|
|
|
// public abstract org.pegasus.jmpi.CIMObjectPath[] 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;)[Lorg/pegasus/jmpi/CIMObjectPath;"); |
|
|
|
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_CIMINSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: found METHOD_CIMINSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: 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); | JMPIjvm::checkException(env); |
| |
jstring rRole=env->NewStringUTF(request->role.getCString()); |
switch (eMethodFound) |
|
{ |
|
case METHOD_CIMINSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
| |
STAT_GETSTARTTIME; |
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; |
|
} |
| |
jmethodID id=env->GetMethodID((jclass)pr.jProviderClass,"referenceNames", |
CIMClass *pcls = new CIMClass (cls); |
"(Lorg/pegasus/jmpi/CIMObjectPath;Ljava/lang/String;)Ljava/util/Vector;"); |
|
| |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
jobject jVec=env->CallObjectMethod((jobject)pr.jProvider,id,jRef,rRole); |
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
| |
STAT_PMS_PROVIDEREND; |
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
jcimClass); |
|
|
|
JMPIjvm::checkException(env); |
| |
handler.processing(); | handler.processing(); |
if (jVec) { |
if (jAr) { |
for (int i=0,m=env->CallIntMethod(jVec,JMPIjvm::jv.VectorSize); i<m; i++) { |
for (int i=0,m=env->GetArrayLength(jAr); i<m; i++) { |
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
jobject jCop=env->CallObjectMethod(jVec,JMPIjvm::jv.VectorElementAt,i); |
|
|
jobject jcopRet = env->GetObjectArrayElement(jAr,i); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
CIMObjectPath *cop=((CIMObjectPath*)env->CallIntMethod |
|
(jCop,JMPIjvm::jv.CIMObjectPathCInst)); |
jlong jcopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jcopRetRef); |
|
|
JMPIjvm::checkException(env); | JMPIjvm::checkException(env); |
handler.deliver(*cop); |
|
|
handler.deliver(*copRet); |
} | } |
} | } |
handler.complete(); | handler.complete(); |
|
break; |
} | } |
HandlerCatch(handler); |
|
| |
if (env) JMPIjvm::detachThread(); |
case METHOD_CIMINSTANCEPROVIDER2: |
|
{ |
|
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); |
} |
|
| |
|
CIMClass cls; |
| |
/* |
try |
Message * JMPIProviderManager::handleInvokeMethodRequest(const Message * message) throw() |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
"JMPIProviderManager::handleInvokeMethodRequest"); |
AutoMutex lock (pr._cimomMutex); |
|
|
HandlerIntroMethod(InvokeMethod,message,request,response, |
|
handler); |
|
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()); |
|
| |
// make target object path |
cls = pr._cimom_handle->getClass(context, |
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, | request->nameSpace, |
request->instanceName.getClassName(), |
request->className, |
request->instanceName.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::handleEnumerateInstanceNamesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
| |
// resolve provider name |
CIMClass *pcls = new CIMClass (cls); |
ProviderName name = _resolveProviderName( |
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobjectArray jAr = (jobjectArray)env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jcimClass); |
|
|
|
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_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); |
|
|
|
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); |
|
|
|
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jcop, |
|
jcimClass); |
|
|
|
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_INSTANCEPROVIDER: |
|
{ |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, objectPath); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
CIMClass cls; |
|
|
|
try |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"enter: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
AutoMutex lock (pr._cimomMutex); |
|
|
|
cls = pr._cimom_handle->getClass(context, |
|
request->nameSpace, |
|
request->className, |
|
false, |
|
true, |
|
true, |
|
CIMPropertyList()); |
|
DDD (PEGASUS_STD(cout)<<"exit: cimom_handle->getClass("<<__LINE__<<") "<<request->className<<PEGASUS_STD(endl)); |
|
} |
|
catch (CIMException e) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleEnumerateInstanceNamesRequest: Error: Caught CIMExcetion during cimom_handle->getClass("<<__LINE__<<") "<<PEGASUS_STD(endl)); |
|
throw; |
|
} |
|
|
|
CIMClass *pcls = new CIMClass (cls); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
jlong jcimClassRef = DEBUG_ConvertCToJava (CIMClass*, jlong, pcls); |
|
jobject jcimClass = env->NewObject(jv->CIMClassClassRef,jv->CIMClassNewJ,jcimClassRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
StatProviderTimeMeasurement providerTime(response); |
|
|
|
jobject jVec = env->CallObjectMethod((jobject)pr.jProvider, |
|
id, |
|
jcop, |
|
true, |
|
jcimClass); |
|
|
|
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::handleEnumerateInstanceNamesRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
if (env) JMPIjvm::detachThread(); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * JMPIProviderManager::handleCreateInstanceRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,"JMPIProviderManager::handleCreateInstanceRequest"); |
|
|
|
HandlerIntro(CreateInstance,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::handleCreateInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.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 |
|
CIMObjectPath *objectPath = new CIMObjectPath (System::getHostName(), |
|
request->nameSpace, |
|
request->newInstance.getPath().getClassName(), |
|
request->newInstance.getPath().getKeyBindings()); |
|
|
|
// resolve provider name |
|
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); |
|
|
|
// forward request |
|
JMPIProvider &pr = ph.GetProvider(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.createInstance: " + ph.GetProvider().getName()); |
|
|
|
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: Calling provider createInstance: "<<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 org.pegasus.jmpi.CIMObjectPath createInstance (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/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)); |
|
} |
|
} |
|
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 (id != NULL) |
|
{ |
|
eMethodFound = METHOD_INSTANCEPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: found METHOD_INSTANCEPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
|
|
|
if (id == NULL) |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: 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_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->newInstance); |
|
jlong jciRef = DEBUG_ConvertCToJava (CIMInstance*, jlong, ci); |
|
jobject jci = env->NewObject(jv->CIMInstanceClassRef,jv->CIMInstanceNewJ,jciRef); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
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); |
|
|
|
handler.processing(); |
|
|
|
if (jcopRet) { |
|
jlong jCopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jCopRetRef); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
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); |
|
|
|
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); |
|
|
|
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, |
|
joc, |
|
jcop, |
|
jci); |
|
|
|
JMPIjvm::checkException(env); |
|
|
|
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
|
|
|
JMPIjvm::checkException(env); |
|
} |
|
|
|
handler.processing(); |
|
|
|
if (jcopRet) { |
|
jlong jCopRetRef = env->CallLongMethod(jcopRet,JMPIjvm::jv.CIMObjectPathCInst); |
|
CIMObjectPath *copRet = DEBUG_ConvertJavaToC (jlong, CIMObjectPath*, jCopRetRef); |
|
|
|
handler.deliver(*copRet); |
|
} |
|
handler.complete(); |
|
break; |
|
} |
|
|
|
case METHOD_UNKNOWN: |
|
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateInstanceRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
|
} |
|
HandlerCatch(handler); |
|
|
|
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); |
| |
// convert arguments |
prec->count++; |
OperationContext context; |
} |
| |
context.insert(IdentityContainer(request->userName)); |
// Add a selection record for JNI CIMOMHandle deliverEvent calls |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
indSelectRecord *srec = new indSelectRecord (); |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
CIMObjectPath instanceReference(request->instanceName); |
{ |
|
srec->query = request->query; |
|
srec->queryLanguage = sub_cntr.getQueryLanguage (); |
|
srec->propertyList = request->propertyList; |
| |
// ATTN: propagate namespace |
CIMOMHandleQueryContext *qContext = new CIMOMHandleQueryContext (CIMNamespaceName (request->nameSpace.getString ()), |
instanceReference.setNameSpace(request->nameSpace); |
*pr._cimom_handle); |
|
srec->qContext = qContext; |
| |
// forward request |
CIMObjectPath sPath (request->subscriptionInstance.getPath ().getClassName ().getString ()); |
JMPIProvider & pr=ph.GetProvider(); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
sPath.setNameSpace (request->subscriptionInstance.getPath ().getNameSpace ()); |
"Calling provider.invokeMethod: " + pr.getName()); |
|
| |
CMPIStatus rc={CMPI_RC_OK,NULL}; |
AutoMutex lock (mutexSelxTab); |
CMPI_ContextOnStack eCtx(context); |
|
CMPI_ObjectPathOnStack eRef(objectPath); |
|
CMPI_ResultOnStack eRes(handler,&pr.broker); |
|
CMPI_ThreadContext thr(&pr.broker,&eCtx); |
|
CMPI_ArgsOnStack eArgsIn(request->inParameters); |
|
Array<CIMParamValue> outArgs; |
|
CMPI_ArgsOnStack eArgsOut(outArgs); |
|
CString mName=request->methodName.getString().getCString(); |
|
| |
CMPIFlags flgs=0; |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: Adding to selxTab "<<sPath.toString ()<<PEGASUS_STD(endl)); |
eCtx.ft->addEntry(&eCtx,CMPIInvocationFlags,(CMPIValue*)&flgs,CMPI_uint32); |
|
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
selxTab.insert (sPath.toString (), srec); |
| |
STAT_GETSTARTTIME; |
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)); |
|
} |
| |
rc=pr.miVector.methMI->ft->invokeMethod( |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.createSubscriptionRequest: " + pr.getName()); |
pr.miVector.methMI,&eCtx,&eRes,&eRef,CHARS(mName),&eArgsIn,&eArgsOut); |
|
| |
STAT_PMS_PROVIDEREND; |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: Calling provider createSubscriptionRequest: "<<pr.getName()<<PEGASUS_STD(endl)); |
| |
if (rc.rc!=CMPI_RC_OK) |
JvmVector *jv = 0; |
throw CIMException((CIMStatusCode)rc.rc); |
|
| |
for (int i=0,s=outArgs.size(); i<s; i++) |
env = JMPIjvm::attachThread(&jv); |
handler.deliverParamValue(outArgs[i]); |
|
handler.complete(); |
|
} |
|
HandlerCatch(handler); |
|
| |
|
if (!env) |
|
{ |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
|
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
|
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
} | } |
*//* |
|
struct indProvRecord { |
|
indProvRecord() : enabled(false), count(1), handler(NULL) {} |
|
Boolean enabled; |
|
int count; |
|
EnableIndicationsResponseHandler* handler; |
|
}; |
|
| |
struct indSelectRecord { |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
indSelectRecord() : eSelx(NULL) {} |
|
CMPI_SelectExp *eSelx; |
|
}; |
|
| |
|
jmethodID id = NULL; |
|
String interfaceType; |
|
String interfaceVersion; |
|
|
|
getInterfaceType (pidc, |
|
interfaceType, |
|
interfaceVersion); |
| |
typedef HashTable<String,indProvRecord*,EqualFunc<String>,HashFunc<String> > IndProvTab; |
if (interfaceType == "JMPI") |
typedef HashTable<String,indSelectRecord*,EqualFunc<String>,HashFunc<String> > IndSelectTab; |
{ |
|
// 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"); |
| |
IndProvTab provTab; |
if (id != NULL) |
IndSelectTab selxTab; |
|
*//* |
|
int LocateIndicationProviderNames(const CIMInstance& pInstance, const CIMInstance& pmInstance, |
|
String& providerName, String& location) |
|
{ | { |
Uint32 pos = pInstance.findProperty(CIMName ("Name")); |
eMethodFound = METHOD_EVENTPROVIDER; |
pInstance.getProperty(pos).getValue().get(providerName); |
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"); |
| |
pos = pmInstance.findProperty(CIMName ("Location")); |
if (id != NULL) |
pmInstance.getProperty(pos).getValue().get(location); |
{ |
return 0; |
eMethodFound = METHOD_EVENTPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: found METHOD_EVENTPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
} | } |
| |
Message * JMPIProviderManager::handleCreateSubscriptionRequest(const Message * message) throw() |
if (id == NULL) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateSubscriptionRequest"); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleCreateSubscriptionRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
HandlerIntroInd(CreateSubscription,message,request,response, |
PEG_METHOD_EXIT(); |
handler); |
|
try { |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
const CIMObjectPath &x=request->subscriptionInstance.getPath(); |
MessageLoaderParms ("ProviderManager.JMPI.METHOD_NOT_FOUND", |
|
"Could not find a method for the provider based on InterfaceType.")); |
|
} |
| |
String providerName,providerLocation; |
JMPIjvm::checkException(env); |
LocateIndicationProviderNames(request->provider, request->providerModule, |
|
providerName,providerLocation); |
|
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
switch (eMethodFound) |
"JMPIProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Provider name(s): $2", |
{ |
System::getHostName(), |
case METHOD_EVENTPROVIDER: |
request->nameSpace.getString(), |
{ |
providerName); |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
|
srec->queryLanguage); |
|
jlong jStmtRef = DEBUG_ConvertCToJava (WQLSelectStatement *, jlong, stmt); |
|
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewJ,jStmtRef); |
| |
String fileName = resolveFileName(providerLocation); |
JMPIjvm::checkException(env); |
| |
// get cached or load new provider module |
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(fileName, providerName, String::EMPTY); |
|
| |
indProvRecord *prec=NULL; |
JMPIjvm::checkException(env); |
provTab.lookup(providerName,prec); |
|
if (prec) prec->count++; |
|
else { |
|
prec=new indProvRecord(); |
|
provTab.insert(providerName,prec); |
|
} |
|
| |
indSelectRecord *srec=new indSelectRecord(); |
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
const CIMObjectPath &sPath=request->subscriptionInstance.getPath(); |
request->nameSpace, |
selxTab.insert(sPath.toString(),srec); |
request->classNames[0]); |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
// convert arguments |
JMPIjvm::checkException(env); |
OperationContext *context=new OperationContext(); |
|
| |
context->insert(IdentityContainer(request->userName)); |
StatProviderTimeMeasurement providerTime(response); |
context->insert(SubscriptionInstanceContainer |
|
(request->subscriptionInstance)); |
|
context->insert(SubscriptionFilterConditionContainer |
|
(request->condition, request->queryLanguage)); |
|
|
|
context->insert(SubscriptionLanguageListContainer |
|
(request->acceptLanguages)); |
|
context->insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context->insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
jSelectExp, |
|
jType, |
|
jcop, |
|
(jboolean)fNewPrec); |
| |
JMPIProvider & pr=ph.GetProvider(); |
JMPIjvm::checkException(env); |
|
break; |
|
} |
|
|
|
case METHOD_EVENTPROVIDER2: |
|
{ |
|
jlong jocRef = DEBUG_ConvertCToJava (OperationContext*, jlong, &request->operationContext); |
|
jobject joc = env->NewObject(jv->OperationContextClassRef,jv->OperationContextNewJ,jocRef); |
| |
CMPIStatus rc={CMPI_RC_OK,NULL}; |
WQLSelectStatement *stmt = newSelectExp (srec->query, |
CMPI_ContextOnStack eCtx(*context); |
srec->queryLanguage); |
CMPI_SelectExp *eSelx=new CMPI_SelectExp(*context, |
jlong jStmtRef = DEBUG_ConvertCToJava (WQLSelectStatement *, jlong, stmt); |
request->query, |
jobject jSelectExp = env->NewObject(jv->SelectExpClassRef,jv->SelectExpNewJ,jStmtRef); |
request->queryLanguage); |
|
srec->eSelx=eSelx; |
|
CMPI_ThreadContext thr(&pr.broker,&eCtx); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JMPIjvm::checkException(env); |
"Calling provider.createSubscriptionRequest: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::createSubscriptionRequest"<<endl); |
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
| |
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) { |
JMPIjvm::checkException(env); |
CIMObjectPath className( |
|
System::getHostName(), |
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
request->nameSpace, | request->nameSpace, |
request->classNames[i]); |
request->classNames[0]); |
eSelx->classNames.append(className); |
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
} |
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]); |
|
| |
CIMPropertyList propertyList = request->propertyList; |
JMPIjvm::checkException(env); |
if (!propertyList.isNull()) { |
|
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; |
|
} |
|
| |
Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy; |
StatProviderTimeMeasurement providerTime(response); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
env->CallVoidMethod ((jobject)pr.jProvider, |
|
id, |
|
joc, |
|
jSelectExp, |
|
jType, |
|
jcop, |
|
(jboolean)fNewPrec); |
| |
STAT_GETSTARTTIME; |
JMPIjvm::checkException(env); |
| |
rc=pr.miVector.indMI->ft->activateFilter( |
if (joc) |
pr.miVector.indMI,&eCtx,NULL,eSelx, |
{ |
CHARS(request->nameSpace.getString().getCString()),&eRef,false); |
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
STAT_PMS_PROVIDEREND; |
JMPIjvm::checkException(env); |
|
} |
|
break; |
|
} |
| |
if (rc.rc!=CMPI_RC_OK) |
case METHOD_UNKNOWN: |
throw CIMException((CIMStatusCode)rc.rc); |
{ |
|
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); |
|
try { |
|
String providerName,providerLocation; |
|
LocateIndicationProviderNames(request->provider, request->providerModule, |
|
providerName,providerLocation); |
|
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
typedef enum { |
|
METHOD_UNKNOWN = 0, |
|
METHOD_EVENTPROVIDER, |
|
METHOD_EVENTPROVIDER2, |
|
} METHOD_VERSION; |
|
METHOD_VERSION eMethodFound = METHOD_UNKNOWN; |
|
JNIEnv *env = NULL; |
|
bool fFreePrec = false; |
|
indProvRecord *prec = NULL; |
|
indSelectRecord *srec = 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::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) { |
|
provTab.remove(providerName); |
|
prec=NULL; |
|
} | } |
| |
indSelectRecord *srec=NULL; |
{ |
const CIMObjectPath &sPath=request->subscriptionInstance.getPath(); |
AutoMutex lock (prec->mutex); |
String sPathString=sPath.toString(); |
|
selxTab.lookup(sPathString,srec); |
|
| |
CMPI_SelectExp *eSelx=srec->eSelx; |
if (--prec->count <= 0) |
CMPI_ObjectPathOnStack eRef(eSelx->classNames[0]); |
{ |
selxTab.remove(sPathString); |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: Removing provTab "<<providerName<<PEGASUS_STD(endl)); |
| |
// convert arguments |
provTab.remove (providerName); |
OperationContext context; |
|
|
fFreePrec = true; |
|
} |
|
} |
| |
context.insert(IdentityContainer(request->userName)); |
{ |
context.insert(SubscriptionInstanceContainer |
CIMObjectPath sPath (request->subscriptionInstance.getPath ().getClassName ().getString ()); |
(request->subscriptionInstance)); |
|
|
|
context.insert(SubscriptionLanguageListContainer |
|
(request->acceptLanguages)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
sPath.setNameSpace (request->subscriptionInstance.getPath ().getNameSpace ()); |
| |
JMPIProvider & pr=ph.GetProvider(); |
String sPathString = sPath.toString (); |
| |
CMPIStatus rc={CMPI_RC_OK,NULL}; |
AutoMutex lock (mutexSelxTab); |
CMPI_ContextOnStack eCtx(context); |
|
CMPI_ThreadContext thr(&pr.broker,&eCtx); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: Removing selxTab "<<sPathString<<PEGASUS_STD(endl)); |
"Calling provider.deleteSubscriptionRequest: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::deleteSubscriptionRequest"<<endl); |
selxTab.lookup (sPathString, srec); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
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)); |
| |
STAT_GETSTARTTIME; |
selxTab.remove (sPathString); |
|
} |
| |
rc=pr.miVector.indMI->ft->deActivateFilter( |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Calling provider.deleteSubscriptionRequest: " + pr.getName()); |
pr.miVector.indMI,&eCtx,NULL,eSelx, |
|
CHARS(request->nameSpace.getString().getCString()),&eRef,prec==NULL); |
|
| |
delete eSelx; |
DDD(PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: Calling provider deleteSubscriptionRequest: "<<pr.getName()<<PEGASUS_STD(endl)); |
| |
STAT_PMS_PROVIDEREND; |
JvmVector *jv = 0; |
| |
if (rc.rc!=CMPI_RC_OK) |
env = JMPIjvm::attachThread(&jv); |
throw CIMException((CIMStatusCode)rc.rc); |
|
} |
|
HandlerCatch(handler); |
|
| |
|
if (!env) |
|
{ |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
|
MessageLoaderParms("ProviderManager.JMPI.INIT_JVM_FAILED", |
|
"Could not initialize the JVM (Java Virtual Machine) runtime environment.")); |
} | } |
| |
Message * JMPIProviderManager::handleEnableIndicationsRequest(const Message * message) throw() |
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") |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager:: handleEnableIndicationsRequest"); |
// 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"); |
| |
HandlerIntroInd(EnableIndications,message,request,response, |
if (id != NULL) |
handler); |
{ |
try { |
eMethodFound = METHOD_EVENTPROVIDER; |
String providerName,providerLocation; |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: found METHOD_EVENTPROVIDER."<<PEGASUS_STD(endl)); |
LocateIndicationProviderNames(request->provider, request->providerModule, |
} |
providerName,providerLocation); |
|
|
|
indProvRecord *provRec; |
|
if (provTab.lookup(providerName,provRec)) { |
|
provRec->enabled=true; |
|
provRec->handler=new EnableIndicationsResponseHandler( |
|
request, response, request->provider, _indicationCallback); |
|
} | } |
|
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"); |
| |
String fileName = resolveFileName(providerLocation); |
if (id != NULL) |
|
{ |
|
eMethodFound = METHOD_EVENTPROVIDER2; |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: found METHOD_EVENTPROVIDER2."<<PEGASUS_STD(endl)); |
|
} |
|
} |
| |
// get cached or load new provider module |
if (id == NULL) |
JMPIProvider::OpProviderHolder ph = |
{ |
providerManager.getProvider(fileName, providerName, String::EMPTY); |
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: No method found!"<<PEGASUS_STD(endl)); |
| |
// convert arguments |
PEG_METHOD_EXIT(); |
OperationContext context; |
|
| |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
MessageLoaderParms ("ProviderManager.JMPI.METHOD_NOT_FOUND", |
|
"Could not find a method for the provider based on InterfaceType.")); |
|
} |
| |
JMPIProvider & pr=ph.GetProvider(); |
JMPIjvm::checkException(env); |
| |
CMPIStatus rc={CMPI_RC_OK,NULL}; |
switch (eMethodFound) |
CMPI_ContextOnStack eCtx(context); |
{ |
CMPI_ThreadContext thr(&pr.broker,&eCtx); |
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); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
JMPIjvm::checkException(env); |
"Calling provider.EnableIndicationRequest: " + pr.getName()); |
|
| |
DDD(cerr<<"--- JMPIProviderManager::enableIndicationRequest"<<endl); |
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
| |
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); |
| |
pr.miVector.indMI->ft->enableIndications( |
JMPIjvm::checkException(env); |
pr.miVector.indMI); |
|
| |
STAT_PMS_PROVIDEREND; |
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); |
LocateIndicationProviderNames(request->provider, request->providerModule, |
|
providerName,providerLocation); |
|
|
|
indProvRecord *provRec; |
|
if (provTab.lookup(providerName,provRec)) { |
|
provRec->enabled=false; |
|
if (provRec->handler) delete provRec->handler; |
|
provRec->handler=NULL; |
|
} |
|
| |
String fileName = resolveFileName(providerLocation); |
JMPIjvm::checkException(env); |
| |
// get cached or load new provider module |
jstring jType = env->NewStringUTF(request->nameSpace.getString().getCString()); |
JMPIProvider::OpProviderHolder ph = |
|
providerManager.getProvider(fileName, providerName, String::EMPTY); |
|
| |
// convert arguments |
JMPIjvm::checkException(env); |
OperationContext context; |
|
| |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
CIMObjectPath *cop = new CIMObjectPath (System::getHostName(), |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
request->nameSpace, |
|
request->classNames[0]); |
|
jlong jcopRef = DEBUG_ConvertCToJava (CIMObjectPath*, jlong, cop); |
|
jobject jcop = env->NewObject(jv->CIMObjectPathClassRef,jv->CIMObjectPathNewJ,jcopRef); |
| |
JMPIProvider & pr=ph.GetProvider(); |
JMPIjvm::checkException(env); |
| |
CMPIStatus rc={CMPI_RC_OK,NULL}; |
StatProviderTimeMeasurement providerTime(response); |
CMPI_ContextOnStack eCtx(context); |
|
CMPI_ThreadContext thr(&pr.broker,&eCtx); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
env->CallVoidMethod ((jobject)pr.jProvider, |
"Calling provider.DisableIndicationRequest: " + pr.getName()); |
id, |
|
joc, |
|
jSelectExp, |
|
jType, |
|
jcop, |
|
(jboolean)fFreePrec); |
| |
DDD(cerr<<"--- JMPIProviderManager::disableIndicationRequest"<<endl); |
JMPIjvm::checkException(env); |
| |
JMPIProvider::pm_service_op_lock op_lock(&pr); |
if (joc) |
|
{ |
|
env->CallVoidMethod (joc, JMPIjvm::jv.OperationContextUnassociate); |
| |
STAT_GETSTARTTIME; |
JMPIjvm::checkException(env); |
|
} |
|
break; |
|
} |
| |
pr.miVector.indMI->ft->disableIndications( |
case METHOD_UNKNOWN: |
pr.miVector.indMI); |
{ |
|
DDD (PEGASUS_STD(cout)<<"--- JMPIProviderManager::handleDeleteSubscriptionRequest: should not be here!"<<PEGASUS_STD(endl)); |
|
break; |
|
} |
|
} |
| |
STAT_PMS_PROVIDEREND; |
// |
|
// Decrement count of current subscriptions for this provider |
|
// |
|
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); |
}*/ |
} |
// |
|
// Provider module status |
|
// |
|
static const Uint16 _MODULE_OK = 2; |
|
static const Uint16 _MODULE_STOPPING = 9; |
|
static const Uint16 _MODULE_STOPPED = 10; |
|
| |
Message * JMPIProviderManager::handleDisableModuleRequest(const Message * message) throw() | Message * JMPIProviderManager::handleDisableModuleRequest(const Message * message) throw() |
{ | { |
|
|
| |
Array<Uint16> operationalStatus; | Array<Uint16> operationalStatus; |
// Assume success. | // Assume success. |
operationalStatus.append(_MODULE_STOPPED); |
operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_STOPPED); |
| |
// | // |
// Unload providers | // Unload providers |
// | // |
Array<CIMInstance> _pInstances = request->providers; | Array<CIMInstance> _pInstances = request->providers; |
| |
for(Uint32 i = 0, n = _pInstances.size(); i < n; i++) |
|
{ |
|
/* temp disabled by Chip |
|
// get the provider file name and logical name |
|
Triad<String, String, String> triad = |
|
getProviderRegistrar()->_getProviderRegPair(_pInstances[i], mInstance); |
|
|
|
providerManager.unloadProvider(triad.first, triad.second); |
|
*/ |
|
} |
|
|
|
CIMDisableModuleResponseMessage * response = | CIMDisableModuleResponseMessage * response = |
new CIMDisableModuleResponseMessage( | new CIMDisableModuleResponseMessage( |
request->messageId, | request->messageId, |
|
|
| |
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(request != 0); | PEGASUS_ASSERT(request != 0); |
| |
Array<Uint16> operationalStatus; | Array<Uint16> operationalStatus; |
operationalStatus.append(_MODULE_OK); |
operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK); |
| |
CIMEnableModuleResponseMessage * response = | CIMEnableModuleResponseMessage * response = |
new CIMEnableModuleResponseMessage( | new CIMEnableModuleResponseMessage( |
|
|
| |
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::handleSubscriptionInitCompleteRequest (const Message * message) |
|
{ |
|
PEG_METHOD_ENTER (TRC_PROVIDERMANAGER, |
|
"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_STRING (TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unknown error in handleSubscriptionInitCompleteRequest"); |
|
} |
|
} |
|
#endif |
|
|
|
PEG_METHOD_EXIT (); |
|
return (response); |
|
} |
|
|
Message * JMPIProviderManager::handleUnsupportedRequest(const Message * message) throw() | Message * JMPIProviderManager::handleUnsupportedRequest(const Message * message) throw() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleUnsupportedRequest"); | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "JMPIProviderManager::handleUnsupportedRequest"); |
| |
PEG_METHOD_EXIT(); |
CIMRequestMessage* request = |
|
dynamic_cast<CIMRequestMessage *>(const_cast<Message *>(message)); |
|
PEGASUS_ASSERT(request != 0 ); |
| |
// a null response implies unsupported or unknown operation |
CIMResponseMessage* response = request->buildResponse(); |
return(0); |
response->cimException = |
|
PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
|
|
PEG_METHOD_EXIT(); |
|
return response; |
} | } |
| |
ProviderName JMPIProviderManager::_resolveProviderName( | ProviderName JMPIProviderManager::_resolveProviderName( |
|
|
providerId.getModule().findProperty("InterfaceType")).getValue(); | providerId.getModule().findProperty("InterfaceType")).getValue(); |
genericValue.get(interfaceName); | genericValue.get(interfaceName); |
| |
// Check if the provider module is blocked |
|
Array<Uint16> operationalStatus; |
|
Uint32 pos = providerId.getModule().findProperty( |
|
CIMName("OperationalStatus")); |
|
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
providerId.getModule().getProperty(pos).getValue().get(operationalStatus); |
|
|
|
for(Uint32 i = 0; i < operationalStatus.size(); i++) |
|
{ |
|
if(operationalStatus[i] == _MODULE_STOPPED || |
|
operationalStatus[i] == _MODULE_STOPPING) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService.PROVIDER_BLOCKED", |
|
"provider blocked.")); |
|
} |
|
} |
|
|
|
return ProviderName(providerName, fileName, interfaceName, 0); | return ProviderName(providerName, fileName, interfaceName, 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; |
} | } |
| |