version 1.54, 2004/06/29 23:42:54
|
version 1.61, 2005/01/20 22:05:19
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2004//////////////////////////////////////////////////////////////////////// |
// | // |
// 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. |
// | // |
// 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 |
|
|
| |
#include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> | #include <Pegasus/ProviderManager2/BasicProviderManagerRouter.h> |
#include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h> | #include <Pegasus/ProviderManager2/OOPProviderManagerRouter.h> |
|
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
// Determine whether Out-of-Process Provider support is enabled | // Determine whether Out-of-Process Provider support is enabled |
ConfigManager* configManager = ConfigManager::getInstance(); | ConfigManager* configManager = ConfigManager::getInstance(); |
if (String::equal( | if (String::equal( |
configManager->getCurrentValue("enableProviderProcesses"), "true")) |
configManager->getCurrentValue("forceProviderProcesses"), "true")) |
{ | { |
_providerManagerRouter = | _providerManagerRouter = |
new OOPProviderManagerRouter(indicationCallback); | new OOPProviderManagerRouter(indicationCallback); |
|
|
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"); |
|
|
PEGASUS_ASSERT(async != 0); | PEGASUS_ASSERT(async != 0); |
| |
Message * response = 0; | Message * response = 0; |
|
Boolean consumerLookupFailed = false; |
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.) |
|
|
|
// |
|
// Get the provider module instance to check for a disabled module |
|
// |
|
CIMInstance providerModule; |
|
| |
if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) | if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) |
{ | { |
|
// |
// Get a ProviderIdContainer for ExportIndicationRequestMessage. | // Get a ProviderIdContainer for ExportIndicationRequestMessage. |
// Note: This can be removed when the CIMExportRequestDispatcher | // Note: This can be removed when the CIMExportRequestDispatcher |
// is updated to add the ProviderIdContainer to the message. | // is updated to add the ProviderIdContainer to the message. |
|
// |
|
CIMInstance providerModule; |
CIMInstance provider; | CIMInstance provider; |
const CIMExportIndicationRequestMessage* expRequest = | const CIMExportIndicationRequestMessage* expRequest = |
dynamic_cast<const CIMExportIndicationRequestMessage*>(request); | dynamic_cast<const CIMExportIndicationRequestMessage*>(request); |
_providerRegistrationManager->lookupIndicationConsumer( |
if (_providerRegistrationManager->lookupIndicationConsumer( |
expRequest->destinationPath, provider, providerModule); |
expRequest->destinationPath, provider, providerModule)) |
|
{ |
request->operationContext.insert( | request->operationContext.insert( |
ProviderIdContainer(providerModule, provider)); | ProviderIdContainer(providerModule, provider)); |
} | } |
else | 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.) |
|
|
|
// |
|
// Get the provider module instance to check for a disabled module |
|
// |
|
CIMInstance providerModule; |
|
|
// The provider ID container is added to the OperationContext | // The provider ID container is added to the OperationContext |
// by the CIMOperationRequestDispatcher for all CIM operation | // by the CIMOperationRequestDispatcher for all CIM operation |
// requests to providers, so it does not need to be added again. | // requests to providers, so it does not need to be added again. |
|
|
ProviderIdContainer pidc = | ProviderIdContainer pidc = |
request->operationContext.get(ProviderIdContainer::NAME); | request->operationContext.get(ProviderIdContainer::NAME); |
providerModule = pidc.getModule(); | providerModule = pidc.getModule(); |
} |
|
| |
// | // |
// Check if the target provider is disabled | // Check if the target provider is disabled |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
void |
|
ProviderManagerService::handleCimResponse(CIMRequestMessage &request, |
|
CIMResponseMessage &response) |
|
{ |
|
CIMStatusCode code = CIM_ERR_SUCCESS; |
|
String message; |
|
|
|
try |
|
{ |
|
// only incomplete messages are processed because the caller ends up |
|
// sending the complete() stage |
|
PEGASUS_ASSERT(response.isComplete() == false); |
|
|
|
AsyncLegacyOperationStart *requestAsync = |
|
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); |
|
|
|
// set the destination |
|
op->_op_dest = op->_callback_response_q; |
|
|
|
MessageQueueService *service = |
|
dynamic_cast<MessageQueueService *>(op->_callback_response_q); |
|
|
|
PEGASUS_ASSERT(service); |
|
|
|
// the last chunk MUST be sent last, so use execute the callback |
|
// not all chunks are going through the dispatcher's chunk |
|
// resequencer, so this must be a synchronous call here |
|
// After the call is done, response and asyncResponse are now invalid |
|
// as they have been sent and deleted externally |
|
|
|
op->_async_callback(op, service, op->_callback_ptr); |
|
} |
|
|
|
catch(CIMException &e) |
|
{ |
|
code = e.getCode(); |
|
message = e.getMessage(); |
|
} |
|
catch(Exception &e) |
|
{ |
|
code = CIM_ERR_FAILED; |
|
message = e.getMessage(); |
|
} |
|
catch(...) |
|
{ |
|
code = CIM_ERR_FAILED; |
|
message = cimStatusCodeToString(code); |
|
} |
|
|
|
if (code != CIM_ERR_SUCCESS) |
|
response.cimException = PEGASUS_CIM_EXCEPTION(code, message); |
|
} |
|
|
void ProviderManagerService::unloadIdleProviders() | void ProviderManagerService::unloadIdleProviders() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
|
try | try |
{ | { |
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); | AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
}catch(Exception &e) |
}catch(const Exception &) |
{ | { |
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY)); | request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY)); |
} | } |