version 1.2, 2003/08/19 04:24:57
|
version 1.96, 2014/08/27 23:10:11
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%LICENSE//////////////////////////////////////////////////////////////// |
// |
|
// Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
|
// |
|
// Permission is hereby granted, free of charge, to any person obtaining a copy |
|
// of this software and associated documentation files (the "Software"), to |
|
// deal in the Software without restriction, including without limitation the |
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
// sell copies of the Software, and to permit persons to whom the Software is |
|
// furnished to do so, subject to the following conditions: |
|
// |
|
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
|
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
|
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
// 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. |
|
// | // |
//============================================================================== |
// Licensed to The Open Group (TOG) under one or more contributor license |
|
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with |
|
// this work for additional information regarding copyright ownership. |
|
// Each contributor licenses this file to you under the OpenPegasus Open |
|
// Source License; you may not use this file except in compliance with the |
|
// License. |
|
// |
|
// Permission is hereby granted, free of charge, to any person obtaining a |
|
// copy of this software and associated documentation files (the "Software"), |
|
// to deal in the Software without restriction, including without limitation |
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
// and/or sell copies of the Software, and to permit persons to whom the |
|
// Software is furnished to do so, subject to the following conditions: |
|
// |
|
// The above copyright notice and this permission notice shall be included |
|
// in all copies or substantial portions of the Software. |
|
// |
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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. |
// | // |
// Author: Chip Vincent (cvincent@us.ibm.com) |
////////////////////////////////////////////////////////////////////////// |
// |
|
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Mike Day, IBM (mdday@us.ibm.com) |
|
// Karl Schopmeyer(k.schopmeyer@opengroup.org) - Fix associators. |
|
// Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
| |
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
#include <Pegasus/Common/OperationContext.h> | #include <Pegasus/Common/OperationContext.h> |
#include <Pegasus/Common/Destroyer.h> |
#include <Pegasus/Common/Time.h> |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/StatisticalData.h> | #include <Pegasus/Common/StatisticalData.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
#include <Pegasus/Common/MessageLoader.h> //l10n |
#include <Pegasus/Common/MessageLoader.h> |
|
#include <Pegasus/Common/FileSystem.h> |
#include <Pegasus/Config/ConfigManager.h> |
#include <Pegasus/Common/PegasusVersion.h> |
|
#include <Pegasus/Common/Constants.h> |
| |
#include <Pegasus/ProviderManager2/Default/Provider.h> |
#include <Pegasus/Query/QueryExpression/QueryExpression.h> |
#include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h> |
#include <Pegasus/ProviderManager2/QueryExpressionFactory.h> |
| |
#include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> |
#include <Pegasus/ProviderManager2/OperationResponseHandler.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
// auto variable to protect provider during operations |
|
class pm_service_op_lock |
|
{ |
|
private: |
|
pm_service_op_lock(void); |
|
|
|
public: |
|
pm_service_op_lock(Provider *provider) : _provider(provider) |
|
{ |
|
_provider->protect(); |
|
} |
|
| |
~pm_service_op_lock(void) |
// A request class to hold the provider info passed to the |
|
// AsyncRequestExecutor for processing on different threads. |
|
class UnloadProviderRequest : public AsyncRequestExecutor::AsyncRequestMsg |
{ | { |
_provider->unprotect(); |
public: |
} |
UnloadProviderRequest(ProviderMessageHandler* provider) |
|
:_provider(provider) {} |
| |
Provider * _provider; |
public: |
|
ProviderMessageHandler* _provider; |
}; | }; |
| |
// | // |
// Provider module status |
// Default Provider Manager |
// | // |
static const Uint16 _MODULE_OK = 2; |
DefaultProviderManager::DefaultProviderManager() |
static const Uint16 _MODULE_STOPPING = 9; |
{ |
static const Uint16 _MODULE_STOPPED = 10; |
_subscriptionInitComplete = false; |
|
} |
| |
// provider manager |
DefaultProviderManager::~DefaultProviderManager() |
LocalProviderManager providerManager; |
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::~DefaultProviderManager"); |
| |
DefaultProviderManager::DefaultProviderManager(void) |
_shutdownAllProviders(); |
|
|
|
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
{ | { |
|
ProviderMessageHandler* provider = i.value(); |
|
delete provider; |
} | } |
| |
DefaultProviderManager::~DefaultProviderManager(void) |
for (ModuleTable::Iterator j = _modules.start(); j != 0; j++) |
{ | { |
|
ProviderModule* module = j.value(); |
|
delete module; |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
} | } |
| |
Message * DefaultProviderManager::processMessage(Message * request) |
Message* DefaultProviderManager::processMessage(Message* message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"DefaultProviderManager::processMessage()"); | "DefaultProviderManager::processMessage()"); |
| |
Message * response = 0; |
CIMRequestMessage* request = dynamic_cast<CIMRequestMessage*>(message); |
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMResponseMessage* response = 0; |
| |
|
try |
|
{ |
// pass the request message to a handler method based on message type | // pass the request message to a handler method based on message type |
switch(request->getType()) | switch(request->getType()) |
{ | { |
case CIM_GET_INSTANCE_REQUEST_MESSAGE: | case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
response = handleGetInstanceRequest(request); |
|
|
|
break; |
|
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: | case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
response = handleEnumerateInstancesRequest(request); |
|
|
|
break; |
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: | case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
response = handleEnumerateInstanceNamesRequest(request); |
|
|
|
break; |
|
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: | case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
response = handleCreateInstanceRequest(request); |
|
|
|
break; |
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: | case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
response = handleModifyInstanceRequest(request); |
|
|
|
break; |
|
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: | case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
response = handleDeleteInstanceRequest(request); |
|
|
|
break; |
|
case CIM_EXEC_QUERY_REQUEST_MESSAGE: | case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
response = handleExecuteQueryRequest(request); |
|
|
|
break; |
|
case CIM_ASSOCIATORS_REQUEST_MESSAGE: | case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
response = handleAssociatorsRequest(request); |
|
|
|
break; |
|
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: | case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
response = handleAssociatorNamesRequest(request); |
|
|
|
break; |
|
case CIM_REFERENCES_REQUEST_MESSAGE: | case CIM_REFERENCES_REQUEST_MESSAGE: |
response = handleReferencesRequest(request); |
|
|
|
break; |
|
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: | case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
response = handleReferenceNamesRequest(request); |
|
|
|
break; |
|
case CIM_GET_PROPERTY_REQUEST_MESSAGE: | case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
response = handleGetPropertyRequest(request); |
|
|
|
break; |
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: | case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
response = handleSetPropertyRequest(request); |
|
|
|
break; |
|
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: | case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
response = handleInvokeMethodRequest(request); |
|
|
|
break; |
|
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: | case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleCreateSubscriptionRequest(request); |
|
|
|
break; |
|
case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: | case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleModifySubscriptionRequest(request); |
|
|
|
break; |
|
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: | case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
response = handleDeleteSubscriptionRequest(request); |
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
|
{ |
|
ProviderIdContainer providerId = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
| |
break; |
// resolve provider name |
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
ProviderName name = _resolveProviderName(providerId); |
response = handleEnableIndicationsRequest(request); |
|
| |
break; |
// get cached or load new provider module |
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
ProviderOperationCounter poc( |
response = handleDisableIndicationsRequest(request); |
_getProvider( |
|
name.getPhysicalName(), |
|
name.getModuleName(), |
|
name.getLogicalName())); |
| |
|
response = poc.GetProvider().processMessage(request); |
break; | break; |
case CIM_CONSUME_INDICATION_REQUEST_MESSAGE: |
} |
response = handleConsumeIndicationRequest(request); |
|
break; |
|
| |
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: | case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
response = handleDisableModuleRequest(request); |
response = _handleDisableModuleRequest(request); |
|
|
break; | break; |
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
|
response = handleEnableModuleRequest(request); |
|
| |
|
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
|
response = _handleEnableModuleRequest(request); |
break; | break; |
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
response = handleStopAllProvidersRequest(request); |
|
| |
|
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
// tell the provider manager to shutdown all the providers |
|
_shutdownAllProviders(); |
|
response = request->buildResponse(); |
break; | break; |
default: |
|
response = handleUnsupportedRequest(request); |
|
| |
|
case CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE: |
|
response = _handleSubscriptionInitCompleteRequest(request); |
break; | break; |
} |
|
| |
PEG_METHOD_EXIT(); |
case CIM_INDICATION_SERVICE_DISABLED_REQUEST_MESSAGE: |
|
response = _handleIndicationServiceDisabledRequest(request); |
|
break; |
| |
return(response); |
default: |
|
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);) |
|
break; |
} | } |
|
} |
Message * DefaultProviderManager::handleUnsupportedRequest(const Message * message) throw() |
catch (CIMException& e) |
|
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", |
|
(const char*)e.getMessage().getCString())); |
|
response = request->buildResponse(); |
|
response->cimException = PEGASUS_CIM_EXCEPTION_LANG( |
|
e.getContentLanguages(), e.getCode(), e.getMessage()); |
|
} |
|
catch (Exception& e) |
|
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s", |
|
(const char*)e.getMessage().getCString())); |
|
response = request->buildResponse(); |
|
response->cimException = PEGASUS_CIM_EXCEPTION_LANG( |
|
e.getContentLanguages(), CIM_ERR_FAILED, e.getMessage()); |
|
} |
|
catch (...) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleUnsupportedRequest"); |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
|
"Exception: Unknown"); |
|
response = request->buildResponse(); |
|
response->cimException = PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_FAILED, "Unknown error."); |
|
} |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return response; |
// a null response implies unsupported or unknown operation |
|
return(0); |
|
} | } |
| |
Message * DefaultProviderManager::handleGetInstanceRequest(const Message * message) throw() |
CIMResponseMessage* DefaultProviderManager::_handleDisableModuleRequest( |
|
CIMRequestMessage* message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetInstanceRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_handleDisableModuleRequest"); |
CIMGetInstanceRequestMessage * request = |
|
dynamic_cast<CIMGetInstanceRequestMessage *>(const_cast<Message *>(message)); |
|
| |
|
CIMDisableModuleRequestMessage* request = |
|
dynamic_cast<CIMDisableModuleRequestMessage*>(message); |
PEGASUS_ASSERT(request != 0); | PEGASUS_ASSERT(request != 0); |
| |
CIMGetInstanceResponseMessage * response = |
Array<Uint16> operationalStatus; |
new CIMGetInstanceResponseMessage( |
CIMException cimException; |
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
CIMInstance()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
// create a handler for this request |
|
GetInstanceResponseHandler handler(request, response); |
|
| |
try | try |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
// get provider module name |
"DefaultProviderManager::handleGetInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
String moduleName; |
System::getHostName(), |
CIMInstance mInstance = request->providerModule; |
request->nameSpace.getString(), |
Uint32 pos = mInstance.findProperty(PEGASUS_PROPERTYNAME_NAME); |
request->instanceName.getClassName().getString()); |
PEGASUS_ASSERT(pos != PEG_NOT_FOUND); |
|
mInstance.getProperty(pos).getValue().get(moduleName); |
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->instanceName.getClassName(), |
|
request->instanceName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMPropertyList propertyList(request->propertyList); |
|
|
|
// forward request |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.getInstance: " + |
|
ph.GetProvider().getName()); |
|
| |
pm_service_op_lock op_lock(&ph.GetProvider()); |
// |
|
// Unload providers |
|
// |
|
Array<CIMInstance> providerInstances = request->providers; |
| |
STAT_GETSTARTTIME; |
for (Uint32 i = 0, n = providerInstances.size(); i < n; i++) |
|
{ |
|
String pName; |
|
providerInstances[i].getProperty( |
|
providerInstances[i].findProperty(PEGASUS_PROPERTYNAME_NAME)). |
|
getValue().get(pName); |
| |
ph.GetProvider().getInstance( |
Sint16 ret_value = _disableProvider(moduleName, pName); |
context, |
|
objectPath, |
|
request->includeQualifiers, |
|
request->includeClassOrigin, |
|
propertyList, |
|
handler); |
|
| |
STAT_PMS_PROVIDEREND; |
if (ret_value == 0) |
|
{ |
|
// disable failed since there are pending requests, |
|
// stop trying to disable other providers in this module. |
|
operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK); |
|
break; |
|
} |
|
else if (ret_value != 1) // Not success |
|
{ |
|
// disable failed for other reason, throw exception |
|
throw PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService." |
|
"DISABLE_PROVIDER_FAILED", |
|
"Failed to disable the provider.")); |
|
} |
|
} |
} | } |
catch(CIMException & e) | catch(CIMException & e) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", |
"Exception: " + e.getMessage()); |
(const char*)e.getMessage().getCString())); |
|
cimException = e; |
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(Exception & e) | catch(Exception & e) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s", |
"Exception: " + e.getMessage()); |
(const char*)e.getMessage().getCString())); |
|
cimException = CIMException(CIM_ERR_FAILED, e.getMessage()); |
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(...) | catch(...) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
"Exception: Unknown"); | "Exception: Unknown"); |
|
cimException = PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService.UNKNOWN_ERROR", |
|
"Unknown Error")); |
|
} |
| |
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
if (cimException.getCode() == CIM_ERR_SUCCESS) |
|
{ |
|
// Status is set to OK if a provider was busy |
|
if (operationalStatus.size() == 0) |
|
{ |
|
operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_STOPPED); |
} | } |
|
} |
|
else |
|
{ |
|
// If exception occurs, module is not stopped |
|
operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK); |
|
} |
|
|
|
CIMDisableModuleResponseMessage* response = |
|
dynamic_cast<CIMDisableModuleResponseMessage*>( |
|
request->buildResponse()); |
|
PEGASUS_ASSERT(response != 0); |
|
|
|
response->operationalStatus = operationalStatus; |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
| |
return(response); |
return response; |
} | } |
| |
Message * DefaultProviderManager::handleEnumerateInstancesRequest(const Message * message) throw() |
CIMResponseMessage* DefaultProviderManager::_handleEnableModuleRequest( |
|
CIMRequestMessage* message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnumerateInstanceRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_handleEnableModuleRequest"); |
CIMEnumerateInstancesRequestMessage * request = |
|
dynamic_cast<CIMEnumerateInstancesRequestMessage *>(const_cast<Message *>(message)); |
|
| |
|
CIMEnableModuleRequestMessage* request = |
|
dynamic_cast<CIMEnableModuleRequestMessage*>(message); |
PEGASUS_ASSERT(request != 0); | PEGASUS_ASSERT(request != 0); |
| |
CIMEnumerateInstancesResponseMessage * response = |
Array<Uint16> operationalStatus; |
new CIMEnumerateInstancesResponseMessage( |
operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK); |
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMInstance>()); |
|
| |
|
CIMEnableModuleResponseMessage* response = |
|
dynamic_cast<CIMEnableModuleResponseMessage*>( |
|
request->buildResponse()); |
PEGASUS_ASSERT(response != 0); | PEGASUS_ASSERT(response != 0); |
| |
// preserve message key |
response->operationalStatus = operationalStatus; |
response->setKey(request->getKey()); |
|
| |
// Set HTTP method in response from request |
PEG_METHOD_EXIT(); |
response->setHttpMethod (request->getHttpMethod ()); |
return response; |
|
} |
| |
// create a handler for this request |
|
EnumerateInstancesResponseHandler handler(request, response); |
|
| |
try |
CIMResponseMessage* |
|
DefaultProviderManager::_handleIndicationServiceDisabledRequest( |
|
CIMRequestMessage* message) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"DefaultProviderManager::handleEnumerateInstancesRequest - Host name: $0 Name space: $1 Class name: $2", |
"DefaultProviderManager::_handleIndicationServiceDisabledRequest"); |
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->className.getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->className); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMPropertyList propertyList(request->propertyList); |
|
|
|
// forward request |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.enumerateInstances: " + |
|
ph.GetProvider().getName()); |
|
| |
pm_service_op_lock op_lock(&ph.GetProvider()); |
CIMIndicationServiceDisabledRequestMessage* request = |
|
dynamic_cast<CIMIndicationServiceDisabledRequestMessage*>(message); |
|
PEGASUS_ASSERT(request != 0); |
| |
STAT_GETSTARTTIME; |
CIMIndicationServiceDisabledResponseMessage* response = |
|
dynamic_cast<CIMIndicationServiceDisabledResponseMessage*>( |
|
request->buildResponse()); |
|
PEGASUS_ASSERT(response != 0); |
| |
ph.GetProvider().enumerateInstances( |
_subscriptionInitComplete = false; |
context, |
|
objectPath, |
|
request->includeQualifiers, |
|
request->includeClassOrigin, |
|
propertyList, |
|
handler); |
|
| |
STAT_PMS_PROVIDEREND; |
// Make a copy of the table so it is not locked during the provider calls |
} |
Array<ProviderMessageHandler*> providerList; |
catch(CIMException & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
AutoMutex lock(_providerTableMutex); |
"Exception: " + e.getMessage()); |
|
| |
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
} |
|
catch(Exception & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
providerList.append(i.value()); |
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(...) |
} |
|
|
|
// |
|
// Notify all providers that indication service is disabled |
|
// |
|
for (Uint32 j = 0; j < providerList.size(); j++) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
AutoMutex lock(providerList[j]->status.getStatusMutex()); |
"Exception: Unknown"); |
|
| |
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
if (providerList[j]->status.isInitialized()) |
|
{ |
|
providerList[j]->indicationServiceDisabled(); |
|
} |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return response; |
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleEnumerateInstanceNamesRequest(const Message * message) throw() |
CIMResponseMessage* |
|
DefaultProviderManager::_handleSubscriptionInitCompleteRequest( |
|
CIMRequestMessage* message) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnumerateInstanceNamesRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_handleSubscriptionInitCompleteRequest"); |
CIMEnumerateInstanceNamesRequestMessage * request = |
|
dynamic_cast<CIMEnumerateInstanceNamesRequestMessage *>(const_cast<Message *>(message)); |
|
| |
|
CIMSubscriptionInitCompleteRequestMessage* request = |
|
dynamic_cast<CIMSubscriptionInitCompleteRequestMessage*>(message); |
PEGASUS_ASSERT(request != 0); | PEGASUS_ASSERT(request != 0); |
| |
CIMEnumerateInstanceNamesResponseMessage * response = |
CIMSubscriptionInitCompleteResponseMessage* response = |
new CIMEnumerateInstanceNamesResponseMessage( |
dynamic_cast<CIMSubscriptionInitCompleteResponseMessage*>( |
request->messageId, |
request->buildResponse()); |
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMObjectPath>()); |
|
|
|
PEGASUS_ASSERT(response != 0); | PEGASUS_ASSERT(response != 0); |
| |
// preserve message key |
_subscriptionInitComplete = true; |
response->setKey(request->getKey()); |
|
|
|
//set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod());; |
|
|
|
// create a handler for this request |
|
EnumerateInstanceNamesResponseHandler handler(request, response); |
|
| |
// process the request |
// Make a copy of the table so it is not locked during the provider calls |
try |
Array<ProviderMessageHandler*> providerList; |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
AutoMutex lock(_providerTableMutex); |
"DefaultProviderManager::handleEnumerateInstanceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->className.getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->className); |
|
|
|
// build an internal provider name from the request arguments |
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
// resolve the physical and logical provider name |
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName()); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
// forward request |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.enumerateInstanceNames: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
| |
STAT_GETSTARTTIME; |
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
|
|
ph.GetProvider().enumerateInstanceNames( |
|
context, |
|
objectPath, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
providerList.append(i.value()); |
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(...) |
|
|
// |
|
// Notify all providers that subscription initialization is complete |
|
// |
|
for (Uint32 j = 0; j < providerList.size(); j++) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
AutoMutex lock(providerList[j]->status.getStatusMutex()); |
"Exception: Unknown"); |
|
| |
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
if (providerList[j]->status.isInitialized()) |
|
{ |
|
providerList[j]->subscriptionInitComplete(); |
|
} |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return response; |
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleCreateInstanceRequest(const Message * message) throw() |
ProviderName DefaultProviderManager::_resolveProviderName( |
|
const ProviderIdContainer& providerId) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateInstanceRequest"); |
String providerName; |
|
String fileName; |
|
String moduleName; |
|
CIMValue genericValue; |
| |
CIMCreateInstanceRequestMessage * request = |
genericValue = providerId.getModule().getProperty( |
dynamic_cast<CIMCreateInstanceRequestMessage *>(const_cast<Message *>(message)); |
providerId.getModule().findProperty( |
|
PEGASUS_PROPERTYNAME_NAME)).getValue(); |
|
genericValue.get(moduleName); |
| |
PEGASUS_ASSERT(request != 0); |
genericValue = providerId.getProvider().getProperty( |
|
providerId.getProvider().findProperty( |
|
PEGASUS_PROPERTYNAME_NAME)).getValue(); |
|
genericValue.get(providerName); |
| |
// create response message |
genericValue = providerId.getModule().getProperty( |
CIMCreateInstanceResponseMessage * response = |
providerId.getModule().findProperty("Location")).getValue(); |
new CIMCreateInstanceResponseMessage( |
genericValue.get(fileName); |
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
CIMObjectPath()); |
|
| |
PEGASUS_ASSERT(response != 0); |
String resolvedFileName = _resolvePhysicalName(fileName); |
|
|
|
if (resolvedFileName == String::EMPTY) |
|
{ |
|
// Provider library not found |
|
throw Exception(MessageLoaderParms( |
|
"ProviderManager.ProviderManagerService.PROVIDER_FILE_NOT_FOUND", |
|
"File \"$0\" was not found for provider module \"$1\".", |
|
FileSystem::buildLibraryFileName(fileName), moduleName)); |
|
} |
| |
// preserve message key |
return ProviderName(moduleName, providerName, resolvedFileName); |
response->setKey(request->getKey()); |
} |
| |
// Set HTTP method in response from request |
ProviderOperationCounter DefaultProviderManager::_getProvider( |
response->setHttpMethod (request->getHttpMethod ()); |
const String& moduleFileName, |
|
const String& moduleName, |
|
const String& providerName) |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_getProvider"); |
| |
// create a handler for this request |
ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName); |
CreateInstanceResponseHandler handler(request, response); |
|
| |
try |
if (!pr->status.isInitialized()) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
_initProvider(pr, moduleFileName); |
"DefaultProviderManager::handleCreateInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
} |
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->newInstance.getPath().getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->newInstance.getPath().getClassName(), |
|
request->newInstance.getPath().getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
| |
name = findProvider(name.toString()); |
AutoMutex lock(pr->status.getStatusMutex()); |
| |
// get cached or load new provider module |
if (!pr->status.isInitialized()) |
OpProviderHolder ph = |
{ |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
PEG_METHOD_EXIT(); |
|
throw PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_FAILED, "provider initialization failed"); |
|
} |
| |
// convert arguments |
ProviderOperationCounter poc(pr); |
OperationContext context; |
|
| |
context.insert(IdentityContainer(request->userName)); |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Returning Provider %s", |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
(const char*)providerName.getCString())); |
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
// forward request |
PEG_METHOD_EXIT(); |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
return poc; |
"Calling provider.createInstance: " + |
} |
ph.GetProvider().getName()); |
|
| |
pm_service_op_lock op_lock(&ph.GetProvider()); |
ProviderMessageHandler* DefaultProviderManager::_lookupProvider( |
|
const String& moduleName, |
|
const String& providerName) |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_lookupProvider"); |
| |
STAT_GETSTARTTIME; |
// lock the providerTable mutex |
|
AutoMutex lock(_providerTableMutex); |
| |
ph.GetProvider().createInstance( |
// Construct the lookup key. We need a compound key to differentiate |
context, |
// providers with the same name from different modules. The size field is |
objectPath, |
// added to handle the unlikely case when moduleName+providerName |
request->newInstance, |
// produce identical strings but define different providers. |
handler); |
char buffer[12]; |
|
sprintf(buffer, "%u:", providerName.size()); |
|
const String key = buffer + moduleName + ":" + providerName; |
| |
STAT_PMS_PROVIDEREND; |
// look up provider in cache |
} |
ProviderMessageHandler* pr = 0; |
catch(CIMException & e) |
if (_providers.lookup(key, pr)) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Exception: " + e.getMessage()); |
"Found Provider %s in Provider Manager Cache", |
|
(const char*)providerName.getCString())); |
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(Exception & e) |
else |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
// create provider |
"Exception: " + e.getMessage()); |
pr = new ProviderMessageHandler( |
|
moduleName, providerName, |
|
0, _indicationCallback, _responseChunkCallback, |
|
_subscriptionInitComplete); |
| |
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
// insert provider in provider table |
} |
_providers.insert(key, pr); |
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
| |
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Created provider %s", |
|
(const char*)pr->getName().getCString())); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return pr; |
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleModifyInstanceRequest(const Message * message) throw() |
ProviderMessageHandler* DefaultProviderManager::_initProvider( |
|
ProviderMessageHandler* provider, |
|
const String& moduleFileName) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifyInstanceRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_initProvider"); |
CIMModifyInstanceRequestMessage * request = |
|
dynamic_cast<CIMModifyInstanceRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
| |
// create response message |
ProviderModule* module = 0; |
CIMModifyInstanceResponseMessage * response = |
CIMProvider* base; |
new CIMModifyInstanceResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
| |
PEGASUS_ASSERT(response != 0); |
// lookup provider module |
|
module = _lookupModule(moduleFileName); |
| |
// preserve message key |
// lock the provider status mutex |
response->setKey(request->getKey()); |
AutoMutex lock(provider->status.getStatusMutex()); |
| |
// Set HTTP method in response from request |
if (provider->status.isInitialized()) |
response->setHttpMethod (request->getHttpMethod ()); |
{ |
|
// Initialization is already complete |
|
return provider; |
|
} |
| |
// create a handler for this request |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
ModifyInstanceResponseHandler handler(request, response); |
"Loading/Linking Provider Module %s", |
|
(const char*)moduleFileName.getCString())); |
| |
|
// load the provider |
try | try |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
base = module->load(provider->getName()); |
"DefaultProviderManager::handleModifyInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
} |
System::getHostName(), |
catch (...) |
request->nameSpace.getString(), |
{ |
request->modifiedInstance.getPath().getClassName().getString()); |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
|
"Exception caught Loading/Linking Provider Module %s", |
// make target object path |
(const char*)moduleFileName.getCString())); |
CIMObjectPath objectPath( |
PEG_METHOD_EXIT(); |
System::getHostName(), |
throw; |
request->nameSpace, |
} |
request->modifiedInstance.getPath ().getClassName(), |
|
request->modifiedInstance.getPath ().getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
| |
// get cached or load new provider module |
// initialize the provider |
OpProviderHolder ph = |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, "Initializing Provider %s", |
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
(const char*)provider->getName().getCString())); |
| |
// convert arguments |
CIMOMHandle* cimomHandle = new CIMOMHandle(); |
OperationContext context; |
provider->status.setCIMOMHandle(cimomHandle); |
|
provider->status.setModule(module); |
|
provider->setProvider(base); |
| |
context.insert(IdentityContainer(request->userName)); |
Boolean initializeError = false; |
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
| |
CIMPropertyList propertyList(request->propertyList); |
try |
|
{ |
|
provider->initialize(*cimomHandle); |
|
} |
|
catch (...) |
|
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
|
"Initialization Error. Provider %s", |
|
(const char*)provider->getName().getCString())); |
|
initializeError = true; |
|
} |
| |
// forward request |
// The cleanup code executed when an exception occurs was previously |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
// included in the catch block above. Unloading the provider module |
"Calling provider.modifyInstance: " + |
// from inside the catch block resulted in a crash when an exception |
ph.GetProvider().getName()); |
// was thrown from a provider's initialize() method. The issue is that |
|
// when an exception is thrown, the program maintains internal |
|
// pointers related to the code that threw the exception. In the case |
|
// of an exception thrown from a provider during the initialize() |
|
// method, those pointers point into the provider library, so when |
|
// the DefaultProviderManager unloads the library, the pointers into |
|
// the library that the program was holding are invalid. |
| |
pm_service_op_lock op_lock(&ph.GetProvider()); |
if (initializeError == true) |
|
{ |
|
// Allow the provider to clean up |
|
provider->terminate(); |
| |
STAT_GETSTARTTIME; |
// delete the cimom handle |
|
delete cimomHandle; |
| |
ph.GetProvider().modifyInstance( |
provider->setProvider(0); |
context, |
|
objectPath, |
|
request->modifiedInstance, |
|
request->includeQualifiers, |
|
propertyList, |
|
handler); |
|
| |
STAT_PMS_PROVIDEREND; |
// unload provider module |
|
module->unloadModule(); |
} | } |
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
| |
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
provider->status.setInitialized(!initializeError); |
|
|
|
PEG_METHOD_EXIT(); |
|
return provider; |
} | } |
catch(Exception & e) |
|
|
ProviderModule* DefaultProviderManager::_lookupModule( |
|
const String& moduleFileName) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"Exception: " + e.getMessage()); |
"DefaultProviderManager::_lookupModule"); |
| |
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
// lock the providerTable mutex |
|
AutoMutex lock(_providerTableMutex); |
|
|
|
// look up provider module in cache |
|
ProviderModule* module = 0; |
|
|
|
if (_modules.lookup(moduleFileName, module)) |
|
{ |
|
// found provider module in cache |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Found Provider Module %s in Provider Manager Cache", |
|
(const char*)moduleFileName.getCString())); |
} | } |
catch(...) |
else |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
// provider module not found in cache, create provider module |
"Exception: Unknown"); |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Creating Provider Module %s", |
|
(const char*)moduleFileName.getCString())); |
|
|
|
module = new ProviderModule(moduleFileName); |
| |
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
// insert provider module in module table |
|
_modules.insert(moduleFileName, module); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return module; |
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleDeleteInstanceRequest(const Message * message) throw() |
Boolean DefaultProviderManager::hasActiveProviders() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteInstanceRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::hasActiveProviders"); |
| |
CIMDeleteInstanceRequestMessage * request = |
try |
dynamic_cast<CIMDeleteInstanceRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
// create response message |
|
CIMDeleteInstanceResponseMessage * response = |
|
new CIMDeleteInstanceResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
// create a handler for this request |
|
DeleteInstanceResponseHandler handler(request, response); |
|
|
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleDeleteInstanceRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->instanceName.getClassName(), |
|
request->instanceName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
// forward request |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.deleteInstance: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
STAT_GETSTARTTIME; |
|
|
|
ph.GetProvider().deleteInstance( |
|
context, |
|
objectPath, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleExecuteQueryRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleExecuteQueryRequest"); |
|
|
|
CIMExecQueryRequestMessage * request = |
|
dynamic_cast<CIMExecQueryRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
//l10n |
|
CIMExecQueryResponseMessage * response = |
|
new CIMExecQueryResponseMessage( |
|
request->messageId, |
|
PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED", |
|
"not implemented")), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMObject>()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
// l10n |
|
// ATTN: when this is implemented, need to add the language containers to the |
|
// OperationContext. See how the other requests do it. |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleAssociatorsRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorsRequest"); |
|
|
|
CIMAssociatorsRequestMessage * request = |
|
dynamic_cast<CIMAssociatorsRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMAssociatorsResponseMessage * response = |
|
new CIMAssociatorsResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMObject>()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// create a handler for this request |
|
AssociatorsResponseHandler handler(request, response); |
|
|
|
// process the request |
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleAssociatorsRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName()); |
|
|
|
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
// ATTN KS STAT_GETSTARTTIME; |
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().associators( |
|
context, |
|
objectPath, |
|
request->assocClass, |
|
request->resultClass, |
|
request->role, |
|
request->resultRole, |
|
request->includeQualifiers, |
|
request->includeClassOrigin, |
|
request->propertyList.getPropertyNameArray(), |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleAssociatorNamesRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleAssociatorNamesRequest"); |
|
|
|
CIMAssociatorNamesRequestMessage * request = |
|
dynamic_cast<CIMAssociatorNamesRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMAssociatorNamesResponseMessage * response = |
|
new CIMAssociatorNamesResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMObjectPath>()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
// create a handler for this request |
|
AssociatorNamesResponseHandler handler(request, response); |
|
|
|
// process the request |
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleAssociationNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName()); |
|
|
|
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().associatorNames( |
|
context, |
|
objectPath, |
|
request->assocClass, |
|
request->resultClass, |
|
request->role, |
|
request->resultRole, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleReferencesRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferencesRequest"); |
|
|
|
CIMReferencesRequestMessage * request = |
|
dynamic_cast<CIMReferencesRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMReferencesResponseMessage * response = |
|
new CIMReferencesResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMObject>()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
// create a handler for this request |
|
ReferencesResponseHandler handler(request, response); |
|
|
|
// process the request |
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleReferencesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName()); |
|
|
|
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
STAT_GETSTARTTIME; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.references: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().references( |
|
context, |
|
objectPath, |
|
request->resultClass, |
|
request->role, |
|
request->includeQualifiers, |
|
request->includeClassOrigin, |
|
request->propertyList.getPropertyNameArray(), |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleReferenceNamesRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleReferenceNamesRequest"); |
|
|
|
CIMReferenceNamesRequestMessage * request = |
|
dynamic_cast<CIMReferenceNamesRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMReferenceNamesResponseMessage * response = |
|
new CIMReferenceNamesResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
Array<CIMObjectPath>()); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
// create a handler for this request |
|
ReferenceNamesResponseHandler handler(request, response); |
|
|
|
// process the request |
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleReferenceNamesRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->objectName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->objectName.getClassName()); |
|
|
|
objectPath.setKeyBindings(request->objectName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
STAT_GETSTARTTIME; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.referenceNames: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().referenceNames( |
|
context, |
|
objectPath, |
|
request->resultClass, |
|
request->role, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleGetPropertyRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleGetPropertyRequest"); |
|
|
|
CIMGetPropertyRequestMessage * request = |
|
dynamic_cast<CIMGetPropertyRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
// create response message |
|
CIMGetPropertyResponseMessage * response = |
|
new CIMGetPropertyResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
CIMValue()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
GetPropertyResponseHandler handler(request, response); |
|
|
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleGetPropertyRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->instanceName.getClassName(), |
|
request->instanceName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMName propertyName = request->propertyName; |
|
|
|
STAT_GETSTARTTIME; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.getProperty: " + |
|
ph.GetProvider().getName()); |
|
|
|
// forward request |
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().getProperty( |
|
context, |
|
objectPath, |
|
propertyName, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleSetPropertyRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleSetPropertyRequest"); |
|
|
|
CIMSetPropertyRequestMessage * request = |
|
dynamic_cast<CIMSetPropertyRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
// create response message |
|
//l10n |
|
CIMSetPropertyResponseMessage * response = |
|
new CIMSetPropertyResponseMessage( |
|
request->messageId, |
|
PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.NOT_IMPLEMENTED", |
|
"not implemented")), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
SetPropertyResponseHandler handler(request, response); |
|
|
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleSetPropertyRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->instanceName.getClassName(), |
|
request->instanceName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMName propertyName = request->propertyName; |
|
CIMValue propertyValue = request->newValue; |
|
|
|
STAT_GETSTARTTIME; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.setProperty: " + |
|
ph.GetProvider().getName()); |
|
|
|
// forward request |
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().setProperty( |
|
context, |
|
objectPath, |
|
propertyName, |
|
propertyValue, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleInvokeMethodRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleInvokeMethodRequest"); |
|
|
|
CIMInvokeMethodRequestMessage * request = |
|
dynamic_cast<CIMInvokeMethodRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
// create response message |
|
CIMInvokeMethodResponseMessage * response = |
|
new CIMInvokeMethodResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
CIMValue(), |
|
Array<CIMParamValue>(), |
|
request->methodName); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// propagate message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
// create a handler for this request |
|
InvokeMethodResponseHandler handler(request, response); |
|
|
|
try |
|
{ |
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleInvokeMethodRequest - Host name: $0 Name space: $1 Class name: $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
request->instanceName.getClassName().getString()); |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->instanceName.getClassName(), |
|
request->instanceName.getKeyBindings()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMObjectPath instanceReference(request->instanceName); |
|
|
|
// ATTN: propagate namespace |
|
instanceReference.setNameSpace(request->nameSpace); |
|
|
|
// forward request |
|
STAT_GETSTARTTIME; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.invokeMethod: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().invokeMethod( |
|
context, |
|
instanceReference, |
|
request->methodName, |
|
request->inParameters, |
|
handler); |
|
|
|
STAT_PMS_PROVIDEREND; |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown error."); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleCreateSubscriptionRequest(const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleCreateSubscriptionRequest"); |
|
|
|
CIMCreateSubscriptionRequestMessage * request = |
|
dynamic_cast<CIMCreateSubscriptionRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMCreateSubscriptionResponseMessage * response = |
|
new CIMCreateSubscriptionResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
OperationResponseHandler handler(request, response); |
|
|
|
try |
|
{ |
|
String temp; |
|
|
|
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) |
|
{ |
|
temp.append(request->classNames[i].getString()); |
|
|
|
if(i == (n - 1)) |
|
{ |
|
temp.append(", "); |
|
} |
|
} |
|
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleCreateSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
temp); |
|
|
|
// NOTE: the provider and provider module name are embedded in the request, presumably to reduce |
|
// the number of provider lookups (but this should be trivial if the data is cached and accessed |
|
// from the same source). to keep the lookups consistent, use the first class name, combined |
|
// with the other information in the request, and create an object path that can be used to |
|
// resolve the provider using the ProviderRegistrar. |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0].getString()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(SubscriptionInstanceContainer |
|
(request->subscriptionInstance)); |
|
context.insert(SubscriptionFilterConditionContainer |
|
(request->condition, request->queryLanguage)); |
|
context.insert(SubscriptionLanguageListContainer |
|
(request->acceptLanguages)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
|
|
|
Array<CIMObjectPath> classNames; |
|
|
|
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) |
|
{ |
|
CIMObjectPath className( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[i]); |
|
|
|
classNames.append(className); |
|
} |
|
|
|
CIMPropertyList propertyList = request->propertyList; |
|
|
|
Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.createSubscription: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().createSubscription( |
|
context, |
|
subscriptionName, |
|
classNames, |
|
propertyList, |
|
repeatNotificationPolicy); |
|
} |
|
catch(CIMException & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} |
|
catch(...) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: Unknown"); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown Error"); |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleModifySubscriptionRequest( const Message * message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleModifySubscriptionRequest"); |
|
|
|
CIMModifySubscriptionRequestMessage * request = |
|
dynamic_cast<CIMModifySubscriptionRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMModifySubscriptionResponseMessage * response = |
|
new CIMModifySubscriptionResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
OperationResponseHandler handler(request, response); |
|
|
|
try |
|
{ |
|
String temp; |
|
|
|
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) |
|
{ |
|
temp.append(request->classNames[i].getString()); |
|
|
|
if(i == (n - 1)) |
|
{ |
|
temp.append(", "); |
|
} |
|
} |
|
|
|
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"DefaultProviderManager::handleModifySubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2", |
|
System::getHostName(), |
|
request->nameSpace.getString(), |
|
temp); |
|
|
|
// NOTE: the provider and provider module name are embedded in the request, presumably to reduce |
|
// the number of provider lookups (but this should be trivial if the data is cached and accessed |
|
// from the same source). to keep the lookups consistent, use the first class name, combined |
|
// with the other information in the request, and create an object path that can be used to |
|
// resolve the provider using the ProviderRegistrar. |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0].getString()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(SubscriptionInstanceContainer |
|
(request->subscriptionInstance)); |
|
context.insert(SubscriptionFilterConditionContainer |
|
(request->condition, request->queryLanguage)); |
|
context.insert(SubscriptionLanguageListContainer |
|
(request->acceptLanguages)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
|
|
|
Array<CIMObjectPath> classNames; |
|
|
|
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) |
|
{ |
|
CIMObjectPath className( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[i]); |
|
|
|
classNames.append(className); |
|
} |
|
|
|
CIMPropertyList propertyList = request->propertyList; |
|
|
|
Uint16 repeatNotificationPolicy = request->repeatNotificationPolicy; |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.modifySubscription: " + |
|
ph.GetProvider().getName()); |
|
|
|
pm_service_op_lock op_lock(&ph.GetProvider()); |
|
|
|
ph.GetProvider().modifySubscription( |
|
context, |
|
subscriptionName, |
|
classNames, |
|
propertyList, |
|
repeatNotificationPolicy); |
|
} |
|
catch(CIMException & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
AutoMutex lock(_providerTableMutex); |
"Exception: " + e.getMessage()); |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Number of providers in _providers table = %d", _providers.size())); |
| |
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
// Iterate through the _providers table looking for an active provider |
} |
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
catch(Exception & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
if (i.value()->status.isInitialized()) |
"Exception: " + e.getMessage()); |
{ |
|
PEG_METHOD_EXIT(); |
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
return true; |
|
} |
|
} |
} | } |
catch(...) | catch(...) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
// Unexpected exception; do not assume that no providers are loaded |
"Exception: Unknown"); |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
|
"Unexpected Exception in hasActiveProviders."); |
handler.setStatus(CIM_ERR_FAILED, "Unknown Error"); |
PEG_METHOD_EXIT(); |
|
return true; |
} | } |
| |
|
// No active providers were found in the _providers table |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return false; |
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleDeleteSubscriptionRequest(const Message * message) throw() |
void DefaultProviderManager::unloadIdleProviders() |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDeleteSubscriptionRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::unloadIdleProviders"); |
CIMDeleteSubscriptionRequestMessage * request = |
|
dynamic_cast<CIMDeleteSubscriptionRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMDeleteSubscriptionResponseMessage * response = |
|
new CIMDeleteSubscriptionResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
OperationResponseHandler handler(request, response); |
|
| |
try | try |
{ | { |
String temp; |
struct timeval now; |
|
Time::gettimeofday(&now); |
| |
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) |
// Make a copy of the table so it is not locked during provider calls |
|
Array<ProviderMessageHandler*> providerList; |
{ | { |
temp.append(request->classNames[i].getString()); |
AutoMutex lock(_providerTableMutex); |
| |
if(i == (n - 1)) |
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
{ | { |
temp.append(", "); |
providerList.append(i.value()); |
} | } |
} | } |
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
for (Uint32 i = 0; i < providerList.size(); i++) |
"DefaultProviderManager::handleDeleteSubscriptionRequest - Host name: $0 Name space: $1 Class name(s): $2", |
{ |
System::getHostName(), |
ProviderMessageHandler* provider = providerList[i]; |
request->nameSpace.getString(), |
|
temp); |
|
|
|
// NOTE: the provider and provider module name are embedded in the request, presumably to reduce |
|
// the number of provider lookups (but this should be trivial if the data is cached and accessed |
|
// from the same source). to keep the lookups consistent, use the first class name, combined |
|
// with the other information in the request, and create an object path that can be used to |
|
// resolve the provider using the ProviderRegistrar. |
|
|
|
// make target object path |
|
CIMObjectPath objectPath( |
|
System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[0].getString()); |
|
|
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
// convert arguments |
|
OperationContext context; |
|
|
|
context.insert(IdentityContainer(request->userName)); |
|
context.insert(SubscriptionInstanceContainer |
|
(request->subscriptionInstance)); |
|
context.insert(SubscriptionLanguageListContainer |
|
(request->acceptLanguages)); |
|
context.insert(AcceptLanguageListContainer(request->acceptLanguages)); |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMObjectPath subscriptionName = request->subscriptionInstance.getPath(); |
|
| |
Array<CIMObjectPath> classNames; |
AutoMutex lock(provider->status.getStatusMutex()); |
| |
for(Uint32 i = 0, n = request->classNames.size(); i < n; i++) |
if (!provider->status.isInitialized()) |
{ | { |
CIMObjectPath className( |
continue; |
System::getHostName(), |
|
request->nameSpace, |
|
request->classNames[i]); |
|
|
|
classNames.append(className); |
|
} | } |
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
struct timeval providerTime = {0, 0}; |
"Calling provider.deleteSubscription: " + |
provider->status.getLastOperationEndTime(&providerTime); |
ph.GetProvider().getName()); |
|
| |
pm_service_op_lock op_lock(&ph.GetProvider()); |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"provider->status.isIdle() returns: %s", |
|
(const char*)CIMValue(provider->status.isIdle()) |
|
.toString().getCString())); |
| |
ph.GetProvider().deleteSubscription( |
if (provider->status.isIdle() && |
context, |
((now.tv_sec - providerTime.tv_sec) > |
subscriptionName, |
((Sint32)PEGASUS_PROVIDER_IDLE_TIMEOUT_SECONDS))) |
classNames); |
|
} |
|
catch(CIMException & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
"Exception: " + e.getMessage()); |
"Unloading idle provider: %s", |
|
(const char*)provider->getName().getCString())); |
handler.setStatus(e.getCode(), e.getContentLanguages(), e.getMessage()); // l10n |
_unloadProvider(provider); |
|
} |
} | } |
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
|
|
handler.setStatus(CIM_ERR_FAILED, e.getContentLanguages(), e.getMessage()); // l10n |
|
} | } |
catch(...) | catch(...) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
"Exception: Unknown"); |
"Caught unexpected exception in unloadIdleProviders."); |
|
|
handler.setStatus(CIM_ERR_FAILED, "Unknown Error"); |
|
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleEnableIndicationsRequest(const Message * message) throw() |
void DefaultProviderManager::_shutdownAllProviders() |
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager:: handleEnableIndicationsRequest"); |
|
|
|
CIMEnableIndicationsRequestMessage * request = |
|
dynamic_cast<CIMEnableIndicationsRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMEnableIndicationsResponseMessage * response = |
|
new CIMEnableIndicationsResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
CIMEnableIndicationsResponseMessage * responseforhandler = |
|
new CIMEnableIndicationsResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod(request->getHttpMethod()); |
|
|
|
response->dest = request->queueIds.top(); |
|
|
|
/* |
|
// ATTN: need pointer to Provider Manager Server! |
|
//EnableIndicationsResponseHandler *handler = |
|
// new EnableIndicationsResponseHandler(request, response, this); |
|
|
|
try |
|
{ | { |
// get the provider file name and logical name |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
Triad<String, String, String> triad = |
"DefaultProviderManager::_shutdownAllProviders"); |
_getProviderRegPair(request->provider, request->providerModule); |
|
| |
// get cached or load new provider module |
AutoMutex lock(_providerTableMutex); |
//Provider provider = |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
OpProviderHolder ph = |
"providers in cache = %d", _providers.size())); |
providerManager.getProvider(triad.first, triad.second, triad.third); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.enableIndications: " + |
|
ph.GetProvider().getName()); |
|
ph.GetProvider().protect(); |
|
ph.GetProvider().enableIndications(*handler); |
|
|
|
|
|
// if no exception, store the handler so it is persistent for as |
|
// long as the provider has indications enabled. |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Storing indication handler for " + ph.GetProvider().getName()); |
|
| |
_insertEntry(ph.GetProvider(), handler); |
//create an array of UnloadProviderRequest requests one per |
} |
//provider to process shutdown of providers simultaneously. |
catch(CIMException & e) |
Array<AsyncRequestExecutor::AsyncRequestMsg*> ProviderRequests; |
|
for (ProviderTable::Iterator i = _providers.start(); i != 0; i++) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
AutoMutex lock(i.value()->status.getStatusMutex()); |
"Exception: " + e.getMessage()); |
if(i.value()->status.isInitialized()) |
response->cimException = CIMException(e); |
|
} |
|
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
//l10n |
|
//response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error"); |
|
response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.INTERNAL_ERROR", |
|
"Internal Error")); |
|
} |
|
catch(...) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
ProviderRequests.append( |
"Exception: Unknown"); |
new UnloadProviderRequest(i.value())); |
//l10n |
|
//response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error"); |
|
response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.UNKNOWN_ERROR", |
|
"Unknown Error")); |
|
} | } |
*/ |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleDisableIndicationsRequest(const Message * message) throw() |
//run the stop request on all providers on multiple threads using |
{ |
//the request executor. This will invoke _asyncRequestCallback() on a |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableIndicationsRequest"); |
//seperate thread for each provider which in turn will unload that |
|
//provider. |
CIMDisableIndicationsRequestMessage * request = |
|
dynamic_cast<CIMDisableIndicationsRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMDisableIndicationsResponseMessage * response = |
|
new CIMDisableIndicationsResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
| |
// Set HTTP method in response from request |
CIMException exception = |
response->setHttpMethod (request->getHttpMethod ()); |
AsyncRequestExecutor(&_asyncRequestCallback,this).executeRequests( |
|
ProviderRequests); |
| |
OperationResponseHandler handler(request, response); |
if(exception.getCode() != CIM_ERR_SUCCESS) |
|
|
try |
|
{ | { |
InternalProviderName name(""); |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
|
"Unexpected Exception in _shutdownAllProviders()."); |
/* |
} |
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
*/ |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
|
|
/* |
|
// get the provider file name and logical name |
|
Triad<String, String, String> triad = |
|
getProviderRegistrar()->_getProviderRegPair(request->provider, request->providerModule); |
|
|
|
// get cached or load new provider module |
|
//Provider provider = |
|
OpProviderHolder ph = |
|
providerManager.getProvider(triad.first, triad.second, triad.third); |
|
*/ |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Calling provider.disableIndications: " + |
|
ph.GetProvider().getName()); |
|
|
|
ph.GetProvider().disableIndications(); |
|
|
|
ph.GetProvider().unprotect(); |
|
|
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Removing and Destroying indication handler for " + |
|
ph.GetProvider().getName()); |
|
| |
delete _removeEntry(_generateKey(ph.GetProvider())); |
PEG_METHOD_EXIT(); |
} | } |
| |
catch(CIMException & e) |
Sint16 DefaultProviderManager::_disableProvider( |
|
const String& moduleName, |
|
const String& providerName) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"Exception: " + e.getMessage()); |
"DefaultProviderManager::_disableProvider"); |
| |
response->cimException = CIMException(e); |
ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName); |
} |
if (!pr->status.isInitialized()) |
catch(Exception & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"Exception: " + e.getMessage()); |
"Provider %s is not loaded", |
response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms( |
(const char*)providerName.getCString())); |
"ProviderManager.DefaultProviderManager.INTERNAL_ERROR", |
PEG_METHOD_EXIT(); |
"Internal Error")); |
return 1; |
} | } |
catch(...) |
|
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Disable Provider %s", |
|
(const char*)pr->getName().getCString())); |
|
// |
|
// Check to see if there are pending requests. If there are pending |
|
// requests and the disable timeout has not expired, loop and wait one |
|
// second until either there is no pending requests or until timeout |
|
// expires. |
|
// |
|
Uint32 waitTime = PROVIDER_DISABLE_TIMEOUT; |
|
while ((pr->status.numCurrentOperations() > 0) && (waitTime > 0)) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
Threads::sleep(1000); |
"Exception: Unknown"); |
waitTime = waitTime - 1; |
response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.UNKNOWN_ERROR", |
|
"Unknown Error")); |
|
} | } |
| |
|
// There are still pending requests, do not disable |
|
if (pr->status.numCurrentOperations() > 0) |
|
{ |
|
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Disable failed since there are pending requests."); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return 0; |
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleConsumeIndicationRequest(const Message *message) throw() |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handlConsumeIndicationRequest"); |
|
|
|
CIMConsumeIndicationRequestMessage *request = |
|
dynamic_cast<CIMConsumeIndicationRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMResponseMessage * response = |
|
new CIMResponseMessage( |
|
CIM_CONSUME_INDICATION_RESPONSE_MESSAGE, |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
Uint32 type = 3; |
|
|
|
try | try |
{ | { |
InternalProviderName name(""); |
AutoMutex lock(pr->status.getStatusMutex()); |
|
|
/* |
|
InternalProviderName name( |
|
String::EMPTY, |
|
String::EMPTY, |
|
objectPath.toString()); |
|
|
|
name = findProvider(name.toString()); |
|
*/ |
|
|
|
// get cached or load new provider module |
|
OpProviderHolder ph = |
|
providerManager.getProvider(name.getPhysicalName(), name.getLogicalName(), String::EMPTY); |
|
| |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
if (pr->status.isInitialized()) |
"Calling provider.: " + |
|
ph.GetProvider().getName()); |
|
|
|
OperationContext context; |
|
|
|
//l10n |
|
// ATTN-CEC 06/04/03 NOTE: I can't find where the consume msg is sent. This |
|
// does not appear to be hooked-up. When it is added, need to |
|
// make sure that Content-Language is set in the consume msg. |
|
// NOTE: A-L is not needed to be set in the consume msg. |
|
// add the langs to the context |
|
context.insert(ContentLanguageListContainer(request->contentLanguages)); |
|
|
|
CIMInstance indication_copy = request->indicationInstance; |
|
|
|
SimpleIndicationResponseHandler handler; |
|
|
|
ph.GetProvider().consumeIndication(context, |
|
"", |
|
indication_copy); |
|
} |
|
catch(CIMException & e) |
|
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
"Exception: " + e.getMessage()); |
"Unloading Provider %s", |
|
(const char*)pr->getName().getCString())); |
response->cimException = CIMException(e); |
_unloadProvider(pr); |
} | } |
catch(Exception & e) |
|
{ |
|
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Exception: " + e.getMessage()); |
|
//l10n |
|
//response->cimException = CIMException(CIM_ERR_FAILED, "Internal Error"); |
|
response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.INTERNAL_ERROR", |
|
"Internal Error")); |
|
} | } |
catch(...) | catch(...) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
"Exception: Unknown"); |
"Unload provider failed %s", |
//l10n |
(const char*)pr->getName().getCString())); |
//response->cimException = CIMException(CIM_ERR_FAILED, "Unknown Error"); |
PEG_METHOD_EXIT(); |
response->cimException = CIMException(CIM_ERR_FAILED, MessageLoaderParms( |
return -1; |
"ProviderManager.DefaultProviderManager.UNKNOWN_ERROR", |
|
"Unknown Error")); |
|
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return 1; |
return(response); |
|
} | } |
| |
|
void DefaultProviderManager::_unloadProvider(ProviderMessageHandler* provider) |
|
{ |
// | // |
// This function disables a provider module if disableProviderOnly is not true, |
// NOTE: It is the caller's responsibility to make sure that the |
// otherwise, disables a provider. Disable provider module means that |
// provider->status.getStatusMutex() mutex is locked before calling |
// block all the providers which contain in the module and unload the |
// this method. |
// providers. |
|
// Disable provider means unload the provider and the provider is not blocked. |
|
// |
|
// ATTN-YZ-P2-20030519: Provider needs to be blocked when disable a provider. |
|
// | // |
Message * DefaultProviderManager::handleDisableModuleRequest(const Message * message) throw() |
|
{ |
|
// HACK |
|
ProviderRegistrationManager * _providerRegistrationManager = ProviderManager::getProviderRegistrationManager(); |
|
| |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleDisableModuleRequest"); |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"DefaultProviderManager::_unloadProvider"); |
| |
CIMDisableModuleRequestMessage * request = |
if (provider->status.numCurrentOperations() > 0) |
dynamic_cast<CIMDisableModuleRequestMessage *>(const_cast<Message *>(message)); |
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Provider cannot be unloaded due to pending operations: %s", |
|
(const char*)provider->getName().getCString())); |
|
} |
|
else |
|
{ |
|
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
|
"Terminating Provider %s", |
|
(const char*)provider->getName().getCString())); |
| |
PEGASUS_ASSERT(request != 0); |
provider->terminate(); |
| |
// get provider module name |
// unload provider module |
String moduleName; |
PEGASUS_ASSERT(provider->status.getModule() != 0); |
CIMInstance mInstance = request->providerModule; |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, |
Uint32 pos = mInstance.findProperty(CIMName ("Name")); |
"Unloading provider module: %s", |
|
(const char*)provider->getName().getCString())); |
|
provider->status.getModule()->unloadModule(); |
| |
if(pos != PEG_NOT_FOUND) |
PEG_TRACE((TRC_PROVIDERMANAGER,Tracer::LEVEL3, |
{ |
"DefaultProviderManager: Unloaded provider %s", |
mInstance.getProperty(pos).getValue().get(moduleName); |
(const char*)provider->getName().getCString())); |
} |
|
| |
Boolean disableProviderOnly = request->disableProviderOnly; |
// NOTE: The "delete provider->status.getCIMOMHandle()" operation |
|
// was moved to be called after the unloadModule() call above |
|
// as part of a fix for bugzilla 3669. For some providers |
|
// run out-of-process on Windows platforms (i.e. running |
|
// the cimserver with the forceProviderProcesses config option |
|
// set to "true"), deleting the provider's CIMOMHandle before |
|
// unloading the provider library caused the unload mechanism |
|
// to deadlock, making that provider unavailable and preventing |
|
// the cimserver from shutting down. It should NOT be moved back |
|
// above the unloadModule() call. See bugzilla 3669 for details. |
| |
// |
// delete the cimom handle |
// get operational status |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, |
// |
"Destroying provider's CIMOMHandle: %s", |
Array<Uint16> operationalStatus; |
(const char*)provider->getName().getCString())); |
|
delete provider->status.getCIMOMHandle(); |
| |
if(!disableProviderOnly) |
// set provider status to uninitialized |
{ |
provider->status.setInitialized(false); |
Uint32 pos2 = mInstance.findProperty(CIMName ("OperationalStatus")); |
} |
| |
if(pos2 != PEG_NOT_FOUND) |
PEG_METHOD_EXIT(); |
{ |
|
// |
|
// ATTN-CAKG-P2-20020821: Check for null status? |
|
// |
|
mInstance.getProperty(pos2).getValue().get(operationalStatus); |
|
} | } |
| |
// |
ProviderManager* DefaultProviderManager::createDefaultProviderManagerCallback() |
// update module status from OK to Stopping |
|
// |
|
for(Uint32 i=0, n = operationalStatus.size(); i < n; i++) |
|
{ | { |
if(operationalStatus[i] == _MODULE_OK) |
return new DefaultProviderManager(); |
{ |
|
operationalStatus.remove(i); |
|
} |
|
} | } |
operationalStatus.append(_MODULE_STOPPING); |
|
| |
if(_providerRegistrationManager->setProviderModuleStatus |
//async request handler method invoked on a seperate thread per provider |
(moduleName, operationalStatus) == false) |
//through the async request executor. |
|
CIMException DefaultProviderManager::_asyncRequestCallback( |
|
void *callbackPtr, |
|
AsyncRequestExecutor::AsyncRequestMsg* request) |
{ | { |
//l10n |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed."); |
"DefaultProviderManager::_asyncRequestCallback"); |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED", |
|
"set module status failed.")); |
|
} |
|
} |
|
| |
// Unload providers |
CIMException responseException; |
Array<CIMInstance> _pInstances = request->providers; |
|
| |
for(Uint32 i = 0, n = _pInstances.size(); i < n; i++) |
//extract the parameters |
|
UnloadProviderRequest* my_request = |
|
dynamic_cast<UnloadProviderRequest*>(request); |
|
if(my_request != NULL) |
{ | { |
/* temp disabled by Chip |
PEGASUS_ASSERT(0 != callbackPtr); |
// get the provider file name and logical name |
|
Triad<String, String, String> triad = |
|
getProviderRegistrar()->_getProviderRegPair(_pInstances[i], mInstance); |
|
| |
providerManager.unloadProvider(triad.first, triad.second); |
DefaultProviderManager *dpmPtr = |
*/ |
static_cast<DefaultProviderManager*>(callbackPtr); |
} |
|
| |
if(!disableProviderOnly) |
ProviderMessageHandler* provider = |
{ |
dynamic_cast<ProviderMessageHandler*>(my_request->_provider); |
// update module status from Stopping to Stopped |
try |
for(Uint32 i=0, n = operationalStatus.size(); i < n; i++) |
|
{ | { |
if(operationalStatus[i] == _MODULE_STOPPING) |
AutoMutex lock(provider->status.getStatusMutex()); |
|
//unload the provider |
|
if (provider->status.isInitialized()) |
{ | { |
operationalStatus.remove(i); |
dpmPtr->_unloadProvider(provider); |
} |
|
} | } |
|
else |
operationalStatus.append(_MODULE_STOPPED); |
|
|
|
if(_providerRegistrationManager->setProviderModuleStatus |
|
(moduleName, operationalStatus) == false) |
|
{ | { |
//l10n |
PEGASUS_ASSERT(0); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"set module status failed."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED", |
|
"set module status failed.")); |
|
} | } |
} | } |
|
catch (CIMException& e) |
CIMDisableModuleResponseMessage * response = |
|
new CIMDisableModuleResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
operationalStatus); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// |
|
// Set HTTP method in response from request |
|
// |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} |
|
|
|
Message * DefaultProviderManager::handleEnableModuleRequest(const Message * message) throw() |
|
{ |
|
// HACK |
|
ProviderRegistrationManager * _providerRegistrationManager = ProviderManager::getProviderRegistrationManager(); |
|
|
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleEnableModuleRequest"); |
|
|
|
CIMEnableModuleRequestMessage * request = |
|
dynamic_cast<CIMEnableModuleRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
// |
|
// get module status |
|
// |
|
CIMInstance mInstance = request->providerModule; |
|
Array<Uint16> operationalStatus; |
|
Uint32 pos = mInstance.findProperty(CIMName ("OperationalStatus")); |
|
|
|
if(pos != PEG_NOT_FOUND) |
|
{ | { |
// |
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", |
// ATTN-CAKG-P2-20020821: Check for null status? |
(const char*)e.getMessage().getCString())); |
// |
responseException = e; |
mInstance.getProperty(pos).getValue().get(operationalStatus); |
|
} | } |
|
catch (Exception& e) |
// update module status from Stopped to OK |
|
for(Uint32 i=0, n = operationalStatus.size(); i < n; i++) |
|
{ |
|
if(operationalStatus[i] == _MODULE_STOPPED) |
|
{ | { |
operationalStatus.remove(i); |
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) |
operationalStatus.append(_MODULE_OK); |
|
|
|
// |
|
// get module name |
|
// |
|
String moduleName; |
|
|
|
Uint32 pos2 = mInstance.findProperty(CIMName ("Name")); |
|
|
|
if(pos2 != PEG_NOT_FOUND) |
|
{ | { |
mInstance.getProperty(pos2).getValue().get(moduleName); |
responseException = CIMException(CIM_ERR_FAILED, e.what()); |
} | } |
|
catch (...) |
if(_providerRegistrationManager->setProviderModuleStatus |
|
(moduleName, operationalStatus) == false) |
|
{ | { |
//l10n |
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "set module status failed."); |
"Exception: Unknown"); |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms( |
responseException = PEGASUS_CIM_EXCEPTION( |
"ProviderManager.DefaultProviderManager.SET_MODULE_STATUS_FAILED", |
CIM_ERR_FAILED, "Unknown error."); |
"set module status failed.")); |
|
} | } |
|
|
CIMEnableModuleResponseMessage * response = |
|
new CIMEnableModuleResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop(), |
|
operationalStatus); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(response); |
|
} | } |
| |
Message * DefaultProviderManager::handleStopAllProvidersRequest(const Message * message) throw() |
// delete the UnloadProviderRequest. |
{ |
delete request; |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::handleStopAllProvidersRequest"); |
|
|
|
CIMStopAllProvidersRequestMessage * request = |
|
dynamic_cast<CIMStopAllProvidersRequestMessage *>(const_cast<Message *>(message)); |
|
|
|
PEGASUS_ASSERT(request != 0); |
|
|
|
CIMStopAllProvidersResponseMessage * response = |
|
new CIMStopAllProvidersResponseMessage( |
|
request->messageId, |
|
CIMException(), |
|
request->queueIds.copyAndPop()); |
|
|
|
PEGASUS_ASSERT(response != 0); |
|
|
|
// preserve message key |
|
response->setKey(request->getKey()); |
|
|
|
// Set HTTP method in response from request |
|
response->setHttpMethod (request->getHttpMethod ()); |
|
|
|
// tell the provider manager to shutdown all the providers |
|
providerManager.shutdownAllProviders(); |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
return responseException; |
return(response); |
|
} | } |
| |
void DefaultProviderManager::_insertEntry ( |
PEGASUS_NAMESPACE_END |
const Provider & provider, |
|
const EnableIndicationsResponseHandler *handler) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"DefaultProviderManager::_insertEntry"); |
|
|
|
String tableKey = _generateKey |
|
(provider); |
|
|
|
_responseTable.insert (tableKey, const_cast<EnableIndicationsResponseHandler *>(handler)); |
|
| |
PEG_METHOD_EXIT(); |
PEGASUS_USING_PEGASUS; |
} |
|
| |
EnableIndicationsResponseHandler * DefaultProviderManager::_removeEntry( |
// This entry point is not needed because the DefaultProviderManager is created |
const String & key) |
// using DefaultProviderManager::createDefaultProviderManagerCallback(). |
|
#if 0 |
|
extern "C" PEGASUS_EXPORT ProviderManager* PegasusCreateProviderManager( |
|
const String& providerManagerName) |
{ | { |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
if (String::equalNoCase(providerManagerName, "Default")) |
"DefaultProviderManager::_removeEntry"); |
|
EnableIndicationsResponseHandler *ret = 0; |
|
|
|
_responseTable.lookup(key, ret); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(ret); |
|
} |
|
|
|
String DefaultProviderManager::_generateKey ( |
|
const Provider & provider) |
|
{ | { |
String tableKey; |
return new DefaultProviderManager(); |
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"DefaultProviderManager::_generateKey"); |
|
|
|
// |
|
// Append provider key values to key |
|
// |
|
String providerName = provider.getName(); |
|
String providerFileName = provider.getModule()->getFileName(); |
|
tableKey.append (providerName); |
|
tableKey.append (providerFileName); |
|
|
|
PEG_METHOD_EXIT(); |
|
|
|
return(tableKey); |
|
} | } |
| |
PEGASUS_NAMESPACE_END |
return 0; |
|
} |
|
#endif |