version 1.39, 2004/05/18 23:58:41
|
version 1.64, 2005/02/25 21:44:17
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// 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. |
// | // |
// 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 |
|
|
// Adrian Schuur, IBM (schuur@de.ibm.com) | // Adrian Schuur, IBM (schuur@de.ibm.com) |
// Amit K Arora (amita@in.ibm.com) for PEP-101 | // Amit K Arora (amita@in.ibm.com) for PEP-101 |
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Seema Gupta (gseema@in.ibm.com for PEP135) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/AutoPtr.h> | #include <Pegasus/Common/AutoPtr.h> |
|
#include <Pegasus/Common/Constants.h> |
| |
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
| |
#include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> | #include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> |
|
#include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h> |
|
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
static const Uint16 _MODULE_OK = 2; |
|
static const Uint16 _MODULE_STOPPING = 9; |
|
static const Uint16 _MODULE_STOPPED = 10; |
|
|
|
inline Boolean _isSupportedRequestType(const Message * message) | inline Boolean _isSupportedRequestType(const Message * message) |
{ | { |
// ATTN: needs implementation | // ATTN: needs implementation |
|
|
} | } |
| |
ProviderManagerService* ProviderManagerService::providerManagerService=NULL; | ProviderManagerService* ProviderManagerService::providerManagerService=NULL; |
CIMRepository* ProviderManagerService::_repository=NULL; |
|
Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; | Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND; |
| |
ProviderManagerService::ProviderManagerService(void) | ProviderManagerService::ProviderManagerService(void) |
|
|
_repository=repository; | _repository=repository; |
| |
_providerRegistrationManager = providerRegistrationManager; | _providerRegistrationManager = providerRegistrationManager; |
_providerManagerRouter = |
|
|
_unloadIdleProvidersBusy = 0; |
|
|
|
_basicProviderManagerRouter = 0; |
|
_oopProviderManagerRouter = 0; |
|
|
|
// Determine which ProviderManagerRouter(s) to use |
|
|
|
ConfigManager* configManager = ConfigManager::getInstance(); |
|
Boolean forceProviderProcesses = String::equal( |
|
configManager->getCurrentValue("forceProviderProcesses"), "true"); |
|
|
|
#ifdef PEGASUS_DISABLE_PROV_USERCTXT |
|
if (forceProviderProcesses) |
|
{ |
|
_oopProviderManagerRouter = |
|
new OOPProviderManagerRouter(indicationCallback); |
|
} |
|
else |
|
{ |
|
_basicProviderManagerRouter = |
|
new BasicProviderManagerRouter(indicationCallback); |
|
} |
|
#else |
|
_oopProviderManagerRouter = |
|
new OOPProviderManagerRouter(indicationCallback); |
|
|
|
if (!forceProviderProcesses) |
|
{ |
|
_basicProviderManagerRouter = |
new BasicProviderManagerRouter(indicationCallback); | new BasicProviderManagerRouter(indicationCallback); |
} | } |
|
#endif |
|
} |
| |
ProviderManagerService::~ProviderManagerService(void) | ProviderManagerService::~ProviderManagerService(void) |
{ | { |
delete _providerManagerRouter; |
delete _basicProviderManagerRouter; |
|
delete _oopProviderManagerRouter; |
providerManagerService=NULL; | providerManagerService=NULL; |
} | } |
| |
|
|
return; | return; |
} | } |
| |
|
// Note: This method should not throw an exception. It is used as a thread |
|
// entry point, and any exceptions thrown are ignored. |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL | PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
ProviderManagerService::handleCimOperation(void * arg) throw() |
ProviderManagerService::handleCimOperation(void * arg) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::handleCimOperation"); | "ProviderManagerService::handleCimOperation"); |
|
|
if (msg != 0) | if (msg != 0) |
{ | { |
AcceptLanguages* langs = | AcceptLanguages* langs = |
new AcceptLanguages(msg->acceptLanguages); |
new AcceptLanguages(((AcceptLanguageListContainer)msg->operationContext.get |
|
(AcceptLanguageListContainer::NAME)).getLanguages()); |
Thread::setLanguages(langs); | Thread::setLanguages(langs); |
} | } |
else | else |
|
|
PEGASUS_ASSERT(async != 0); | PEGASUS_ASSERT(async != 0); |
| |
Message * response = 0; | Message * response = 0; |
|
Boolean consumerLookupFailed = false; |
| |
if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) |
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)) |
|
{ | { |
// Handle CIMOperationRequestMessage and |
// |
// CIMExportIndicationRequestMessage |
// Get a ProviderIdContainer for ExportIndicationRequestMessage. |
|
// Note: This can be removed when the CIMExportRequestDispatcher |
|
// is updated to add the ProviderIdContainer to the message. |
|
// |
|
CIMInstance providerModule; |
|
CIMInstance provider; |
|
const CIMExportIndicationRequestMessage* expRequest = |
|
dynamic_cast<const CIMExportIndicationRequestMessage*>(request); |
|
if (_providerRegistrationManager->lookupIndicationConsumer( |
|
expRequest->destinationPath, provider, providerModule)) |
|
{ |
|
request->operationContext.insert( |
|
ProviderIdContainer(providerModule, provider)); |
|
} |
|
else |
|
{ |
|
consumerLookupFailed = true; |
|
} |
|
} |
|
|
|
if (consumerLookupFailed) |
|
{ |
|
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
response = cimResponse; |
|
} |
|
else if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
|
(dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) || |
|
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) || |
|
(request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE)) |
|
{ |
|
// Handle CIMOperationRequestMessage, CIMExportIndicationRequestMessage, |
|
// CIMIndicationRequestMessage, and CIMInitializeProviderRequestMessage. |
|
// (These should be blocked when the provider module is disabled.) |
| |
// Add provider information to OperationContext for the ProviderManager |
// |
ProviderIdContainer pidc = _getProviderIdContainer(request); |
// Get the provider module instance to check for a disabled module |
request->operationContext.insert(pidc); |
// |
|
CIMInstance providerModule; |
|
|
|
// The provider ID container is added to the OperationContext |
|
// by the CIMOperationRequestDispatcher for all CIM operation |
|
// requests to providers, so it does not need to be added again. |
|
// CIMInitializeProviderRequestMessage also has a provider ID |
|
// container. |
|
ProviderIdContainer pidc = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
|
|
|
// |
|
// Check if the target provider is disabled |
|
// |
|
Boolean moduleDisabled = false; |
|
Uint32 pos = providerModule.findProperty(CIMName("OperationalStatus")); |
|
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
Array<Uint16> operationalStatus; |
|
providerModule.getProperty(pos).getValue().get(operationalStatus); |
| |
response = _providerManagerRouter->processMessage(request); |
for(Uint32 i = 0; i < operationalStatus.size(); i++) |
|
{ |
|
if ((operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) || |
|
(operationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)) |
|
{ |
|
moduleDisabled = true; |
|
break; |
|
} |
|
} |
|
|
|
if (moduleDisabled) |
|
{ |
|
// |
|
// Send a "provider blocked" response |
|
// |
|
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_ACCESS_DENIED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService.PROVIDER_BLOCKED", |
|
"provider blocked.")); |
|
response = cimResponse; |
|
} |
|
else |
|
{ |
|
// |
|
// Forward the request to the appropriate ProviderManagerRouter |
|
// |
|
response = _processMessage(request); |
|
} |
} | } |
else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) | else if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
{ | { |
|
|
try | try |
{ | { |
// Forward the request to the ProviderManager | // Forward the request to the ProviderManager |
response = _providerManagerRouter->processMessage(request); |
response = _processMessage(request); |
| |
// If successful, update provider module status to OK | // If successful, update provider module status to OK |
// ATTN: Use CIMEnableModuleResponseMessage operationalStatus? | // ATTN: Use CIMEnableModuleResponseMessage operationalStatus? |
|
|
if (emResp->cimException.getCode() == CIM_ERR_SUCCESS) | if (emResp->cimException.getCode() == CIM_ERR_SUCCESS) |
{ | { |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_STOPPED, _MODULE_OK); |
providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPED, |
|
CIM_MSE_OPSTATUS_VALUE_OK); |
} | } |
} | } |
catch (Exception& e) | catch (Exception& e) |
|
|
if (updateModuleStatus) | if (updateModuleStatus) |
{ | { |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_OK, _MODULE_STOPPING); |
providerModule, CIM_MSE_OPSTATUS_VALUE_OK, |
|
CIM_MSE_OPSTATUS_VALUE_STOPPING); |
} | } |
| |
// Forward the request to the ProviderManager | // Forward the request to the ProviderManager |
response = _providerManagerRouter->processMessage(request); |
response = _processMessage(request); |
| |
// Update provider module status based on success or failure | // Update provider module status based on success or failure |
if (updateModuleStatus) | if (updateModuleStatus) |
|
|
{ | { |
// Disable operation failed. Module not stopped. | // Disable operation failed. Module not stopped. |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_STOPPING, _MODULE_OK); |
providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING, |
|
CIM_MSE_OPSTATUS_VALUE_OK); |
} | } |
else | else |
{ | { |
|
|
// depending on whether there are outstanding requests. | // depending on whether there are outstanding requests. |
// Use last operationalStatus entry. | // Use last operationalStatus entry. |
_updateProviderModuleStatus( | _updateProviderModuleStatus( |
providerModule, _MODULE_STOPPING, |
providerModule, CIM_MSE_OPSTATUS_VALUE_STOPPING, |
dmResp->operationalStatus[ | dmResp->operationalStatus[ |
dmResp->operationalStatus.size()-1]); | dmResp->operationalStatus.size()-1]); |
} | } |
|
|
} | } |
else | else |
{ | { |
response = _providerManagerRouter->processMessage(request); |
response = _processMessage(request); |
} | } |
| |
AsyncLegacyOperationResult * async_result = | AsyncLegacyOperationResult * async_result = |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void ProviderManagerService::unload_idle_providers(void) |
void |
|
ProviderManagerService::handleCimResponse(CIMRequestMessage &request, |
|
CIMResponseMessage &response) |
{ | { |
_providerManagerRouter->unload_idle_providers(); |
CIMStatusCode code = CIM_ERR_SUCCESS; |
} |
String message; |
| |
ProviderIdContainer ProviderManagerService::_getProviderIdContainer( |
try |
const CIMRequestMessage* message) |
|
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
// only incomplete messages are processed because the caller ends up |
"ProviderManagerService::_getProviderIdContainer"); |
// sending the complete() stage |
|
PEGASUS_ASSERT(response.isComplete() == false); |
| |
CIMInstance providerModule; |
AsyncLegacyOperationStart *requestAsync = |
CIMInstance provider; |
dynamic_cast<AsyncLegacyOperationStart *>(request._async); |
|
PEGASUS_ASSERT(requestAsync); |
|
AsyncOpNode *op = requestAsync->op; |
|
PEGASUS_ASSERT(op); |
|
PEGASUS_ASSERT(! response._async); |
|
response._async = new AsyncLegacyOperationResult |
|
(requestAsync->getKey(), requestAsync->getRouting(), op, &response); |
| |
switch (message->getType()) |
// set the destination |
{ |
op->_op_dest = op->_callback_response_q; |
case CIM_GET_CLASS_REQUEST_MESSAGE: |
|
case CIM_DELETE_CLASS_REQUEST_MESSAGE: |
|
case CIM_CREATE_CLASS_REQUEST_MESSAGE: |
|
case CIM_MODIFY_CLASS_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_SET_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE: |
|
// The ProviderManagerService does not support class operations |
|
PEGASUS_ASSERT(0); |
|
break; |
|
| |
case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
MessageQueueService *service = |
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
dynamic_cast<MessageQueueService *>(op->_callback_response_q); |
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
PEGASUS_ASSERT(service); |
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
// the last chunk MUST be sent last, so use execute the callback |
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
// not all chunks are going through the dispatcher's chunk |
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
// resequencer, so this must be a synchronous call here |
{ |
// After the call is done, response and asyncResponse are now invalid |
// Look up instance provider |
// as they have been sent and deleted externally |
const CIMOperationRequestMessage* request = |
|
dynamic_cast<const CIMOperationRequestMessage*>(message); |
op->_async_callback(op, service, op->_callback_ptr); |
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule); |
|
break; |
|
} | } |
| |
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
catch(CIMException &e) |
{ | { |
// Look up instance query provider |
code = e.getCode(); |
const CIMOperationRequestMessage* request = |
message = e.getMessage(); |
dynamic_cast<const CIMOperationRequestMessage*>(message); |
} |
Boolean hasNoQuery; |
catch(Exception &e) |
_providerRegistrationManager->lookupInstanceProvider( |
{ |
request->nameSpace, request->className, provider, providerModule, |
code = CIM_ERR_FAILED; |
0, &hasNoQuery); |
message = e.getMessage(); |
// We shouldn't have gotten this far if this isn't a query provider |
} |
PEGASUS_ASSERT(!hasNoQuery); |
catch(...) |
break; |
{ |
|
code = CIM_ERR_FAILED; |
|
message = cimStatusCodeToString(code); |
} | } |
| |
case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
if (code != CIM_ERR_SUCCESS) |
|
response.cimException = PEGASUS_CIM_EXCEPTION(code, message); |
|
} |
|
|
|
Message* ProviderManagerService::_processMessage(CIMRequestMessage* request) |
{ | { |
// Look up association provider |
Message* response = 0; |
const CIMAssociatorsRequestMessage* request = |
|
dynamic_cast<const CIMAssociatorsRequestMessage*>(message); |
if ((request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) || |
Array<CIMInstance> providerModules; |
(request->getType() == |
Array<CIMInstance> providers; |
CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE) || |
_providerRegistrationManager->lookupAssociationProvider( |
(request->getType() == CIM_NOTIFY_CONFIG_CHANGE_REQUEST_MESSAGE)) |
request->nameSpace, request->assocClass, |
{ |
providers, providerModules); |
if (_basicProviderManagerRouter) |
providerModule = providerModules[0]; |
{ |
provider = providers[0]; |
response = _basicProviderManagerRouter->processMessage(request); |
break; |
|
} | } |
| |
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
if (_oopProviderManagerRouter) |
{ | { |
// Look up association provider |
// Note: These responses do not contain interesting data, so just |
const CIMAssociatorNamesRequestMessage* request = |
// use the last one. |
dynamic_cast<const CIMAssociatorNamesRequestMessage*>(message); |
if (response) |
Array<CIMInstance> providerModules; |
{ |
Array<CIMInstance> providers; |
delete response; |
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->assocClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_REFERENCES_REQUEST_MESSAGE: |
response = _oopProviderManagerRouter->processMessage(request); |
|
} |
|
} |
|
else |
{ | { |
// Look up association provider |
CIMInstance providerModule; |
const CIMReferencesRequestMessage* request = |
|
dynamic_cast<const CIMReferencesRequestMessage*>(message); |
if (request->getType() == CIM_ENABLE_MODULE_REQUEST_MESSAGE) |
Array<CIMInstance> providerModules; |
{ |
Array<CIMInstance> providers; |
CIMEnableModuleRequestMessage* emReq = |
_providerRegistrationManager->lookupAssociationProvider( |
dynamic_cast<CIMEnableModuleRequestMessage*>(request); |
request->nameSpace, request->resultClass, |
providerModule = emReq->providerModule; |
providers, providerModules); |
} |
providerModule = providerModules[0]; |
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) |
provider = providers[0]; |
{ |
break; |
CIMDisableModuleRequestMessage* dmReq = |
|
dynamic_cast<CIMDisableModuleRequestMessage*>(request); |
|
providerModule = dmReq->providerModule; |
|
} |
|
else |
|
{ |
|
ProviderIdContainer pidc = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
} | } |
| |
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
Uint16 userContext = 0; |
|
Uint32 pos = providerModule.findProperty( |
|
PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT); |
|
if (pos != PEG_NOT_FOUND) |
{ | { |
// Look up association provider |
providerModule.getProperty(pos).getValue().get(userContext); |
const CIMReferenceNamesRequestMessage* request = |
|
dynamic_cast<const CIMReferenceNamesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->resultClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
break; |
|
} | } |
| |
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
// Forward the request to the appropriate ProviderManagerRouter, based |
|
// on the CIM Server configuration and the UserContext setting. |
|
|
|
ConfigManager* configManager = ConfigManager::getInstance(); |
|
Boolean forceProviderProcesses = String::equal( |
|
configManager->getCurrentValue("forceProviderProcesses"), "true"); |
|
|
|
if (forceProviderProcesses |
|
#ifndef PEGASUS_DISABLE_PROV_USERCTXT |
|
|| (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) |
|
|| (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED) |
|
|| ((userContext == PG_PROVMODULE_USERCTXT_PRIVILEGED) && |
|
!System::isPrivilegedUser(System::getEffectiveUserName())) |
|
#endif |
|
) |
{ | { |
// Look up method provider |
response = _oopProviderManagerRouter->processMessage(request); |
const CIMInvokeMethodRequestMessage* request = |
} |
dynamic_cast<const CIMInvokeMethodRequestMessage*>(message); |
else |
_providerRegistrationManager->lookupMethodProvider( |
{ |
request->nameSpace, request->className, request->methodName, |
response = _basicProviderManagerRouter->processMessage(request); |
provider, providerModule); |
} |
break; |
} |
|
|
|
return response; |
} | } |
| |
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
void ProviderManagerService::unloadIdleProviders() |
{ | { |
const CIMExportIndicationRequestMessage* request = |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
dynamic_cast<const CIMExportIndicationRequestMessage*>(message); |
"ProviderManagerService::unloadIdleProviders"); |
_providerRegistrationManager->lookupIndicationConsumer( |
|
request->destinationPath, provider, providerModule); |
// Ensure that only one _unloadIdleProvidersHandler thread runs at a time |
break; |
_unloadIdleProvidersBusy++; |
|
if ((_unloadIdleProvidersBusy.value() == 1) && |
|
(_thread_pool->allocate_and_awaken( |
|
(void*)this, ProviderManagerService::_unloadIdleProvidersHandler))) |
|
{ |
|
// _unloadIdleProvidersBusy is decremented in |
|
// _unloadIdleProvidersHandler |
|
} |
|
else |
|
{ |
|
// If we fail to allocate a thread, don't retry now. |
|
_unloadIdleProvidersBusy--; |
} | } |
| |
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
PEG_METHOD_EXIT(); |
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
|
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
|
{ |
|
// Provider information is already in the message |
|
const CIMIndicationRequestMessage* request = |
|
dynamic_cast<const CIMIndicationRequestMessage*>(message); |
|
providerModule = request->providerModule; |
|
provider = request->provider; |
|
break; |
|
} | } |
| |
case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
ProviderManagerService::_unloadIdleProvidersHandler(void* arg) throw() |
case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
{ |
case CIM_PROCESS_INDICATION_REQUEST_MESSAGE: |
try |
case CIM_HANDLE_INDICATION_REQUEST_MESSAGE: |
{ |
case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE: |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE: |
"ProviderManagerService::unloadIdleProvidersHandler"); |
// These messages are not handled by the ProviderManagerService |
|
PEGASUS_ASSERT(0); |
|
break; |
|
| |
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
ProviderManagerService* myself = |
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
reinterpret_cast<ProviderManagerService*>(arg); |
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
// These messages are handled specially by the ProviderManagerService |
if (myself->_basicProviderManagerRouter) |
PEGASUS_ASSERT(0); |
{ |
break; |
try |
|
{ |
|
myself->_basicProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"BasicProviderManagerRouter::_unloadIdleProviders"); |
|
} |
} | } |
| |
PEGASUS_ASSERT(!providerModule.isUninitialized()); |
if (myself->_oopProviderManagerRouter) |
PEGASUS_ASSERT(!provider.isUninitialized()); |
{ |
|
try |
|
{ |
|
myself->_oopProviderManagerRouter->unloadIdleProviders(); |
|
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception from " |
|
"OOPProviderManagerRouter::_unloadIdleProviders"); |
|
} |
|
} |
| |
|
myself->_unloadIdleProvidersBusy--; |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return ProviderIdContainer(providerModule, provider); |
} |
|
catch (...) |
|
{ |
|
// Ignore errors |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected exception in _unloadIdleProvidersHandler"); |
|
} |
|
|
|
return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
// Updates the providerModule instance and the ProviderRegistrationManager | // Updates the providerModule instance and the ProviderRegistrationManager |
|
|
void ProviderManagerService::indicationCallback( | void ProviderManagerService::indicationCallback( |
CIMProcessIndicationRequestMessage* request) | CIMProcessIndicationRequestMessage* request) |
{ | { |
|
try |
|
{ |
|
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
|
}catch(const Exception &) |
|
{ |
|
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY)); |
|
} |
|
|
if (_indicationServiceQueueId == PEG_NOT_FOUND) | if (_indicationServiceQueueId == PEG_NOT_FOUND) |
{ | { |
Array<Uint32> serviceIds; | Array<Uint32> serviceIds; |