version 1.58, 2003/11/04 19:00:59
|
version 1.79, 2005/05/16 16:15:54
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) | // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// Carol Ann Krug Graves, Hewlett-Packard Company | // Carol Ann Krug Graves, Hewlett-Packard Company |
// (carolann_graves@hp.com) | // (carolann_graves@hp.com) |
|
// Seema Gupta (gseema@in.ibm.com) for PEP135 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/XmlWriter.h> | #include <Pegasus/Common/XmlWriter.h> |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
#include <Pegasus/Common/OperationContext.h> |
#include <Pegasus/Common/OperationContextInternal.h> |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
|
#include <Pegasus/Common/Constants.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
static const CIMName _PROPERTY_CAPABILITYID = CIMName ("CapabilityID"); | static const CIMName _PROPERTY_CAPABILITYID = CIMName ("CapabilityID"); |
| |
/** | /** |
Module status |
|
*/ |
|
static const Uint16 _MODULE_OK = 2; |
|
|
|
/** |
|
stopping provider method | stopping provider method |
*/ | */ |
static const CIMName _STOP_PROVIDER = CIMName ("Stop"); | static const CIMName _STOP_PROVIDER = CIMName ("Stop"); |
|
|
*/ | */ |
static const CIMName _START_PROVIDER = CIMName ("Start"); | static const CIMName _START_PROVIDER = CIMName ("Start"); |
| |
/** |
|
Provider status |
|
*/ |
|
static const Uint16 _MODULE_STOPPING = 9; |
|
|
|
static const Uint16 _MODULE_STOPPED = 10; |
|
|
|
ProviderRegistrationProvider::ProviderRegistrationProvider( | ProviderRegistrationProvider::ProviderRegistrationProvider( |
ProviderRegistrationManager * providerRegistrationManager) | ProviderRegistrationManager * providerRegistrationManager) |
:_id(peg_credential_types::PROVIDER) | :_id(peg_credential_types::PROVIDER) |
|
|
| |
ProviderRegistrationProvider::~ProviderRegistrationProvider(void) | ProviderRegistrationProvider::~ProviderRegistrationProvider(void) |
{ | { |
if (_providerRegistrationManager) |
|
{ |
|
delete _providerRegistrationManager; |
|
} |
|
|
|
if (_client_handle) | if (_client_handle) |
{ | { |
delete _client_handle; | delete _client_handle; |
|
|
| |
void ProviderRegistrationProvider::terminate(void) | void ProviderRegistrationProvider::terminate(void) |
{ | { |
|
// delete self. this is necessary because the entry point for this object allocated it, and |
|
// the module is responsible for its memory management. |
|
delete this; |
} | } |
| |
// get registered provider | // get registered provider |
|
|
| |
try | try |
{ | { |
instance = _providerRegistrationManager->getInstance(instanceReference); |
instance = _providerRegistrationManager->getInstance(instanceReference, |
|
includeQualifiers, |
|
includeClassOrigin, |
|
propertyList); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
handler.deliver(instance); | handler.deliver(instance); |
|
|
| |
try | try |
{ | { |
enumInstances = _providerRegistrationManager->enumerateInstances(classReference); |
enumInstances = |
|
_providerRegistrationManager->enumerateInstances(classReference, |
|
includeQualifiers, |
|
includeClassOrigin, |
|
propertyList); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
handler.deliver(enumInstances); | handler.deliver(enumInstances); |
|
|
enumInstanceNames = | enumInstanceNames = |
_providerRegistrationManager->enumerateInstanceNames(classReference); | _providerRegistrationManager->enumerateInstanceNames(classReference); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
handler.deliver(enumInstanceNames); | handler.deliver(enumInstanceNames); |
|
|
try | try |
{ | { |
_providerRegistrationManager->modifyInstance(instanceReference, | _providerRegistrationManager->modifyInstance(instanceReference, |
instanceObject, includeQualifiers, propertyArray); |
instanceObject, |
|
includeQualifiers, |
|
propertyArray); |
} | } |
catch(CIMException& e) |
catch(const CIMException& e) |
{ | { |
throw (e); |
throw; |
} | } |
| |
// complete processing the request | // complete processing the request |
|
|
instanceObject.getProperty(ifcTypeIndex).getValue(). | instanceObject.getProperty(ifcTypeIndex).getValue(). |
get(ifcTypeString); | get(ifcTypeString); |
| |
if(ifcTypeString != "C++Default" && ifcTypeString != "CMPI" ) |
if (ifcTypeString != "C++Default" |
|
#ifdef PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER |
|
&& ifcTypeString != "CMPI" |
|
#endif |
|
) |
{ | { |
//l10n 485 | //l10n 485 |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, | //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
|
String ifcVersionString; | String ifcVersionString; |
instanceObject.getProperty(ifcVersionIndex).getValue(). | instanceObject.getProperty(ifcVersionIndex).getValue(). |
get(ifcVersionString); | get(ifcVersionString); |
if ((ifcVersionString != "2.1.0") && |
if ( |
(ifcVersionString != "2.2.0") && |
#ifdef PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER |
(ifcVersionString != "2.3.0")) |
(ifcTypeString == "CMPI" && |
|
ifcVersionString != "2.0.0") || |
|
#endif |
|
(ifcTypeString == "C++Default" && |
|
ifcVersionString != "2.1.0" && |
|
ifcVersionString != "2.2.0" && |
|
ifcVersionString != "2.3.0" && |
|
ifcVersionString != "2.5.0")) |
{ | { |
//l10n 485 | //l10n 485 |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, | //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
|
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
Array<Uint16> _operationalStatus; | Array<Uint16> _operationalStatus; |
_operationalStatus.append(_MODULE_OK); |
_operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK); |
instance.addProperty (CIMProperty | instance.addProperty (CIMProperty |
(_PROPERTY_OPERATIONALSTATUS, _operationalStatus)); | (_PROPERTY_OPERATIONALSTATUS, _operationalStatus)); |
} | } |
|
|
|
// |
|
// Validate the UserContext property |
|
// |
|
CIMValue userContextValue; |
|
Uint32 userContextIndex = instanceObject.findProperty( |
|
PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT); |
|
|
|
if (userContextIndex != PEG_NOT_FOUND) |
|
{ |
|
userContextValue = |
|
instanceObject.getProperty(userContextIndex).getValue(); |
|
} |
|
|
|
if (!userContextValue.isNull()) |
|
{ |
|
#ifdef PEGASUS_DISABLE_PROV_USERCTXT |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider." |
|
"ProviderRegistrationProvider.USERCONTEXT_UNSUPPORTED", |
|
"The UserContext property in the PG_ProviderModule class is " |
|
"not supported.")); |
|
#else |
|
Uint16 userContext; |
|
userContextValue.get(userContext); |
|
|
|
if (!( |
|
# ifndef PEGASUS_DISABLE_PROV_USERCTXT_REQUESTOR |
|
(userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) || |
|
# endif |
|
# ifndef PEGASUS_DISABLE_PROV_USERCTXT_DESIGNATED |
|
(userContext == PG_PROVMODULE_USERCTXT_DESIGNATED) || |
|
# endif |
|
# ifndef PEGASUS_DISABLE_PROV_USERCTXT_PRIVILEGED |
|
(userContext == PG_PROVMODULE_USERCTXT_PRIVILEGED) || |
|
# endif |
|
# ifndef PEGASUS_DISABLE_PROV_USERCTXT_CIMSERVER |
|
(userContext == PG_PROVMODULE_USERCTXT_CIMSERVER) || |
|
# endif |
|
0)) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, |
|
MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider." |
|
"ProviderRegistrationProvider." |
|
"UNSUPPORTED_USERCONTEXT_VALUE", |
|
"Unsupported UserContext value: \"$0\".", |
|
userContext)); |
|
} |
|
|
|
// DesignatedUserContext property is required when UserContext == 3 |
|
if (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED) |
|
{ |
|
Uint32 designatedUserIndex = instanceObject.findProperty( |
|
PEGASUS_PROPERTYNAME_MODULE_DESIGNATEDUSER); |
|
if ((designatedUserIndex == PEG_NOT_FOUND) || |
|
instanceObject.getProperty(designatedUserIndex).getValue() |
|
.isNull()) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider." |
|
"ProviderRegistrationProvider." |
|
"MISSING_DESIGNATEDUSER_IN_PG_PROVIDERMODULE", |
|
"Missing DesignatedUserContext property in " |
|
"PG_ProviderModule instance.")); |
|
} |
|
else |
|
{ |
|
// Validate that DesignatedUserContext is of String type |
|
String designatedUser; |
|
instanceObject.getProperty(designatedUserIndex).getValue() |
|
.get(designatedUser); |
|
} |
|
} |
|
#endif |
|
} |
} | } |
else if (className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES)) | else if (className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES)) |
{ | { |
|
|
"Missing Namespaces which is required property in PG_ProviderCapabilities class.")); | "Missing Namespaces which is required property in PG_ProviderCapabilities class.")); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) |
// Validate the ProviderType property |
{ |
|
//l10n 485 |
Uint32 providerTypeIndex = |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
instanceObject.findProperty(_PROPERTY_PROVIDERTYPE); |
//"Missing ProviderType which is required property in PG_ProviderCapabilities class."); |
Array<Uint16> providerTypeArray; |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
if (providerTypeIndex != PEG_NOT_FOUND) |
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDERTYPE_IN_PG_PROVIDERCAPABILITIES", |
{ |
"Missing ProviderType which is required property in PG_ProviderCapabilities class.")); |
instanceObject.getProperty(providerTypeIndex).getValue(). |
|
get(providerTypeArray); |
|
} |
|
|
|
if ((providerTypeIndex == PEG_NOT_FOUND) || |
|
(providerTypeArray.size() == 0)) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider." |
|
"ProviderRegistrationProvider." |
|
"MISSING_PROVIDERTYPE_IN_PG_PROVIDERCAPABILITIES", |
|
"Missing ProviderType which is required property in " |
|
"PG_ProviderCapabilities class.")); |
|
} |
|
|
|
for (Uint32 i = 0; i < providerTypeArray.size(); i++) |
|
{ |
|
if ((providerTypeArray[i] < 2) || |
|
#ifdef PEGASUS_DISABLE_EXECQUERY |
|
(providerTypeArray[i] > 6) |
|
#else |
|
(providerTypeArray[i] > 7) |
|
#endif |
|
) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider." |
|
"ProviderRegistrationProvider.UNSUPPORTED_" |
|
"PROVIDERTYPE_IN_PG_PROVIDERCAPABILITIES", |
|
"Unsupported ProviderType value \"$0\" in " |
|
"PG_ProviderCapabilities instance.", |
|
providerTypeArray[i])); |
|
} |
} | } |
} | } |
else if (className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES)) | else if (className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES)) |
|
|
returnReference = | returnReference = |
_providerRegistrationManager->createInstance(instanceReference, instance); | _providerRegistrationManager->createInstance(instanceReference, instance); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
handler.deliver(returnReference); | handler.deliver(returnReference); |
|
|
"disable the provider module failed: Provider is busy.")); | "disable the provider module failed: Provider is busy.")); |
} | } |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
} | } |
| |
|
|
{ | { |
_providerRegistrationManager->deleteInstance(instanceReference); | _providerRegistrationManager->deleteInstance(instanceReference); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
// complete processing the request | // complete processing the request |
|
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY); | throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY); |
} | } |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
CIMValue retValue(ret_value); | CIMValue retValue(ret_value); |
handler.deliver(retValue); | handler.deliver(retValue); |
handler.complete(); | handler.complete(); |
return; |
|
} | } |
| |
// get provider manager service | // get provider manager service |
|
|
asyncRequest); | asyncRequest); |
CIMDisableModuleResponseMessage * response = | CIMDisableModuleResponseMessage * response = |
reinterpret_cast<CIMDisableModuleResponseMessage *>( | reinterpret_cast<CIMDisableModuleResponseMessage *>( |
(static_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result()); |
(dynamic_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result()); |
if (response->cimException.getCode() != CIM_ERR_SUCCESS) | if (response->cimException.getCode() != CIM_ERR_SUCCESS) |
{ | { |
CIMException e = response->cimException; | CIMException e = response->cimException; |
delete asyncRequest; | delete asyncRequest; |
delete asyncReply; | delete asyncReply; |
delete response; | delete response; |
throw (e); |
throw e; |
} | } |
| |
Array<Uint16> operationalStatus = response->operationalStatus; | Array<Uint16> operationalStatus = response->operationalStatus; |
|
|
asyncRequest); | asyncRequest); |
CIMEnableModuleResponseMessage * response = | CIMEnableModuleResponseMessage * response = |
reinterpret_cast<CIMEnableModuleResponseMessage *>( | reinterpret_cast<CIMEnableModuleResponseMessage *>( |
(static_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result()); |
(dynamic_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result()); |
if (response->cimException.getCode() != CIM_ERR_SUCCESS) | if (response->cimException.getCode() != CIM_ERR_SUCCESS) |
{ | { |
CIMException e = response->cimException; | CIMException e = response->cimException; |
|
|
// | // |
// if the provider is indication provider | // if the provider is indication provider |
// | // |
if (_isIndicationProvider(moduleName, instance, reference)) |
if (_isIndicationProvider(moduleName, instance)) |
{ | { |
instances.append(instance); | instances.append(instance); |
} | } |
|
|
// | // |
// if the provider is indication provider | // if the provider is indication provider |
// | // |
if (_isIndicationProvider(moduleName, instance, ref)) |
if (_isIndicationProvider(moduleName, instance)) |
{ | { |
instances.append(instance); | instances.append(instance); |
} | } |
|
|
QueueIdStack(_service->getQueueId())); | QueueIdStack(_service->getQueueId())); |
| |
// l10n | // l10n |
termination_req->acceptLanguages = al; |
termination_req->operationContext.set(AcceptLanguageListContainer(al)); |
| |
// create request envelope | // create request envelope |
AsyncLegacyOperationStart * asyncRequest = |
AsyncLegacyOperationStart asyncRequest |
new AsyncLegacyOperationStart ( |
(_service->get_next_xid(), |
_service->get_next_xid(), |
|
NULL, | NULL, |
_queueId, | _queueId, |
termination_req, | termination_req, |
_queueId); | _queueId); |
| |
if( false == _controller->ClientSendForget( |
AutoPtr <AsyncReply> asyncReply |
*_client_handle, |
(_controller->ClientSendWait (* _client_handle, _queueId, |
_queueId, |
&asyncRequest)); |
asyncRequest)) |
|
|
AutoPtr <CIMNotifyProviderTerminationResponseMessage> response |
|
(reinterpret_cast <CIMNotifyProviderTerminationResponseMessage *> |
|
((dynamic_cast <AsyncLegacyOperationResult *> |
|
(asyncReply.get ()))->get_result ())); |
|
|
|
if (response->cimException.getCode () != CIM_ERR_SUCCESS) |
{ | { |
delete asyncRequest; |
CIMException e = response->cimException; |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, String::EMPTY); |
throw e; |
} | } |
} | } |
} | } |
|
|
for (Uint32 i = 0; i<_OperationalStatus.size(); i++) | for (Uint32 i = 0; i<_OperationalStatus.size(); i++) |
{ | { |
// retValue equals 1 if module is already disabled | // retValue equals 1 if module is already disabled |
if (_OperationalStatus[i] == _MODULE_STOPPED || |
if (_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED || |
_OperationalStatus[i] == _MODULE_STOPPING) |
_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING) |
{ | { |
return (1); | return (1); |
} | } |
|
|
providerRef.setKeyBindings(keys); | providerRef.setKeyBindings(keys); |
instance = _providerRegistrationManager->getInstance | instance = _providerRegistrationManager->getInstance |
(providerRef); | (providerRef); |
if (_isIndicationProvider(moduleName, instance, providerRef)) |
if (_isIndicationProvider(moduleName, instance)) |
{ | { |
indProvider = true; | indProvider = true; |
indicationProviders.append(true); | indicationProviders.append(true); |
|
|
else | else |
{ | { |
instance = _providerRegistrationManager->getInstance(objectReference); | instance = _providerRegistrationManager->getInstance(objectReference); |
if (_isIndicationProvider(moduleName, instance, objectReference)) |
if (_isIndicationProvider(moduleName, instance)) |
{ | { |
indProvider = true; | indProvider = true; |
indicationProviders.append(true); | indicationProviders.append(true); |
|
|
indicationProviders, | indicationProviders, |
QueueIdStack(_service->getQueueId())); | QueueIdStack(_service->getQueueId())); |
// l10n | // l10n |
disable_req->acceptLanguages = al; |
disable_req->operationContext.set(AcceptLanguageListContainer(al));; |
| |
Array<Uint16> _opStatus = | Array<Uint16> _opStatus = |
_sendDisableMessageToProviderManager(disable_req); | _sendDisableMessageToProviderManager(disable_req); |
|
|
for (Uint32 i = 0; i<_opStatus.size(); i++) | for (Uint32 i = 0; i<_opStatus.size(); i++) |
{ | { |
// module was disabled successfully | // module was disabled successfully |
if (_opStatus[i] == _MODULE_STOPPED) |
if (_opStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED) |
{ | { |
if (indProvider) | if (indProvider) |
{ | { |
|
|
| |
// module is not disabled since there are pending | // module is not disabled since there are pending |
// requests for the providers in the module | // requests for the providers in the module |
if (_opStatus[i] == _MODULE_OK) |
if (_opStatus[i] == CIM_MSE_OPSTATUS_VALUE_OK) |
{ | { |
return (-2); | return (-2); |
} | } |
|
|
for (Uint32 i = 0; i<_OperationalStatus.size(); i++) | for (Uint32 i = 0; i<_OperationalStatus.size(); i++) |
{ | { |
// retValue equals 1 if module is already enabled | // retValue equals 1 if module is already enabled |
if (_OperationalStatus[i] == _MODULE_OK) |
if (_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_OK) |
{ | { |
return (1); | return (1); |
} | } |
| |
// retValue equals 2 if module is stopping | // retValue equals 2 if module is stopping |
// at this stage, module can not be started | // at this stage, module can not be started |
if (_OperationalStatus[i] == _MODULE_STOPPING) |
if (_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING) |
{ | { |
return (2); | return (2); |
} | } |
|
|
mInstance, | mInstance, |
QueueIdStack(_service->getQueueId())); | QueueIdStack(_service->getQueueId())); |
// l10n | // l10n |
enable_req->acceptLanguages = al; |
enable_req->operationContext.set(AcceptLanguageListContainer(al));; |
| |
Array<Uint16> _opStatus; | Array<Uint16> _opStatus; |
_opStatus = _sendEnableMessageToProviderManager(enable_req); | _opStatus = _sendEnableMessageToProviderManager(enable_req); |
|
|
for (Uint32 i = 0; i<_opStatus.size(); i++) | for (Uint32 i = 0; i<_opStatus.size(); i++) |
{ | { |
// module is enabled successfully | // module is enabled successfully |
if (_opStatus[i] == _MODULE_OK) |
if (_opStatus[i] == CIM_MSE_OPSTATUS_VALUE_OK) |
{ | { |
enabled = true; | enabled = true; |
} | } |
|
|
if (enabled) | if (enabled) |
{ | { |
// | // |
// if the module is enabled, need to send enable message to |
// Since module is enabled, need get updated module instance |
|
// |
|
CIMInstance updatedModuleInstance = |
|
_providerRegistrationManager->getInstance(moduleRef); |
|
|
|
// module is enabled, initialize providers as necessary |
|
_providerRegistrationManager->initializeProviders( |
|
updatedModuleInstance); |
|
|
|
// |
|
// The module is enabled, need to send enable message to |
// subscription service if the provider is an indication provider | // subscription service if the provider is an indication provider |
// | // |
| |
|
|
// | // |
if (capInstances.size() != 0) | if (capInstances.size() != 0) |
{ | { |
_sendEnableMessageToSubscription(mInstance, |
_sendEnableMessageToSubscription(updatedModuleInstance, |
pInstance, | pInstance, |
capInstances, | capInstances, |
al); | al); |
|
|
CIMNotifyProviderEnableRequestMessage * enable_req = | CIMNotifyProviderEnableRequestMessage * enable_req = |
new CIMNotifyProviderEnableRequestMessage ( | new CIMNotifyProviderEnableRequestMessage ( |
XmlWriter::getNextMessageId (), | XmlWriter::getNextMessageId (), |
mInstance, |
|
pInstance, |
|
capInstances, | capInstances, |
QueueIdStack(_service->getQueueId())); | QueueIdStack(_service->getQueueId())); |
| |
enable_req->acceptLanguages = al; |
enable_req->operationContext.set(AcceptLanguageListContainer(al)); |
|
enable_req->operationContext.insert(ProviderIdContainer(mInstance,pInstance)); |
| |
// create request envelope | // create request envelope |
AsyncLegacyOperationStart * asyncRequest = | AsyncLegacyOperationStart * asyncRequest = |
|
|
enable_req, | enable_req, |
_queueId); | _queueId); |
| |
if( false == _controller->ClientSendForget( |
AsyncReply * asyncReply = |
*_client_handle, |
_controller->ClientSendWait(*_client_handle, |
_queueId, | _queueId, |
asyncRequest)) |
asyncRequest); |
|
|
|
CIMNotifyProviderEnableResponseMessage * response = |
|
reinterpret_cast<CIMNotifyProviderEnableResponseMessage *>( |
|
(dynamic_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result()); |
|
|
|
if (response->cimException.getCode() != CIM_ERR_SUCCESS) |
{ | { |
|
CIMException e = response->cimException; |
delete asyncRequest; | delete asyncRequest; |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, String::EMPTY); |
delete asyncReply; |
|
delete response; |
|
throw e; |
} | } |
| |
|
delete asyncRequest; |
|
delete asyncReply; |
|
delete response; |
} | } |
} | } |
| |
// If the provider is indication provider, return true, |
// If provider is an indication provider, return true, |
// otherwise, return false | // otherwise, return false |
Boolean ProviderRegistrationProvider::_isIndicationProvider( | Boolean ProviderRegistrationProvider::_isIndicationProvider( |
const String & moduleName, | const String & moduleName, |
const CIMInstance & instance, |
const CIMInstance & instance) |
const CIMObjectPath & providerRef) |
|
{ | { |
// get provider name | // get provider name |
String providerName; | String providerName; |
Uint32 pos = instance.findProperty(CIMName (_PROPERTY_PROVIDER_NAME)); |
Uint32 pos = instance.findProperty(_PROPERTY_PROVIDER_NAME); |
if (pos != PEG_NOT_FOUND) | if (pos != PEG_NOT_FOUND) |
{ | { |
instance.getProperty(pos).getValue().get(providerName); | instance.getProperty(pos).getValue().get(providerName); |
} | } |
| |
CIMObjectPath capabilityRef; |
return (_providerRegistrationManager->isIndicationProvider( |
|
moduleName, providerName)); |
capabilityRef = CIMObjectPath(providerRef.getHost(), |
|
providerRef.getNameSpace(), |
|
PEGASUS_CLASSNAME_CAPABILITIESREGISTRATION, |
|
providerRef.getKeyBindings()); |
|
|
|
// get all Capabilities instances |
|
Array<CIMObjectPath> instanceNames = |
|
_providerRegistrationManager->enumerateInstanceNames(capabilityRef); |
|
|
|
// |
|
// get provider module name and provider name from capability reference |
|
// |
|
String _moduleName, _providerName; |
|
CIMInstance capInstance; |
|
Array<Uint16> providerTypes; |
|
for(Uint32 i = 0, n=instanceNames.size(); i < n; i++) |
|
{ |
|
Array<CIMKeyBinding> keys = instanceNames[i].getKeyBindings(); |
|
|
|
for(Uint32 j=0; j < keys.size(); j++) |
|
{ |
|
if(keys[j].getName().equal (_PROPERTY_PROVIDERMODULENAME)) |
|
{ |
|
_moduleName = keys[j].getValue(); |
|
} |
|
|
|
if(keys[j].getName().equal (_PROPERTY_PROVIDERNAME)) |
|
{ |
|
_providerName = keys[j].getValue(); |
|
} |
|
|
|
// |
|
// if capability instance has same module name as moduleName |
|
// and same provider name as providerName, get provider type |
|
// |
|
if(String::equal(_moduleName, moduleName) && |
|
String::equal(_providerName, providerName)) |
|
{ |
|
capInstance = _providerRegistrationManager->getInstance |
|
(instanceNames[i]); |
|
|
|
Uint32 pos = capInstance.findProperty(CIMName (_PROPERTY_PROVIDERTYPE)); |
|
if (pos != PEG_NOT_FOUND) |
|
{ |
|
capInstance.getProperty(pos).getValue().get(providerTypes); |
|
|
|
for (Uint32 k=0; k < providerTypes.size(); k++) |
|
{ |
|
if (providerTypes[k] == _INDICATION_PROVIDER) |
|
{ |
|
return (true); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
return (false); |
|
} | } |
| |
// | // |