version 1.84.4.1, 2008/07/01 15:18:43
|
version 1.96, 2014/08/27 23:10:11
|
|
|
//%2006//////////////////////////////////////////////////////////////////////// |
//%LICENSE//////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Licensed to The Open Group (TOG) under one or more contributor license |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
// this work for additional information regarding copyright ownership. |
// IBM Corp.; EMC Corporation, The Open Group. |
// Each contributor licenses this file to you under the OpenPegasus Open |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// Source License; you may not use this file except in compliance with the |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// License. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// |
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// copy of this software and associated documentation files (the "Software"), |
// EMC Corporation; Symantec Corporation; The Open Group. |
// to deal in the Software without restriction, including without limitation |
// |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// and/or sell copies of the Software, and to permit persons to whom the |
// of this software and associated documentation files (the "Software"), to |
// Software is furnished to do so, subject to the following conditions: |
// deal in the Software without restriction, including without limitation the |
// |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// The above copyright notice and this permission notice shall be included |
// sell copies of the Software, and to permit persons to whom the Software is |
// in all copies or substantial portions of the Software. |
// furnished to do so, subject to the following conditions: |
// |
// |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
// | // |
//============================================================================== |
////////////////////////////////////////////////////////////////////////// |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
|
// A request class to hold the provider info passed to the |
|
// AsyncRequestExecutor for processing on different threads. |
|
class UnloadProviderRequest : public AsyncRequestExecutor::AsyncRequestMsg |
|
{ |
|
public: |
|
UnloadProviderRequest(ProviderMessageHandler* provider) |
|
:_provider(provider) {} |
|
|
|
public: |
|
ProviderMessageHandler* _provider; |
|
}; |
|
|
// | // |
// Default Provider Manager | // Default Provider Manager |
// | // |
|
|
response = _handleSubscriptionInitCompleteRequest(request); | response = _handleSubscriptionInitCompleteRequest(request); |
break; | break; |
| |
|
case CIM_INDICATION_SERVICE_DISABLED_REQUEST_MESSAGE: |
|
response = _handleIndicationServiceDisabledRequest(request); |
|
break; |
|
|
default: | default: |
PEGASUS_ASSERT(0); |
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
break; | break; |
} | } |
} | } |
catch (CIMException& e) | catch (CIMException& e) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", |
"CIMException: " + e.getMessage()); |
(const char*)e.getMessage().getCString())); |
response = request->buildResponse(); | response = request->buildResponse(); |
response->cimException = PEGASUS_CIM_EXCEPTION_LANG( | response->cimException = PEGASUS_CIM_EXCEPTION_LANG( |
e.getContentLanguages(), e.getCode(), e.getMessage()); | e.getContentLanguages(), e.getCode(), e.getMessage()); |
} | } |
catch (Exception& e) | catch (Exception& e) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s", |
"Exception: " + e.getMessage()); |
(const char*)e.getMessage().getCString())); |
response = request->buildResponse(); | response = request->buildResponse(); |
response->cimException = PEGASUS_CIM_EXCEPTION_LANG( | response->cimException = PEGASUS_CIM_EXCEPTION_LANG( |
e.getContentLanguages(), CIM_ERR_FAILED, e.getMessage()); | e.getContentLanguages(), CIM_ERR_FAILED, e.getMessage()); |
|
|
// get provider module name | // get provider module name |
String moduleName; | String moduleName; |
CIMInstance mInstance = request->providerModule; | CIMInstance mInstance = request->providerModule; |
Uint32 pos = mInstance.findProperty(CIMName("Name")); |
Uint32 pos = mInstance.findProperty(PEGASUS_PROPERTYNAME_NAME); |
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); | PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
mInstance.getProperty(pos).getValue().get(moduleName); | mInstance.getProperty(pos).getValue().get(moduleName); |
| |
|
|
{ | { |
String pName; | String pName; |
providerInstances[i].getProperty( | providerInstances[i].getProperty( |
providerInstances[i].findProperty("Name")). |
providerInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME)). |
getValue().get(pName); | getValue().get(pName); |
| |
Sint16 ret_value = _disableProvider(moduleName, pName); | Sint16 ret_value = _disableProvider(moduleName, pName); |
|
|
} | } |
catch (CIMException& e) | catch (CIMException& e) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", |
"Exception: " + e.getMessage()); |
(const char*)e.getMessage().getCString())); |
cimException = e; | cimException = e; |
} | } |
catch (Exception& e) | catch (Exception& e) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s", |
"Exception: " + e.getMessage()); |
(const char*)e.getMessage().getCString())); |
cimException = CIMException(CIM_ERR_FAILED, e.getMessage()); | cimException = CIMException(CIM_ERR_FAILED, e.getMessage()); |
} | } |
catch (...) | catch (...) |
|
|
return response; | return response; |
} | } |
| |
|
|
|
CIMResponseMessage* |
|
DefaultProviderManager::_handleIndicationServiceDisabledRequest( |
|
CIMRequestMessage* message) |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_handleIndicationServiceDisabledRequest"); |
|
|
|
CIMIndicationServiceDisabledRequestMessage* request = |
|
dynamic_cast<CIMIndicationServiceDisabledRequestMessage*>(message); |
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMIndicationServiceDisabledResponseMessage* response = |
|
dynamic_cast<CIMIndicationServiceDisabledResponseMessage*>( |
|
request->buildResponse()); |
|
PEGASUS_ASSERT(response != 0); |
|
|
|
_subscriptionInitComplete = false; |
|
|
|
// Make a copy of the table so it is not locked during the provider calls |
|
Array<ProviderMessageHandler*> providerList; |
|
{ |
|
AutoMutex lock(_providerTableMutex); |
|
|
|
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
|
{ |
|
providerList.append(i.value()); |
|
} |
|
} |
|
|
|
// |
|
// Notify all providers that indication service is disabled |
|
// |
|
for (Uint32 j = 0; j < providerList.size(); j++) |
|
{ |
|
AutoMutex lock(providerList[j]->status.getStatusMutex()); |
|
|
|
if (providerList[j]->status.isInitialized()) |
|
{ |
|
providerList[j]->indicationServiceDisabled(); |
|
} |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
return response; |
|
} |
|
|
CIMResponseMessage* | CIMResponseMessage* |
DefaultProviderManager::_handleSubscriptionInitCompleteRequest( | DefaultProviderManager::_handleSubscriptionInitCompleteRequest( |
CIMRequestMessage* message) | CIMRequestMessage* message) |
|
|
CIMValue genericValue; | CIMValue genericValue; |
| |
genericValue = providerId.getModule().getProperty( | genericValue = providerId.getModule().getProperty( |
providerId.getModule().findProperty("Name")).getValue(); |
providerId.getModule().findProperty( |
|
PEGASUS_PROPERTYNAME_NAME)).getValue(); |
genericValue.get(moduleName); | genericValue.get(moduleName); |
| |
genericValue = providerId.getProvider().getProperty( | genericValue = providerId.getProvider().getProperty( |
providerId.getProvider().findProperty("Name")).getValue(); |
providerId.getProvider().findProperty( |
|
PEGASUS_PROPERTYNAME_NAME)).getValue(); |
genericValue.get(providerName); | genericValue.get(providerName); |
| |
genericValue = providerId.getModule().getProperty( | genericValue = providerId.getModule().getProperty( |
|
|
if (resolvedFileName == String::EMPTY) | if (resolvedFileName == String::EMPTY) |
{ | { |
// Provider library not found | // Provider library not found |
String moduleName; |
|
genericValue = providerId.getModule().getProperty( |
|
providerId.getModule().findProperty("Name")).getValue(); |
|
genericValue.get(moduleName); |
|
|
|
throw Exception(MessageLoaderParms( | throw Exception(MessageLoaderParms( |
"ProviderManager.ProviderManagerService.PROVIDER_FILE_NOT_FOUND", | "ProviderManager.ProviderManagerService.PROVIDER_FILE_NOT_FOUND", |
"File \"$0\" was not found for provider module \"$1\".", | "File \"$0\" was not found for provider module \"$1\".", |
|
|
| |
ProviderOperationCounter poc(pr); | ProviderOperationCounter poc(pr); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Returning Provider %s", |
"Returning Provider " + providerName); |
(const char*)providerName.getCString())); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return poc; | return poc; |
|
|
ProviderMessageHandler* pr = 0; | ProviderMessageHandler* pr = 0; |
if (_providers.lookup(key, pr)) | if (_providers.lookup(key, pr)) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Found Provider " + providerName + " in Provider Manager Cache"); |
"Found Provider %s in Provider Manager Cache", |
|
(const char*)providerName.getCString())); |
} | } |
else | else |
{ | { |
|
|
// insert provider in provider table | // insert provider in provider table |
_providers.insert(key, pr); | _providers.insert(key, pr); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Created provider %s", |
"Created provider " + pr->getName()); |
(const char*)pr->getName().getCString())); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
return provider; | return provider; |
} | } |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Loading/Linking Provider Module " + moduleFileName); |
"Loading/Linking Provider Module %s", |
|
(const char*)moduleFileName.getCString())); |
| |
// load the provider | // load the provider |
try | try |
|
|
} | } |
catch (...) | catch (...) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
"Exception caught Loading/Linking Provider Module " + |
"Exception caught Loading/Linking Provider Module %s", |
moduleFileName); |
(const char*)moduleFileName.getCString())); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw; | throw; |
} | } |
| |
// initialize the provider | // initialize the provider |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, "Initializing Provider %s", |
"Initializing Provider " + provider->getName()); |
(const char*)provider->getName().getCString())); |
| |
CIMOMHandle* cimomHandle = new CIMOMHandle(); | CIMOMHandle* cimomHandle = new CIMOMHandle(); |
provider->status.setCIMOMHandle(cimomHandle); | provider->status.setCIMOMHandle(cimomHandle); |
|
|
} | } |
catch (...) | catch (...) |
{ | { |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
|
"Initialization Error. Provider %s", |
|
(const char*)provider->getName().getCString())); |
initializeError = true; | initializeError = true; |
} | } |
| |
|
|
if (_modules.lookup(moduleFileName, module)) | if (_modules.lookup(moduleFileName, module)) |
{ | { |
// found provider module in cache | // found provider module in cache |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Found Provider Module " + moduleFileName + |
"Found Provider Module %s in Provider Manager Cache", |
" in Provider Manager Cache"); |
(const char*)moduleFileName.getCString())); |
} | } |
else | else |
{ | { |
// provider module not found in cache, create provider module | // provider module not found in cache, create provider module |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Creating Provider Module " + moduleFileName); |
"Creating Provider Module %s", |
|
(const char*)moduleFileName.getCString())); |
| |
module = new ProviderModule(moduleFileName); | module = new ProviderModule(moduleFileName); |
| |
|
|
struct timeval providerTime = {0, 0}; | struct timeval providerTime = {0, 0}; |
provider->status.getLastOperationEndTime(&providerTime); | provider->status.getLastOperationEndTime(&providerTime); |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"provider->status.isIdle() returns: " + |
"provider->status.isIdle() returns: %s", |
CIMValue(provider->status.isIdle()).toString()); |
(const char*)CIMValue(provider->status.isIdle()) |
|
.toString().getCString())); |
| |
if (provider->status.isIdle() && | if (provider->status.isIdle() && |
((now.tv_sec - providerTime.tv_sec) > | ((now.tv_sec - providerTime.tv_sec) > |
((Sint32)PEGASUS_PROVIDER_IDLE_TIMEOUT_SECONDS))) | ((Sint32)PEGASUS_PROVIDER_IDLE_TIMEOUT_SECONDS))) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
"Unloading idle provider: " + provider->getName()); |
"Unloading idle provider: %s", |
|
(const char*)provider->getName().getCString())); |
_unloadProvider(provider); | _unloadProvider(provider); |
} | } |
} | } |
|
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"DefaultProviderManager::_shutdownAllProviders"); | "DefaultProviderManager::_shutdownAllProviders"); |
| |
try |
|
{ |
|
AutoMutex lock(_providerTableMutex); | AutoMutex lock(_providerTableMutex); |
|
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, | PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"providers in cache = %d", _providers.size())); | "providers in cache = %d", _providers.size())); |
| |
|
//create an array of UnloadProviderRequest requests one per |
|
//provider to process shutdown of providers simultaneously. |
|
Array<AsyncRequestExecutor::AsyncRequestMsg*> ProviderRequests; |
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) | for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
{ | { |
ProviderMessageHandler* provider = i.value(); |
AutoMutex lock(i.value()->status.getStatusMutex()); |
PEGASUS_ASSERT(provider != 0); |
if(i.value()->status.isInitialized()) |
|
|
AutoMutex lock(provider->status.getStatusMutex()); |
|
|
|
if (provider->status.isInitialized()) |
|
{ | { |
_unloadProvider(provider); |
ProviderRequests.append( |
} |
new UnloadProviderRequest(i.value())); |
} | } |
} | } |
catch (...) |
|
|
//run the stop request on all providers on multiple threads using |
|
//the request executor. This will invoke _asyncRequestCallback() on a |
|
//seperate thread for each provider which in turn will unload that |
|
//provider. |
|
|
|
CIMException exception = |
|
AsyncRequestExecutor(&_asyncRequestCallback,this).executeRequests( |
|
ProviderRequests); |
|
|
|
if(exception.getCode() != CIM_ERR_SUCCESS) |
{ | { |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, | PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"Unexpected Exception in _shutdownAllProviders()."); | "Unexpected Exception in _shutdownAllProviders()."); |
|
|
ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName); | ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName); |
if (!pr->status.isInitialized()) | if (!pr->status.isInitialized()) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"Provider " + providerName + " is not loaded"); |
"Provider %s is not loaded", |
|
(const char*)providerName.getCString())); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return 1; | return 1; |
} | } |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Disable Provider %s", |
"Disable Provider " + pr->getName()); |
(const char*)pr->getName().getCString())); |
// | // |
// Check to see if there are pending requests. If there are pending | // Check to see if there are pending requests. If there are pending |
// requests and the disable timeout has not expired, loop and wait one | // requests and the disable timeout has not expired, loop and wait one |
|
|
| |
if (pr->status.isInitialized()) | if (pr->status.isInitialized()) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Unloading Provider " + pr->getName()); |
"Unloading Provider %s", |
|
(const char*)pr->getName().getCString())); |
_unloadProvider(pr); | _unloadProvider(pr); |
} | } |
} | } |
catch (...) | catch (...) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"Unload provider failed " + pr->getName()); |
"Unload provider failed %s", |
|
(const char*)pr->getName().getCString())); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return -1; | return -1; |
} | } |
|
|
| |
if (provider->status.numCurrentOperations() > 0) | if (provider->status.numCurrentOperations() > 0) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Provider cannot be unloaded due to pending operations: " + |
"Provider cannot be unloaded due to pending operations: %s", |
provider->getName()); |
(const char*)provider->getName().getCString())); |
} | } |
else | else |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Terminating Provider " + provider->getName()); |
"Terminating Provider %s", |
|
(const char*)provider->getName().getCString())); |
| |
provider->terminate(); | provider->terminate(); |
| |
// unload provider module | // unload provider module |
PEGASUS_ASSERT(provider->status.getModule() != 0); | PEGASUS_ASSERT(provider->status.getModule() != 0); |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
"Unloading provider module: " + provider->getName()); |
"Unloading provider module: %s", |
|
(const char*)provider->getName().getCString())); |
provider->status.getModule()->unloadModule(); | provider->status.getModule()->unloadModule(); |
| |
PEG_TRACE(( |
PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3, |
TRC_PROVIDERMANAGER, |
|
Tracer::LEVEL3, |
|
"DefaultProviderManager: Unloaded provider %s", | "DefaultProviderManager: Unloaded provider %s", |
(const char*) provider->getName().getCString())); | (const char*) provider->getName().getCString())); |
| |
|
|
// above the unloadModule() call. See bugzilla 3669 for details. | // above the unloadModule() call. See bugzilla 3669 for details. |
| |
// delete the cimom handle | // delete the cimom handle |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Destroying provider's CIMOMHandle: " + provider->getName()); |
"Destroying provider's CIMOMHandle: %s", |
|
(const char*)provider->getName().getCString())); |
delete provider->status.getCIMOMHandle(); | delete provider->status.getCIMOMHandle(); |
| |
// set provider status to uninitialized | // set provider status to uninitialized |
|
|
return new DefaultProviderManager(); | return new DefaultProviderManager(); |
} | } |
| |
|
//async request handler method invoked on a seperate thread per provider |
|
//through the async request executor. |
|
CIMException DefaultProviderManager::_asyncRequestCallback( |
|
void *callbackPtr, |
|
AsyncRequestExecutor::AsyncRequestMsg* request) |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_asyncRequestCallback"); |
|
|
|
CIMException responseException; |
|
|
|
//extract the parameters |
|
UnloadProviderRequest* my_request = |
|
dynamic_cast<UnloadProviderRequest*>(request); |
|
if(my_request != NULL) |
|
{ |
|
PEGASUS_ASSERT(0 != callbackPtr); |
|
|
|
DefaultProviderManager *dpmPtr = |
|
static_cast<DefaultProviderManager*>(callbackPtr); |
|
|
|
ProviderMessageHandler* provider = |
|
dynamic_cast<ProviderMessageHandler*>(my_request->_provider); |
|
try |
|
{ |
|
AutoMutex lock(provider->status.getStatusMutex()); |
|
//unload the provider |
|
if (provider->status.isInitialized()) |
|
{ |
|
dpmPtr->_unloadProvider(provider); |
|
} |
|
else |
|
{ |
|
PEGASUS_ASSERT(0); |
|
} |
|
} |
|
catch (CIMException& e) |
|
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", |
|
(const char*)e.getMessage().getCString())); |
|
responseException = e; |
|
} |
|
catch (Exception& e) |
|
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s", |
|
(const char*)e.getMessage().getCString())); |
|
responseException = CIMException(CIM_ERR_FAILED, e.getMessage()); |
|
} |
|
catch (PEGASUS_STD(exception)& e) |
|
{ |
|
responseException = CIMException(CIM_ERR_FAILED, e.what()); |
|
} |
|
catch (...) |
|
{ |
|
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
|
"Exception: Unknown"); |
|
responseException = PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
} |
|
|
|
// delete the UnloadProviderRequest. |
|
delete request; |
|
|
|
PEG_METHOD_EXIT(); |
|
return responseException; |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |