version 1.4, 2003/11/21 11:31:22
|
version 1.4.6.2, 2004/03/02 19:43:41
|
|
|
// Modified By: Yi Zhou, Hewlett-Packard Company(yi_zhou@hp.com) | // Modified By: Yi Zhou, Hewlett-Packard Company(yi_zhou@hp.com) |
// Mike Day, IBM (mdday@us.ibm.com) | // Mike Day, IBM (mdday@us.ibm.com) |
// Adrian Schuur, schuur@de.ibm.com | // Adrian Schuur, schuur@de.ibm.com |
|
// Dan Gorey, IBM djgorey@us.ibm.com |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#define CMPI_VER_86 1 |
#include "CMPI_Version.h" |
| |
#include "CMPIProvider.h" | #include "CMPIProvider.h" |
| |
|
|
CMPIProviderModule *module, | CMPIProviderModule *module, |
ProviderVector *mv) | ProviderVector *mv) |
: _module(module), _cimom_handle(0), _name(name), | : _module(module), _cimom_handle(0), _name(name), |
_no_unload(0), _rm(0) |
_no_unload(0), _rm(0), _status(UNINITIALIZED) |
{ | { |
_current_operations = 1; | _current_operations = 1; |
miVector=*mv; | miVector=*mv; |
|
|
| |
CMPIProvider::CMPIProvider(CMPIProvider *pr) | CMPIProvider::CMPIProvider(CMPIProvider *pr) |
: _module(pr->_module), _cimom_handle(0), _name(pr->_name), | : _module(pr->_module), _cimom_handle(0), _name(pr->_name), |
_no_unload(0), _rm(0) |
_no_unload(0), _rm(0), _status(UNINITIALIZED) |
{ | { |
_current_operations = 1; | _current_operations = 1; |
miVector=pr->miVector; | miVector=pr->miVector; |
|
|
| |
} | } |
| |
CMPIProvider::Status CMPIProvider::getStatus(void) const |
CMPIProvider::Status CMPIProvider::getStatus(void) |
{ | { |
|
AutoMutex lock(_statusMutex); |
return(_status); | return(_status); |
} | } |
| |
|
void CMPIProvider::set(CMPIProviderModule *&module, |
|
ProviderVector cmpiProvider, |
|
CIMOMHandle *&cimomHandle) |
|
{ |
|
_module = module; |
|
miVector = cmpiProvider; |
|
_cimom_handle = cimomHandle; |
|
} |
|
|
|
void CMPIProvider::reset() |
|
{ |
|
_module = 0; |
|
_cimom_handle = 0; |
|
_no_unload = 0; |
|
_status = UNINITIALIZED; |
|
} |
|
|
CMPIProviderModule *CMPIProvider::getModule(void) const | CMPIProviderModule *CMPIProvider::getModule(void) const |
{ | { |
return(_module); | return(_module); |
|
|
void CMPIProvider::initialize(CIMOMHandle & cimom) | void CMPIProvider::initialize(CIMOMHandle & cimom) |
{ | { |
| |
_status = INITIALIZING; |
if(_status == UNINITIALIZED) |
|
{ |
| |
try | try |
{ | { |
|
|
} | } |
catch(...) | catch(...) |
{ | { |
_status = UNKNOWN; |
_current_operations = 0; |
_module->unloadModule(); |
|
throw; | throw; |
} | } |
|
|
_status = INITIALIZED; | _status = INITIALIZED; |
_current_operations = 0; | _current_operations = 0; |
} | } |
|
} |
| |
Boolean CMPIProvider::tryTerminate(void) | Boolean CMPIProvider::tryTerminate(void) |
{ | { |
|
Boolean terminated = false; |
|
|
|
if(_status == INITIALIZED) |
|
{ |
if(false == unload_ok()) | if(false == unload_ok()) |
{ | { |
return false; | return false; |
} | } |
| |
Status savedStatus=_status; | Status savedStatus=_status; |
_status = TERMINATING; |
|
Boolean terminated = false; |
|
| |
try |
|
{ |
|
// yield before a potentially lengthy operation. | // yield before a potentially lengthy operation. |
pegasus_yield(); | pegasus_yield(); |
try | try |
|
|
terminated = false; | terminated = false; |
| |
} | } |
// yield before a potentially lengthy operation. |
|
pegasus_yield(); |
|
if(terminated == true) | if(terminated == true) |
_module->unloadModule(); |
|
} |
|
catch(...) |
|
{ | { |
_status = UNKNOWN; |
_status = UNINITIALIZED; |
|
} |
} | } |
|
|
_status = TERMINATED; |
|
return terminated; | return terminated; |
} | } |
| |
void CMPIProvider::_terminate(void) | void CMPIProvider::_terminate(void) |
{ | { |
if (broker.clsCache) { | if (broker.clsCache) { |
cerr<<"--- CMPIProvider::_terminate() deleting ClassCache "<<endl; |
// cerr<<"--- CMPIProvider::_terminate() deleting ClassCache "<<endl; |
ClassCache::Iterator i=broker.clsCache->start(); | ClassCache::Iterator i=broker.clsCache->start(); |
for (; i; i++) { | for (; i; i++) { |
cerr<<"--- CMPIProvider::_terminate() deleting class " |
//cerr<<"--- CMPIProvider::_terminate() deleting class " |
<<i.value()->getClassName().getString()<<endl; |
// <<i.value()->getClassName().getString()<<endl; |
delete i.value(); } | delete i.value(); } |
delete broker.clsCache; | delete broker.clsCache; |
} | } |
|
|
void CMPIProvider::terminate(void) | void CMPIProvider::terminate(void) |
{ | { |
Status savedStatus=_status; | Status savedStatus=_status; |
_status = TERMINATING; |
if(_status == INITIALIZED) |
try |
|
{ | { |
// yield before a potentially lengthy operation. | // yield before a potentially lengthy operation. |
pegasus_yield(); | pegasus_yield(); |
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, | PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Exception caught in CMPIProviderFacade::Terminate for " + | "Exception caught in CMPIProviderFacade::Terminate for " + |
_name); | _name); |
} |
|
// yield before a potentially lengthy operation. |
|
pegasus_yield(); |
|
|
|
_module->unloadModule(); |
|
} |
|
catch(...) |
|
{ |
|
_status = UNKNOWN; |
|
|
|
throw; | throw; |
} | } |
|
} |
_status = TERMINATED; |
_status = UNINITIALIZED; |
|
|
} | } |
| |
Boolean CMPIProvider::operator == (const void *key) const | Boolean CMPIProvider::operator == (const void *key) const |