tog-pegasus/pegasus-2.7.1-bz454590.patch
2008-07-16 14:41:37 +00:00

1875 lines
65 KiB
Diff

diff -up pegasus/src/Providers/TestProviders/CMPI/TestFail_1/tests/TestCMPI_Fail_1.cpp.bz454590 pegasus/src/Providers/TestProviders/CMPI/TestFail_1/tests/TestCMPI_Fail_1.cpp
--- pegasus/src/Providers/TestProviders/CMPI/TestFail_1/tests/TestCMPI_Fail_1.cpp.bz454590 2007-09-14 20:26:55.000000000 +0200
+++ pegasus/src/Providers/TestProviders/CMPI/TestFail_1/tests/TestCMPI_Fail_1.cpp 2008-07-16 15:52:49.000000000 +0200
@@ -49,13 +49,16 @@ PEGASUS_USING_STD;
CIMNamespaceName providerNamespace;
const CIMName CLASSNAME = CIMName ("TestCMPI_Fail_1");
-const String CMPI_TESTFAIL_ERROR = "CIM_ERR_FAILED: Error initializing CMPI MI"
- " TestCMPIFail_1Provider, the following MI factory function(s) returned"
- " an error: TestCMPIFail_1Provider_Create_InstanceMI;"
- " TestCMPIFail_1Provider_Create_AssociationMI;"
- " TestCMPIFail_1Provider_Create_MethodMI;"
- " TestCMPIFail_1Provider_Create_PropertyMI;"
- " TestCMPIFail_1Provider_Create_IndicationMI";
+const String CMPI_TESTFAIL_INST_ERROR = "CIM_ERR_FAILED: Error initializing"
+ " CMPI MI TestCMPIFail_1Provider, the following MI factory function(s)"
+ " returned an error: TestCMPIFail_1Provider_Create_InstanceMI";
+
+const String CMPI_TESTFAIL_METH_ERROR = "CIM_ERR_FAILED: Error initializing"
+ " CMPI MI TestCMPIFail_1Provider, the following MI factory function(s)"
+ " returned an error: TestCMPIFail_1Provider_Create_MethodMI";
+
+const String CMPI_TESTFAIL_ASSOC_ERROR = "CIM_ERR_FAILED: Error initializing"
+ " CMPI MI TestCMPIFail_1Provider, the following MI factory function(s)";
const String RCMPI_ERROR = "CIM_ERR_FAILED: ProviderInitFailure:"
" Error initializing the API's _Create<mi-type>MI";
@@ -78,7 +81,36 @@ void test01 (CIMClient & client)
}
catch (const CIMException &e)
{
- if (e.getMessage() != CMPI_TESTFAIL_ERROR
+ if (e.getMessage() != CMPI_TESTFAIL_INST_ERROR
+ && e.getMessage() != RCMPI_ERROR)
+ {
+ throw e;
+ }
+ }
+}
+
+void test02 (CIMClient & client)
+{
+ try
+ {
+ CIMObjectPath instanceName(
+ String::EMPTY,
+ providerNamespace,
+ CLASSNAME,
+ Array<CIMKeyBinding>());
+
+ Array<CIMParamValue> outParams;
+
+ CIMValue value = client.invokeMethod(
+ providerNamespace,
+ instanceName,
+ "foo",
+ Array<CIMParamValue>(),
+ outParams);
+ }
+ catch (const CIMException &e)
+ {
+ if (e.getMessage() != CMPI_TESTFAIL_METH_ERROR
&& e.getMessage() != RCMPI_ERROR)
{
throw e;
@@ -86,12 +118,37 @@ void test01 (CIMClient & client)
}
}
+void test03 (CIMClient & client)
+{
+ try
+ {
+ CIMObjectPath instanceName(
+ String::EMPTY,
+ providerNamespace,
+ CLASSNAME,
+ Array<CIMKeyBinding>());
+
+ Array<CIMObjectPath> result = client.associatorNames(
+ providerNamespace,
+ instanceName);
+ }
+ catch (const CIMException &e)
+ {
+ if (e.getMessage() != CMPI_TESTFAIL_ASSOC_ERROR
+ && e.getMessage() != RCMPI_ERROR)
+ {
+ throw e;
+ }
+ }
+}
void _test (CIMClient & client)
{
try
{
test01 (client);
+ test02 (client);
+ test03 (client);
}
catch (Exception & e)
{
diff -up pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.cpp.bz454590 pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.cpp
--- pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.cpp.bz454590 2007-12-19 15:04:39.000000000 +0100
+++ pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.cpp 2008-07-16 15:12:16.000000000 +0200
@@ -122,8 +122,8 @@ Sint32 CMPILocalProviderManager::_provid
String location = *(parms->location);
CMPIProvider *pr = 0;
- CMPIProvider::OpProviderHolder * ph =
- reinterpret_cast < CMPIProvider::OpProviderHolder * >(ret);
+ OpProviderHolder * ph =
+ reinterpret_cast < OpProviderHolder * >(ret);
pr = _lookupProvider (providerName);
@@ -176,7 +176,7 @@ Sint32 CMPILocalProviderManager::_provid
AutoMutex lock (_providerTableMutex);
// The provider table must be locked before unloading.
- _providers.remove (pr->_name);
+ _providers.remove (pr->getNameWithType());
_unloadProvider (pr);
delete pr;
@@ -184,7 +184,7 @@ Sint32 CMPILocalProviderManager::_provid
else
{
// No need to have a memory leak.
- _providers.remove(pr->_name);
+ _providers.remove(pr->getNameWithType());
delete pr;
}
break;
@@ -375,14 +375,14 @@ Sint32 CMPILocalProviderManager::_provid
continue;
}
- if (provider->_quantum == quantum)
+ if (provider->getQuantum() == quantum)
{
continue;
}
- provider->_quantum = quantum;
+ provider->setQuantum(quantum);
- if (provider->_current_operations.get ())
+ if (provider->getCurrentOperations())
{
PEG_TRACE_STRING(
TRC_PROVIDERMANAGER,
@@ -434,7 +434,7 @@ Sint32 CMPILocalProviderManager::_provid
{
// lock the provider mutex
- AutoMutex pr_lock (provider->_statusMutex);
+ AutoMutex pr_lock (provider->getStatusMutex());
if (provider->tryTerminate () == false)
{
@@ -448,10 +448,10 @@ Sint32 CMPILocalProviderManager::_provid
continue;
}
- PEGASUS_ASSERT (provider->_module != 0);
+ PEGASUS_ASSERT (provider->getModule() != 0);
// unload provider module
- provider->_module->unloadModule ();
+ provider->getModule()->unloadModule ();
Logger::put (Logger::STANDARD_LOG,
System::CIMSERVER,
Logger::TRACE,
@@ -470,7 +470,7 @@ Sint32 CMPILocalProviderManager::_provid
Tracer::LEVEL4,
"Destroying CMPIProvider's CIMOM Handle "
+ provider->getName());
- delete provider->_cimom_handle;
+ delete provider->getCIMOMHandle();
// set provider status to UNINITIALIZED
provider->reset ();
@@ -598,10 +598,10 @@ void CMPILocalProviderManager::cleanupTh
}
-CMPIProvider::OpProviderHolder CMPILocalProviderManager::
+OpProviderHolder CMPILocalProviderManager::
getRemoteProvider (const String & location, const String & providerName)
{
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
CTRL_STRINGS
strings;
Sint32
@@ -649,10 +649,10 @@ CMPIProvider::OpProviderHolder CMPILocal
return ph;
}
-CMPIProvider::OpProviderHolder CMPILocalProviderManager::
+OpProviderHolder CMPILocalProviderManager::
getProvider (const String & fileName, const String & providerName)
{
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
CTRL_STRINGS strings;
Sint32 ccode;
@@ -887,9 +887,9 @@ CMPIProvider *CMPILocalProviderManager::
String exceptionMsg = moduleFileName;
{
// lock the provider status mutex
- AutoMutex lock (provider->_statusMutex);
+ AutoMutex lock (provider->getStatusMutex());
- if (provider->_status == CMPIProvider::INITIALIZED)
+ if (provider->getStatus() == CMPIProvider::INITIALIZED)
{
PEG_METHOD_EXIT();
// Initialization is already complete
@@ -904,7 +904,7 @@ CMPIProvider *CMPILocalProviderManager::
// load the provider
try
{
- base = module->load (provider->_name);
+ base = module->load (provider->getNameWithType());
moduleLoaded = true;
}
catch (const Exception &e)
@@ -938,11 +938,11 @@ CMPIProvider *CMPILocalProviderManager::
CIMOMHandle *cimomHandle = new CIMOMHandle ();
provider->set (module, base, cimomHandle);
- provider->_quantum = 0;
+ provider->setQuantum(0);
try
{
- provider->initialize (*(provider->_cimom_handle));
+ provider->initialize (*(provider->getCIMOMHandle()));
}
catch (const Exception &e)
{
@@ -981,12 +981,12 @@ CMPIProvider *CMPILocalProviderManager::
}
// delete the cimom handle
- delete provider->_cimom_handle;
+ delete provider->getCIMOMHandle();
// set provider status to UNINITIALIZED
provider->reset ();
AutoMutex lock (_providerTableMutex);
- _providers.remove (provider->_name);
+ _providers.remove (provider->getNameWithType());
delete provider;
PEG_METHOD_EXIT ();
@@ -1013,7 +1013,7 @@ void CMPILocalProviderManager::_unloadPr
Tracer::LEVEL4,
"Unloading Provider " + provider->getName());
- if (provider->_current_operations.get ())
+ if (provider->getCurrentOperations())
{
PEG_TRACE_STRING(
TRC_PROVIDERMANAGER,
@@ -1030,7 +1030,7 @@ void CMPILocalProviderManager::_unloadPr
// lock the provider mutex
- AutoMutex pr_lock (provider->_statusMutex);
+ AutoMutex pr_lock (provider->getStatusMutex());
try
{
@@ -1052,11 +1052,11 @@ void CMPILocalProviderManager::_unloadPr
"Destroying CMPIProvider's CIMOM Handle " +
provider->getName());
- delete provider->_cimom_handle;
- PEGASUS_ASSERT (provider->_module != 0);
+ delete provider->getCIMOMHandle();
+ PEGASUS_ASSERT (provider->getModule() != 0);
// unload provider module
- provider->_module->unloadModule ();
+ provider->getModule()->unloadModule ();
Logger::put (Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
"CMPILocalProviderManager::_provider_crtl - Unload provider $0",
provider->getName ());
diff -up pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.h.bz454590 pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.h
--- pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.h.bz454590 2007-08-13 08:25:48.000000000 +0200
+++ pegasus/src/Pegasus/ProviderManager2/CMPI/CMPILocalProviderManager.h 2008-07-16 15:12:16.000000000 +0200
@@ -53,11 +53,11 @@ public:
virtual ~CMPILocalProviderManager();
public:
- CMPIProvider::OpProviderHolder getProvider(
+ OpProviderHolder getProvider(
const String & fileName,
const String & providerName);
- CMPIProvider::OpProviderHolder getRemoteProvider(
+ OpProviderHolder getRemoteProvider(
const String & fileName,
const String & providerName);
diff -up pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.cpp.bz454590 pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.cpp
--- pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.cpp.bz454590 2008-02-28 12:46:29.000000000 +0100
+++ pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.cpp 2008-07-16 15:14:18.000000000 +0200
@@ -429,7 +429,7 @@ Message * CMPIProviderManager::handleGet
request->instanceName.getKeyBindings());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -462,7 +462,7 @@ Message * CMPIProviderManager::handleGet
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
AutoPtr<NormalizerContext> tmpNormalizerContext(
- new CIMOMHandleContext(*pr._cimom_handle));
+ new CIMOMHandleContext(*pr.getCIMOMHandle()));
request->operationContext.insert(
NormalizerContextContainer(tmpNormalizerContext));
#endif
@@ -475,8 +475,8 @@ Message * CMPIProviderManager::handleGet
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
CMPIPropertyList props(request->propertyList);
@@ -497,8 +497,8 @@ Message * CMPIProviderManager::handleGet
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->getInstance(
- pr.miVector.instMI,
+ rc = pr.getInstMI()->ft->getInstance(
+ pr.getInstMI(),
&eCtx,
&eRes,
&eRef,
@@ -571,7 +571,7 @@ Message * CMPIProviderManager::handleEnu
request->className);
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -606,7 +606,7 @@ Message * CMPIProviderManager::handleEnu
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
AutoPtr<NormalizerContext> tmpNormalizerContext(
- new CIMOMHandleContext(*pr._cimom_handle));
+ new CIMOMHandleContext(*pr.getCIMOMHandle()));
request->operationContext.insert(
NormalizerContextContainer(tmpNormalizerContext));
#endif
@@ -619,8 +619,8 @@ Message * CMPIProviderManager::handleEnu
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
CMPIPropertyList props(propertyList);
@@ -641,8 +641,8 @@ Message * CMPIProviderManager::handleEnu
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->enumInstances(
- pr.miVector.instMI,
+ rc = pr.getInstMI()->ft->enumInstances(
+ pr.getInstMI(),
&eCtx,
&eRes,
&eRef,
@@ -716,7 +716,7 @@ Message * CMPIProviderManager::handleEnu
request->className);
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -753,8 +753,8 @@ Message * CMPIProviderManager::handleEnu
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
_setupCMPIContexts(
&eCtx,
@@ -773,8 +773,11 @@ Message * CMPIProviderManager::handleEnu
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->enumInstanceNames(
- pr.miVector.instMI,&eCtx,&eRes,&eRef);
+ rc = pr.getInstMI()->ft->enumInstanceNames(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef);
}
// Need to save ContentLanguage value into operation context of response
@@ -845,7 +848,7 @@ Message * CMPIProviderManager::handleCre
request->newInstance.setPath(objectPath);
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -884,9 +887,9 @@ Message * CMPIProviderManager::handleCre
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
CMPI_InstanceOnStack eInst(request->newInstance);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
_setupCMPIContexts(
&eCtx,
@@ -905,8 +908,12 @@ Message * CMPIProviderManager::handleCre
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->createInstance(
- pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst);
+ rc = pr.getInstMI()->ft->createInstance(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ &eInst);
}
// Need to save ContentLanguage value into operation context of response
@@ -976,7 +983,7 @@ Message * CMPIProviderManager::handleMod
request->modifiedInstance.getPath ().getKeyBindings());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1014,9 +1021,9 @@ Message * CMPIProviderManager::handleMod
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
CMPI_InstanceOnStack eInst(request->modifiedInstance);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
CMPIPropertyList props(request->propertyList);
@@ -1037,8 +1044,12 @@ Message * CMPIProviderManager::handleMod
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->modifyInstance(
- pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst,
+ rc = pr.getInstMI()->ft->modifyInstance(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ &eInst,
(const char **)props.getList());
}
@@ -1109,7 +1120,7 @@ Message * CMPIProviderManager::handleDel
request->instanceName.getKeyBindings());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1147,8 +1158,8 @@ Message * CMPIProviderManager::handleDel
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
_setupCMPIContexts(
&eCtx,
@@ -1167,8 +1178,11 @@ Message * CMPIProviderManager::handleDel
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->deleteInstance(
- pr.miVector.instMI,&eCtx,&eRes,&eRef);
+ rc = pr.getInstMI()->ft->deleteInstance(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef);
}
// Need to save ContentLanguage value into operation context of response
@@ -1238,7 +1252,7 @@ Message * CMPIProviderManager::handleExe
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1279,8 +1293,8 @@ Message * CMPIProviderManager::handleExe
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
const CString queryLan=request->queryLanguage.getCString();
const CString query=request->query.getCString();
@@ -1302,9 +1316,13 @@ Message * CMPIProviderManager::handleExe
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->execQuery(
- pr.miVector.instMI,&eCtx,&eRes,&eRef,
- CHARS(queryLan),CHARS(query));
+ rc = pr.getInstMI()->ft->execQuery(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ CHARS(queryLan),
+ CHARS(query));
}
// Need to save ContentLanguage value into operation context of response
@@ -1381,7 +1399,7 @@ Message * CMPIProviderManager::handleAss
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1414,7 +1432,7 @@ Message * CMPIProviderManager::handleAss
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
AutoPtr<NormalizerContext> tmpNormalizerContext(
- new CIMOMHandleContext(*pr._cimom_handle));
+ new CIMOMHandleContext(*pr.getCIMOMHandle()));
request->operationContext.insert(
NormalizerContextContainer(tmpNormalizerContext));
#endif
@@ -1434,8 +1452,8 @@ Message * CMPIProviderManager::handleAss
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
const CString aClass=request->assocClass.getString().getCString();
const CString rClass=request->resultClass.getString().getCString();
const CString rRole=request->role.getCString();
@@ -1460,9 +1478,15 @@ Message * CMPIProviderManager::handleAss
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.assocMI->ft->associators(
- pr.miVector.assocMI,&eCtx,&eRes,&eRef,
- CHARS(aClass),CHARS(rClass),CHARS(rRole),CHARS(resRole),
+ rc = pr.getAssocMI()->ft->associators(
+ pr.getAssocMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ CHARS(aClass),
+ CHARS(rClass),
+ CHARS(rRole),
+ CHARS(resRole),
(const char **)props.getList());
}
@@ -1541,7 +1565,7 @@ Message * CMPIProviderManager::handleAss
request->assocClass.getString());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1586,8 +1610,8 @@ Message * CMPIProviderManager::handleAss
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
const CString aClass=request->assocClass.getString().getCString();
const CString rClass=request->resultClass.getString().getCString();
const CString rRole=request->role.getCString();
@@ -1610,9 +1634,15 @@ Message * CMPIProviderManager::handleAss
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.assocMI->ft->associatorNames(
- pr.miVector.assocMI,&eCtx,&eRes,&eRef,CHARS(aClass),
- CHARS(rClass),CHARS(rRole),CHARS(resRole));
+ rc = pr.getAssocMI()->ft->associatorNames(
+ pr.getAssocMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ CHARS(aClass),
+ CHARS(rClass),
+ CHARS(rRole),
+ CHARS(resRole));
}
// Need to save ContentLanguage value into operation context of response
@@ -1687,7 +1717,7 @@ Message * CMPIProviderManager::handleRef
request->resultClass.getString());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1719,7 +1749,7 @@ Message * CMPIProviderManager::handleRef
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
AutoPtr<NormalizerContext> tmpNormalizerContext(
- new CIMOMHandleContext(*pr._cimom_handle));
+ new CIMOMHandleContext(*pr.getCIMOMHandle()));
request->operationContext.insert(
NormalizerContextContainer(tmpNormalizerContext));
#endif
@@ -1737,8 +1767,8 @@ Message * CMPIProviderManager::handleRef
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
const CString rClass=request->resultClass.getString().getCString();
const CString rRole=request->role.getCString();
@@ -1761,9 +1791,14 @@ Message * CMPIProviderManager::handleRef
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.assocMI->ft->references(
- pr.miVector.assocMI,&eCtx,&eRes,&eRef,
- CHARS(rClass),CHARS(rRole),(const char **)props.getList());
+ rc = pr.getAssocMI()->ft->references(
+ pr.getAssocMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ CHARS(rClass),
+ CHARS(rRole),
+ (const char **)props.getList());
}
// Need to save ContentLanguage value into operation context of response
@@ -1839,7 +1874,7 @@ Message * CMPIProviderManager::handleRef
request->resultClass.getString());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -1882,8 +1917,8 @@ Message * CMPIProviderManager::handleRef
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
const CString rClass=request->resultClass.getString().getCString();
const CString rRole=request->role.getCString();
@@ -1904,9 +1939,13 @@ Message * CMPIProviderManager::handleRef
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.assocMI->ft->referenceNames(
- pr.miVector.assocMI,&eCtx,&eRes,&eRef,
- CHARS(rClass),CHARS(rRole));
+ rc = pr.getAssocMI()->ft->referenceNames(
+ pr.getAssocMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ CHARS(rClass),
+ CHARS(rRole));
}
// Need to save ContentLanguage value into operation context of response
@@ -1976,7 +2015,7 @@ Message * CMPIProviderManager::handleInv
request->instanceName.getKeyBindings());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -2014,7 +2053,7 @@ Message * CMPIProviderManager::handleInv
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
AutoPtr<NormalizerContext> tmpNormalizerContext(
- new CIMOMHandleContext(*pr._cimom_handle));
+ new CIMOMHandleContext(*pr.getCIMOMHandle()));
request->operationContext.insert(
NormalizerContextContainer(tmpNormalizerContext));
#endif
@@ -2027,8 +2066,8 @@ Message * CMPIProviderManager::handleInv
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
CMPI_ArgsOnStack eArgsIn(request->inParameters);
Array<CIMParamValue> outArgs;
CMPI_ArgsOnStack eArgsOut(outArgs);
@@ -2051,9 +2090,14 @@ Message * CMPIProviderManager::handleInv
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.methMI->ft->invokeMethod(
- pr.miVector.methMI,&eCtx,&eRes,&eRef,
- CHARS(mName),&eArgsIn,&eArgsOut);
+ rc = pr.getMethMI()->ft->invokeMethod(
+ pr.getMethMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ CHARS(mName),
+ &eArgsIn,
+ &eArgsOut);
}
// Need to save ContentLanguage value into operation context of response
@@ -2252,7 +2296,7 @@ Message * CMPIProviderManager::handleCre
providerName);
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
if ((remote=pidc.isRemoteNameSpace()))
{
@@ -2332,7 +2376,7 @@ Message * CMPIProviderManager::handleCre
new CIMOMHandleQueryContext(
CIMNamespaceName(
request->nameSpace.getString()),
- *pr._cimom_handle);
+ *pr.getCIMOMHandle());
CMPI_SelectExp *eSelx=new CMPI_SelectExp(
context,
@@ -2343,7 +2387,7 @@ Message * CMPIProviderManager::handleCre
srec->eSelx=eSelx;
srec->qContext=_context;
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
PEG_TRACE_STRING(
TRC_PROVIDERMANAGER,
@@ -2391,12 +2435,15 @@ Message * CMPIProviderManager::handleCre
{
StatProviderTimeMeasurement providerTime(response);
- if (pr.miVector.indMI->ft->ftVersion >= 100)
+ if (pr.getIndMI()->ft->ftVersion >= 100)
{
- rc = pr.miVector.indMI->ft->activateFilter(
- pr.miVector.indMI,&eCtx,eSelx,
+ rc = pr.getIndMI()->ft->activateFilter(
+ pr.getIndMI(),
+ &eCtx,eSelx,
CHARS(eSelx->classNames[0].getClassName().getString().
- getCString()),&eRef,false);
+ getCString()),
+ &eRef,
+ false);
}
else
{
@@ -2405,8 +2452,8 @@ Message * CMPIProviderManager::handleCre
rc = ((CMPIStatus (*)(CMPIIndicationMI*, CMPIContext*,
CMPIResult*, CMPISelectExp*,
const char *, CMPIObjectPath*, CMPIBoolean))
- pr.miVector.indMI->ft->activateFilter)
- (pr.miVector.indMI,&eCtx,NULL,eSelx,
+ pr.getIndMI()->ft->activateFilter)
+ (pr.getIndMI(),&eCtx,NULL,eSelx,
CHARS(eSelx->classNames[0].getClassName().getString().
getCString()),&eRef,false);
}
@@ -2499,7 +2546,7 @@ Message * CMPIProviderManager::handleDel
providerName);
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
if ((remote=pidc.isRemoteNameSpace()))
{
@@ -2568,7 +2615,7 @@ Message * CMPIProviderManager::handleDel
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
PEG_TRACE_STRING(
TRC_PROVIDERMANAGER,
@@ -2591,12 +2638,16 @@ Message * CMPIProviderManager::handleDel
{
StatProviderTimeMeasurement providerTime(response);
- if (pr.miVector.indMI->ft->ftVersion >= 100)
+ if (pr.getIndMI()->ft->ftVersion >= 100)
{
- rc = pr.miVector.indMI->ft->deActivateFilter(
- pr.miVector.indMI,&eCtx,eSelx,
+ rc = pr.getIndMI()->ft->deActivateFilter(
+ pr.getIndMI(),
+ &eCtx,
+ eSelx,
CHARS(eSelx->classNames[0].getClassName().getString().
- getCString()),&eRef,prec==NULL);
+ getCString()),
+ &eRef,
+ prec==NULL);
}
else
{
@@ -2605,8 +2656,8 @@ Message * CMPIProviderManager::handleDel
rc = ((CMPIStatus (*)(CMPIIndicationMI*, CMPIContext*,
CMPIResult*, CMPISelectExp*,
const char *, CMPIObjectPath*, CMPIBoolean))
- pr.miVector.indMI->ft->deActivateFilter)
- (pr.miVector.indMI,&eCtx,NULL,eSelx,
+ pr.getIndMI()->ft->deActivateFilter)
+ (pr.getIndMI(),&eCtx,NULL,eSelx,
CHARS(eSelx->classNames[0].getClassName().getString().
getCString()),&eRef,prec==NULL);
}
@@ -2717,7 +2768,7 @@ Message * CMPIProviderManager::handleDis
{
try
{
- CMPIProvider::OpProviderHolder ph =
+ OpProviderHolder ph =
providerManager.getProvider(
physicalName,
providerName);
@@ -2904,7 +2955,7 @@ Message * CMPIProviderManager::handleSub
//
// Get cached or load new provider module
//
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
if ((const char*)info)
{
ph = providerManager.getRemoteProvider
@@ -3013,7 +3064,7 @@ Message * CMPIProviderManager::handleGet
request->instanceName.getKeyBindings());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -3045,7 +3096,7 @@ Message * CMPIProviderManager::handleGet
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT
AutoPtr<NormalizerContext> tmpNormalizerContext(
- new CIMOMHandleContext(*pr._cimom_handle));
+ new CIMOMHandleContext(*pr.getCIMOMHandle()));
request->operationContext.insert(
NormalizerContextContainer(tmpNormalizerContext));
#endif
@@ -3058,8 +3109,8 @@ Message * CMPIProviderManager::handleGet
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(GI_handler,&pr.broker);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ResultOnStack eRes(GI_handler,pr.getBroker());
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
// For the getInstance provider call, use the property list that we
// created containing the single property from the getProperty call.
@@ -3084,8 +3135,11 @@ Message * CMPIProviderManager::handleGet
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->getInstance(
- pr.miVector.instMI,&eCtx,&eRes,&eRef,
+ rc = pr.getInstMI()->ft->getInstance(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
(const char **)props.getList());
}
@@ -3222,7 +3276,7 @@ Message * CMPIProviderManager::handleSet
request->instanceName.getKeyBindings());
Boolean remote=false;
- CMPIProvider::OpProviderHolder ph;
+ OpProviderHolder ph;
// resolve provider name
ProviderIdContainer pidc =
@@ -3260,9 +3314,9 @@ Message * CMPIProviderManager::handleSet
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
CMPI_ObjectPathOnStack eRef(objectPath);
- CMPI_ResultOnStack eRes(MI_handler,&pr.broker);
+ CMPI_ResultOnStack eRes(MI_handler,pr.getBroker());
CMPI_InstanceOnStack eInst(localModifiedInstance);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
CMPIPropertyList props(localPropertyList);
@@ -3284,8 +3338,12 @@ Message * CMPIProviderManager::handleSet
{
StatProviderTimeMeasurement providerTime(response);
- rc = pr.miVector.instMI->ft->modifyInstance(
- pr.miVector.instMI,&eCtx,&eRes,&eRef,&eInst,
+ rc = pr.getInstMI()->ft->modifyInstance(
+ pr.getInstMI(),
+ &eCtx,
+ &eRes,
+ &eRef,
+ &eInst,
(const char **)props.getList());
}
@@ -3400,7 +3458,7 @@ ProviderName CMPIProviderManager::_resol
void CMPIProviderManager::_callEnableIndications
(CIMInstance & req_provider,
PEGASUS_INDICATION_CALLBACK_T _indicationCallback,
- CMPIProvider::OpProviderHolder & ph,
+ OpProviderHolder & ph,
const char* remoteInfo)
{
PEG_METHOD_ENTER(
@@ -3432,7 +3490,7 @@ void CMPIProviderManager::_callEnableInd
//
// Versions prior to 86 did not include enableIndications routine
//
- if (pr.miVector.indMI->ft->ftVersion >= 86)
+ if (pr.getIndMI()->ft->ftVersion >= 86)
{
OperationContext context;
#ifdef PEGASUS_ZOS_THREADLEVEL_SECURITY
@@ -3446,7 +3504,7 @@ void CMPIProviderManager::_callEnableInd
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(context);
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
// Add RemoteInformation -V 5245
if (remoteInfo)
@@ -3472,7 +3530,7 @@ void CMPIProviderManager::_callEnableInd
// breaking existing CMPI Indication providers. This is ok since
// there really isn't a user to which the problem should be
// reported.
- pr.miVector.indMI->ft->enableIndications(pr.miVector.indMI,&eCtx);
+ pr.getIndMI()->ft->enableIndications(pr.getIndMI(),&eCtx);
}
else
{
@@ -3515,7 +3573,7 @@ void CMPIProviderManager::_callEnableInd
}
void CMPIProviderManager::_callDisableIndications
- (CMPIProvider::OpProviderHolder & ph, const char *remoteInfo)
+ (OpProviderHolder & ph, const char *remoteInfo)
{
PEG_METHOD_ENTER(
TRC_PROVIDERMANAGER,
@@ -3539,7 +3597,7 @@ void CMPIProviderManager::_callDisableIn
//
// Versions prior to 86 did not include disableIndications routine
//
- if (pr.miVector.indMI->ft->ftVersion >= 86)
+ if (pr.getIndMI()->ft->ftVersion >= 86)
{
OperationContext context;
CMPIStatus rc={CMPI_RC_OK,NULL};
@@ -3550,7 +3608,7 @@ void CMPIProviderManager::_callDisableIn
eCtx.ft->addEntry(&eCtx,"CMPIRRemoteInfo",
(CMPIValue*)(const char*)remoteInfo,CMPI_chars);
}
- CMPI_ThreadContext thr(&pr.broker,&eCtx);
+ CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
PEG_TRACE_STRING(
TRC_PROVIDERMANAGER,
@@ -3566,8 +3624,8 @@ void CMPIProviderManager::_callDisableIn
// here. This will prevent us from breaking existing CMPI
// Indication providers. This is ok since there really isn't a
// user to which the problem should be reported.
- pr.miVector.indMI->ft->disableIndications(
- pr.miVector.indMI,
+ pr.getIndMI()->ft->disableIndications(
+ pr.getIndMI(),
&eCtx);
pr.unprotect();
diff -up pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.cpp.bz454590 pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.cpp
--- pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.cpp.bz454590 2008-02-20 11:22:58.000000000 +0100
+++ pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.cpp 2008-07-16 15:12:16.000000000 +0200
@@ -48,6 +48,13 @@
PEGASUS_USING_STD;
PEGASUS_NAMESPACE_BEGIN
+static const char _MSG_CANNOT_INIT_API_KEY[] =
+ "ProviderManager.CMPI.CMPIProvider.CANNOT_INIT_API";
+static const char _MSG_CANNOT_INIT_API[] =
+ "Error initializing CMPI MI $0, the following MI"
+ " factory function(s) returned an error: $1";
+
+
// set current operations to 1 to prevent an unload
// until the provider has had a chance to initialize
CMPIProvider::CMPIProvider(
@@ -62,9 +69,12 @@ CMPIProvider::CMPIProvider(
"CMPIProvider::CMPIProvider()");
_current_operations = 1;
_currentSubscriptions = 0;
- broker.hdl =0;
- broker.provider = this;
- if (mv) miVector=*mv;
+ _broker.hdl =0;
+ _broker.provider = this;
+ if (mv)
+ {
+ _miVector = *mv;
+ }
unloadStatus = CMPI_RC_DO_NOT_UNLOAD;
Time::gettimeofday(&_idleTime);
PEG_METHOD_EXIT();
@@ -86,7 +96,7 @@ void CMPIProvider::set(
CIMOMHandle *&cimomHandle)
{
_module = module;
- miVector = cmpiProvider;
+ _miVector = cmpiProvider;
_cimom_handle = cimomHandle;
}
@@ -107,6 +117,12 @@ String CMPIProvider::getName() const
{
return(_name.subString(1,PEG_NOT_FOUND));
}
+
+String CMPIProvider::getNameWithType() const
+{
+ return(_name);
+}
+
void setError(
ProviderVector &miVector,
String &error,
@@ -165,116 +181,12 @@ void CMPIProvider::initialize(
broker.clsCache.reset(new ClassCache());
broker.name=name;
- const OperationContext opc;
- CMPI_ContextOnStack eCtx(opc);
- CMPI_ThreadContext thr(&broker,&eCtx);
- CMPIStatus rcInst = {CMPI_RC_OK, NULL};
- CMPIStatus rcAssoc = {CMPI_RC_OK, NULL};
- CMPIStatus rcMeth = {CMPI_RC_OK, NULL};
- CMPIStatus rcProp = {CMPI_RC_OK, NULL};
- CMPIStatus rcInd = {CMPI_RC_OK, NULL};
- String error;
- String realProviderName(name);
+ miVector.instMI = NULL;
+ miVector.assocMI = NULL;
+ miVector.methMI = NULL;
+ miVector.propMI = NULL;
+ miVector.indMI = NULL;
- if (miVector.genericMode)
- {
- CString mName=realProviderName.getCString();
-
- if (miVector.miTypes & CMPI_MIType_Instance)
- {
- miVector.instMI =
- miVector.createGenInstMI(&broker,&eCtx,mName, &rcInst);
- }
- if (miVector.miTypes & CMPI_MIType_Association)
- {
- miVector.assocMI =
- miVector.createGenAssocMI(&broker,&eCtx,mName, &rcAssoc);
- }
- if (miVector.miTypes & CMPI_MIType_Method)
- {
- miVector.methMI =
- miVector.createGenMethMI(&broker,&eCtx,mName, &rcMeth);
- }
- if (miVector.miTypes & CMPI_MIType_Property)
- {
- miVector.propMI =
- miVector.createGenPropMI(&broker,&eCtx,mName, &rcProp);
- }
- if (miVector.miTypes & CMPI_MIType_Indication)
- {
- miVector.indMI =
- miVector.createGenIndMI(&broker,&eCtx,mName, &rcInd);
- }
- }
- else
- {
- if (miVector.miTypes & CMPI_MIType_Instance)
- miVector.instMI=miVector.createInstMI(&broker,&eCtx, &rcInst);
- if (miVector.miTypes & CMPI_MIType_Association)
- miVector.assocMI=miVector.createAssocMI(&broker,&eCtx, &rcAssoc);
- if (miVector.miTypes & CMPI_MIType_Method)
- miVector.methMI=miVector.createMethMI(&broker,&eCtx, &rcMeth);
- if (miVector.miTypes & CMPI_MIType_Property)
- miVector.propMI=miVector.createPropMI(&broker,&eCtx, &rcProp);
- if (miVector.miTypes & CMPI_MIType_Indication)
- miVector.indMI=miVector.createIndMI(&broker,&eCtx, &rcInd);
- }
-
- if (miVector.miTypes & CMPI_MIType_Instance)
- {
- if (miVector.instMI == NULL || rcInst.rc != CMPI_RC_OK)
- {
- setError(miVector, error, realProviderName,
- _Generic_Create_InstanceMI, _Create_InstanceMI,
- rcInst.msg);
- }
- }
- if (miVector.miTypes & CMPI_MIType_Association)
- {
- if (miVector.assocMI == NULL || rcAssoc.rc != CMPI_RC_OK)
- {
- setError(miVector, error, realProviderName,
- _Generic_Create_AssociationMI, _Create_AssociationMI,
- rcAssoc.msg);
- }
- }
- if (miVector.miTypes & CMPI_MIType_Method)
- {
- if (miVector.methMI == NULL || rcMeth.rc != CMPI_RC_OK)
- {
- setError(miVector, error, realProviderName,
- _Generic_Create_MethodMI, _Create_MethodMI,
- rcMeth.msg);
- }
- }
- if (miVector.miTypes & CMPI_MIType_Property)
- {
- if (miVector.propMI == NULL || rcProp.rc != CMPI_RC_OK)
- {
- setError(miVector, error, realProviderName,
- _Generic_Create_PropertyMI, _Create_PropertyMI,
- rcProp.msg);
- }
- }
- if (miVector.miTypes & CMPI_MIType_Indication)
- {
- if (miVector.indMI == NULL || rcInd.rc != CMPI_RC_OK)
- {
- setError(miVector, error, realProviderName,
- _Generic_Create_IndicationMI, _Create_IndicationMI,
- rcInd.msg);
- }
- }
-
- if (error.size() != 0)
- {
- throw Exception(MessageLoaderParms(
- "ProviderManager.CMPI.CMPIProvider.CANNOT_INIT_API",
- "Error initializing CMPI MI $0, "
- "the following MI factory function(s) returned an error: $1",
- realProviderName,
- error));
- }
PEG_METHOD_EXIT();
}
@@ -287,25 +199,14 @@ void CMPIProvider::initialize(CIMOMHandl
{
String compoundName;
if (_location.size() == 0)
- compoundName= providername;
- else
- compoundName=_location+":"+providername;
- try
{
- CMPIProvider::initialize(cimom,miVector,compoundName,broker);
- if (miVector.miTypes & CMPI_MIType_Method)
- {
- if (miVector.methMI->ft->miName==NULL)
- {
- unloadStatus = CMPI_RC_OK;
- }
- }
+ compoundName = providername;
}
- catch (...)
+ else
{
- _current_operations = 0;
- throw;
+ compoundName = _location + ":" + providername;
}
+ CMPIProvider::initialize(cimom,_miVector,compoundName,_broker);
_status = INITIALIZED;
_current_operations = 0;
}
@@ -377,7 +278,7 @@ void CMPIProvider::_terminate(Boolean te
const OperationContext opc;
CMPIStatus rc={CMPI_RC_OK,NULL};
CMPI_ContextOnStack eCtx(opc);
- CMPI_ThreadContext thr(&broker,&eCtx);
+ CMPI_ThreadContext thr(&_broker,&eCtx);
/*
@param terminating When true, the terminating argument indicates that the MB
is in the process of terminating and that cleanup must be done. When
@@ -392,38 +293,38 @@ void CMPIProvider::_terminate(Boolean te
CMPI_RC_NEVER_UNLOAD Operation successful - never unload.
*/
unloadStatus = CMPI_RC_OK;
- if (miVector.miTypes & CMPI_MIType_Instance)
+ if (_miVector.instMI)
{
- rc=miVector.instMI->ft->cleanup(miVector.instMI,&eCtx, terminating);
+ rc=_miVector.instMI->ft->cleanup(_miVector.instMI,&eCtx, terminating);
unloadStatus = rc.rc;
}
- if (miVector.miTypes & CMPI_MIType_Association)
+ if (_miVector.assocMI)
{
- rc=miVector.assocMI->ft->cleanup(miVector.assocMI,&eCtx, terminating);
+ rc=_miVector.assocMI->ft->cleanup(_miVector.assocMI,&eCtx, terminating);
if (unloadStatus == CMPI_RC_OK)
{
unloadStatus = rc.rc;
}
}
- if (miVector.miTypes & CMPI_MIType_Method)
+ if (_miVector.methMI)
{
- rc=miVector.methMI->ft->cleanup(miVector.methMI,&eCtx, terminating);
+ rc=_miVector.methMI->ft->cleanup(_miVector.methMI,&eCtx, terminating);
if (unloadStatus == CMPI_RC_OK)
{
unloadStatus = rc.rc;
}
}
- if (miVector.miTypes & CMPI_MIType_Property)
+ if (_miVector.propMI)
{
- rc=miVector.propMI->ft->cleanup(miVector.propMI,&eCtx, terminating);
+ rc=_miVector.propMI->ft->cleanup(_miVector.propMI,&eCtx, terminating);
if (unloadStatus == CMPI_RC_OK)
{
unloadStatus = rc.rc;
}
}
- if (miVector.miTypes & CMPI_MIType_Indication)
+ if (_miVector.indMI)
{
- rc=miVector.indMI->ft->cleanup(miVector.indMI,&eCtx, terminating);
+ rc=_miVector.indMI->ft->cleanup(_miVector.indMI,&eCtx, terminating);
if (unloadStatus == CMPI_RC_OK)
{
unloadStatus = rc.rc;
@@ -727,5 +628,307 @@ CIMInstance CMPIProvider::getProviderIns
return _providerInstance;
}
-PEGASUS_NAMESPACE_END
+void CMPIProvider::incCurrentOperations ()
+{
+ _current_operations++;
+}
+
+int CMPIProvider::getCurrentOperations ()
+{
+ return _current_operations.get();
+}
+
+void CMPIProvider::decCurrentOperations ()
+{
+ _current_operations--;
+}
+
+CIMOMHandle *CMPIProvider::getCIMOMHandle()
+{
+ return _cimom_handle;
+}
+
+CMPI_Broker *CMPIProvider::getBroker()
+{
+ return &_broker;
+}
+
+CMPIInstanceMI *CMPIProvider::getInstMI()
+{
+ if (_miVector.instMI == NULL)
+ {
+ AutoMutex mtx(_statusMutex);
+ if (_miVector.instMI == NULL)
+ {
+ const OperationContext opc;
+ CMPI_ContextOnStack eCtx(opc);
+ CMPIStatus rc = {CMPI_RC_OK, NULL};
+ String providerName = _broker.name;
+ CMPIInstanceMI *mi = NULL;
+
+ PEGASUS_ASSERT(_miVector.miTypes & CMPI_MIType_Instance);
+ if (_miVector.genericMode)
+ {
+ mi = _miVector.createGenInstMI(
+ &_broker,
+ &eCtx,
+ (const char *)providerName.getCString(),
+ &rc);
+ }
+ else
+ {
+ mi = _miVector.createInstMI(&_broker, &eCtx, &rc);
+ }
+
+ if (!mi || rc.rc != CMPI_RC_OK)
+ {
+ String error;
+ setError(
+ _miVector,
+ error,
+ getName(),
+ _Generic_Create_InstanceMI,
+ _Create_InstanceMI,
+ rc.msg);
+
+ throw Exception(
+ MessageLoaderParms(
+ _MSG_CANNOT_INIT_API_KEY,
+ _MSG_CANNOT_INIT_API,
+ getName(),
+ error));
+ }
+ _miVector.instMI = mi;
+ }
+ }
+
+ return _miVector.instMI;
+}
+
+CMPIMethodMI *CMPIProvider::getMethMI()
+{
+ if (_miVector.methMI == NULL)
+ {
+ AutoMutex mtx(_statusMutex);
+ if (_miVector.methMI == NULL)
+ {
+ const OperationContext opc;
+ CMPI_ContextOnStack eCtx(opc);
+ CMPIStatus rc = {CMPI_RC_OK, NULL};
+ String providerName = _broker.name;
+ CMPIMethodMI *mi;
+ PEGASUS_ASSERT(_miVector.miTypes & CMPI_MIType_Method);
+ if (_miVector.genericMode)
+ {
+ mi = _miVector.createGenMethMI(
+ &_broker,
+ &eCtx,
+ (const char *)providerName.getCString(),
+ &rc);
+ }
+ else
+ {
+ mi = _miVector.createMethMI(&_broker, &eCtx, &rc);
+ }
+ if (!mi || rc.rc != CMPI_RC_OK)
+ {
+ String error;
+ setError(
+ _miVector,
+ error,
+ getName(),
+ _Generic_Create_MethodMI,
+ _Create_MethodMI,
+ rc.msg);
+
+ throw Exception(
+ MessageLoaderParms(
+ _MSG_CANNOT_INIT_API_KEY,
+ _MSG_CANNOT_INIT_API,
+ getName(),
+ error));
+ }
+ _miVector.methMI = mi;
+ }
+ }
+
+ return _miVector.methMI;
+}
+
+CMPIAssociationMI *CMPIProvider::getAssocMI()
+{
+ if (_miVector.assocMI == NULL)
+ {
+ AutoMutex mtx(_statusMutex);
+ if (_miVector.assocMI == NULL)
+ {
+ const OperationContext opc;
+ CMPI_ContextOnStack eCtx(opc);
+ CMPIStatus rc = {CMPI_RC_OK, NULL};
+ String providerName = _broker.name;
+ CMPIAssociationMI *mi;
+ PEGASUS_ASSERT(_miVector.miTypes & CMPI_MIType_Association);
+ if (_miVector.genericMode)
+ {
+ mi = _miVector.createGenAssocMI(
+ &_broker,
+ &eCtx,
+ (const char *)providerName.getCString(),
+ &rc);
+ }
+ else
+ {
+ mi = _miVector.createAssocMI(&_broker, &eCtx, &rc);
+ }
+
+ if (!mi || rc.rc != CMPI_RC_OK)
+ {
+ String error;
+ setError(
+ _miVector,
+ error,
+ getName(),
+ _Generic_Create_AssociationMI,
+ _Create_AssociationMI,
+ rc.msg);
+
+ throw Exception(
+ MessageLoaderParms(
+ _MSG_CANNOT_INIT_API_KEY,
+ _MSG_CANNOT_INIT_API,
+ getName(),
+ error));
+ }
+ _miVector.assocMI = mi;
+ }
+ }
+
+ return _miVector.assocMI;
+}
+
+CMPIPropertyMI *CMPIProvider::getPropMI()
+{
+ if (_miVector.propMI == NULL)
+ {
+ AutoMutex mtx(_statusMutex);
+ if (_miVector.propMI == NULL)
+ {
+ const OperationContext opc;
+ CMPI_ContextOnStack eCtx(opc);
+ CMPIStatus rc = {CMPI_RC_OK, NULL};
+ String providerName = _broker.name;
+ CMPIPropertyMI *mi;
+ PEGASUS_ASSERT(_miVector.miTypes & CMPI_MIType_Property);
+
+ if (_miVector.genericMode)
+ {
+ mi = _miVector.createGenPropMI(
+ &_broker,
+ &eCtx,
+ (const char *)providerName.getCString(),
+ &rc);
+ }
+ else
+ {
+ mi = _miVector.createPropMI(&_broker, &eCtx, &rc);
+ }
+
+ if (!mi || rc.rc != CMPI_RC_OK)
+ {
+ String error;
+ setError(
+ _miVector,
+ error,
+ getName(),
+ _Generic_Create_PropertyMI,
+ _Create_PropertyMI,
+ rc.msg);
+
+ throw Exception(
+ MessageLoaderParms(
+ _MSG_CANNOT_INIT_API_KEY,
+ _MSG_CANNOT_INIT_API,
+ getName(),
+ error));
+ }
+ _miVector.propMI = mi;
+ }
+ }
+ return _miVector.propMI;
+}
+
+CMPIIndicationMI *CMPIProvider::getIndMI()
+{
+ if (_miVector.indMI == NULL)
+ {
+ AutoMutex mtx(_statusMutex);
+ if (_miVector.indMI == NULL)
+ {
+ const OperationContext opc;
+ CMPI_ContextOnStack eCtx(opc);
+ CMPIStatus rc = {CMPI_RC_OK, NULL};
+ String providerName = _broker.name;
+ CMPIIndicationMI *mi;
+ PEGASUS_ASSERT(_miVector.miTypes & CMPI_MIType_Indication);
+ if (_miVector.genericMode)
+ {
+ mi = _miVector.createGenIndMI(
+ &_broker,
+ &eCtx,
+ (const char *)providerName.getCString(),
+ &rc);
+ }
+ else
+ {
+ mi = _miVector.createIndMI(&_broker, &eCtx, &rc);
+ }
+
+ if (!mi || rc.rc != CMPI_RC_OK)
+ {
+ String error;
+ setError(
+ _miVector,
+ error,
+ getName(),
+ _Generic_Create_IndicationMI,
+ _Create_IndicationMI,
+ rc.msg);
+
+ throw Exception(
+ MessageLoaderParms(
+ _MSG_CANNOT_INIT_API_KEY,
+ _MSG_CANNOT_INIT_API,
+ getName(),
+ error));
+ }
+ _miVector.indMI = mi;
+ }
+ }
+
+ return _miVector.indMI;
+}
+
+CMPIProviderModule *CMPIProvider::getModule()
+{
+ return _module;
+}
+
+Uint32 CMPIProvider::getQuantum()
+{
+ AutoMutex mutex(_statusMutex);
+ return _quantum;
+}
+
+void CMPIProvider::setQuantum(Uint32 quantum)
+{
+ AutoMutex mutex(_statusMutex);
+ _quantum = quantum;
+}
+
+Mutex &CMPIProvider::getStatusMutex()
+{
+ return _statusMutex;
+}
+
+PEGASUS_NAMESPACE_END
diff -up pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.h.bz454590 pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.h
--- pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.h.bz454590 2007-09-10 10:56:32.000000000 +0200
+++ pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProvider.h 2008-07-16 15:12:16.000000000 +0200
@@ -178,6 +178,11 @@ public:
// typedef CMPIProviderFacade Base;
+ CMPIProvider(
+ const String & name,
+ CMPIProviderModule *module,
+ ProviderVector *mv);
+
virtual ~CMPIProvider();
virtual void initialize(CIMOMHandle & cimom);
@@ -192,6 +197,7 @@ public:
Status getStatus();
String getName() const;
+ String getNameWithType() const;
void reset();
@@ -312,20 +318,39 @@ public:
*/
CIMInstance getProviderInstance ();
+ void incCurrentOperations();
+ void decCurrentOperations();
+ int getCurrentOperations();
+
+ CIMOMHandle *getCIMOMHandle();
+ CMPI_Broker *getBroker();
+
+ CMPIInstanceMI *getInstMI();
+ CMPIMethodMI *getMethMI();
+ CMPIAssociationMI *getAssocMI();
+ CMPIPropertyMI *getPropMI();
+ CMPIIndicationMI *getIndMI();
+
+ CMPIProviderModule *getModule();
+ Uint32 getQuantum();
+ void setQuantum(Uint32 quantum);
+ Mutex &getStatusMutex();
+
+ void set(
+ CMPIProviderModule *&module,
+ ProviderVector base,
+ CIMOMHandle *&cimomHandle);
+
protected:
String _location;
Status _status;
CMPIProviderModule *_module;
- ProviderVector miVector;
- CMPI_Broker broker;
+ ProviderVector _miVector;
+ CMPI_Broker _broker;
CMPIrc unloadStatus;
private:
virtual void _terminate(Boolean term);
- CMPIProvider(
- const String & name,
- CMPIProviderModule *module,
- ProviderVector *mv);
static void initialize(
CIMOMHandle & cimom,
@@ -341,15 +366,7 @@ private:
*/
void waitUntilThreadsDone();
- void set(
- CMPIProviderModule *&module,
- ProviderVector base,
- CIMOMHandle *&cimomHandle);
-
- friend class CMPILocalProviderManager;
- friend class CMPIProviderManager;
class OpProviderHolder;
- friend class OpProviderHolder;
CIMOMHandle *_cimom_handle;
String _name;
AtomicInt _no_unload;
@@ -396,7 +413,7 @@ private:
generated the indication accepted a matching subscription.
*/
CIMInstance _providerInstance;
-//};
+};
//
@@ -404,67 +421,66 @@ private:
// for a CMPIProvider so it won't be unloaded during operations.
//
- class OpProviderHolder
+class OpProviderHolder
+{
+private:
+ CMPIProvider* _provider;
+public:
+ OpProviderHolder(): _provider( NULL )
{
- private:
- CMPIProvider* _provider;
-
- public:
- OpProviderHolder(): _provider( NULL )
- {
- }
- OpProviderHolder( const OpProviderHolder& p ): _provider( NULL )
- {
- SetProvider( p._provider );
- }
- OpProviderHolder( CMPIProvider* p ): _provider( NULL )
- {
- SetProvider( p );
- }
- ~OpProviderHolder()
- {
- UnSetProvider();
- }
- CMPIProvider& GetProvider()
- {
- return(*_provider);
- }
-
- OpProviderHolder& operator=( const OpProviderHolder& x )
+ }
+ OpProviderHolder( const OpProviderHolder& p ): _provider( NULL )
+ {
+ SetProvider( p._provider );
+ }
+ OpProviderHolder( CMPIProvider* p ): _provider( NULL )
+ {
+ SetProvider( p );
+ }
+ ~OpProviderHolder()
+ {
+ UnSetProvider();
+ }
+ CMPIProvider& GetProvider()
+ {
+ return(*_provider);
+ }
+ OpProviderHolder& operator=( const OpProviderHolder& x )
+ {
+ if (this == &x)
{
- if (this == &x)
- return(*this);
- SetProvider( x._provider );
return(*this);
}
+ SetProvider( x._provider );
+ return(*this);
+ }
- void SetProvider( CMPIProvider* p )
+ void SetProvider( CMPIProvider* p )
+ {
+ PEG_METHOD_ENTER(
+ TRC_CMPIPROVIDERINTERFACE,
+ "OpProviderHolder::SetProvider()");
+ UnSetProvider();
+ if (p)
{
- PEG_METHOD_ENTER(
- TRC_CMPIPROVIDERINTERFACE,
- "OpProviderHolder::SetProvider()");
- UnSetProvider();
- if (p)
- {
- _provider = p;
- _provider->_current_operations++;
- }
- PEG_METHOD_EXIT();
+ _provider = p;
+ _provider->incCurrentOperations();
}
+ PEG_METHOD_EXIT();
+ }
- void UnSetProvider()
+ void UnSetProvider()
+ {
+ PEG_METHOD_ENTER(
+ TRC_CMPIPROVIDERINTERFACE,
+ "OpProviderHolder::UnSetProvider()");
+ if (_provider)
{
- PEG_METHOD_ENTER(
- TRC_CMPIPROVIDERINTERFACE,
- "OpProviderHolder::UnSetProvider()");
- if (_provider)
- {
- _provider->_current_operations--;
- _provider = NULL;
- }
- PEG_METHOD_EXIT();
+ _provider->decCurrentOperations();
+ _provider = NULL;
}
- };
+ PEG_METHOD_EXIT();
+ }
};
PEGASUS_NAMESPACE_END
diff -up pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.h.bz454590 pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.h
--- pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.h.bz454590 2008-02-01 20:47:12.000000000 +0100
+++ pegasus/src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.h 2008-07-16 15:12:16.000000000 +0200
@@ -182,7 +182,7 @@ protected:
void _callEnableIndications(
CIMInstance & req_provider,
PEGASUS_INDICATION_CALLBACK_T _indicationCallback,
- CMPIProvider::OpProviderHolder & ph,
+ OpProviderHolder & ph,
const char *remoteInfo);
/**
@@ -193,7 +193,7 @@ protected:
@param remoteInfo Remote Information
*/
void _callDisableIndications(
- CMPIProvider::OpProviderHolder & ph,
+ OpProviderHolder & ph,
const char *remoteInfo);
};