version 1.71, 2004/07/27 16:17:56
|
version 1.87, 2006/04/18 19:08:43
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// 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. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec 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 |
|
|
| |
ProviderRegistrationProvider::~ProviderRegistrationProvider(void) | ProviderRegistrationProvider::~ProviderRegistrationProvider(void) |
{ | { |
if (_providerRegistrationManager) |
|
{ |
|
delete _providerRegistrationManager; |
|
} |
|
|
|
if (_client_handle) |
|
{ |
|
delete _client_handle; | delete _client_handle; |
} | } |
| |
} |
|
|
|
void ProviderRegistrationProvider::initialize(CIMOMHandle & cimom) | void ProviderRegistrationProvider::initialize(CIMOMHandle & cimom) |
{ | { |
// This method should not be called because this is a control provider | // This method should not be called because this is a control provider |
|
|
| |
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 |
|
|
includeClassOrigin, | includeClassOrigin, |
propertyList); | propertyList); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
throw (e); |
throw; |
} | } |
| |
handler.deliver(instance); | handler.deliver(instance); |
|
|
includeClassOrigin, | includeClassOrigin, |
propertyList); | 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); |
|
|
includeQualifiers, | includeQualifiers, |
propertyArray); | propertyArray); |
} | } |
catch(CIMException& e) |
catch(const CIMException& e) |
{ | { |
throw (e); |
throw; |
} | } |
| |
// complete processing the request | // complete processing the request |
|
|
get(ifcTypeString); | get(ifcTypeString); |
| |
if (ifcTypeString != "C++Default" | if (ifcTypeString != "C++Default" |
#ifdef ENABLE_CMPI_PROVIDER_MANAGER |
#ifdef PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER |
&& ifcTypeString != "CMPI" | && ifcTypeString != "CMPI" |
#endif | #endif |
|
#ifdef PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER |
|
&& (ifcTypeString != "JMPI") |
|
&& (ifcTypeString != "JMPIExperimental") |
|
#endif |
) | ) |
{ | { |
//l10n 485 | //l10n 485 |
|
|
instanceObject.getProperty(ifcVersionIndex).getValue(). | instanceObject.getProperty(ifcVersionIndex).getValue(). |
get(ifcVersionString); | get(ifcVersionString); |
if ( | if ( |
#ifdef ENABLE_CMPI_PROVIDER_MANAGER |
#ifdef PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER |
(ifcTypeString == "CMPI" && | (ifcTypeString == "CMPI" && |
ifcVersionString != "2.0.0") || | ifcVersionString != "2.0.0") || |
#endif | #endif |
|
#ifdef PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER |
|
(ifcTypeString == "JMPI" && |
|
ifcVersionString != "1.0.0" && |
|
ifcVersionString != "2.0.0" && |
|
ifcVersionString != "2.2.0") || |
|
(ifcTypeString == "JMPIExperimental" && |
|
ifcVersionString != "0.0.1") || |
|
#endif |
(ifcTypeString == "C++Default" && | (ifcTypeString == "C++Default" && |
ifcVersionString != "2.1.0" && | ifcVersionString != "2.1.0" && |
ifcVersionString != "2.2.0" && | ifcVersionString != "2.2.0" && |
ifcVersionString != "2.3.0")) |
ifcVersionString != "2.3.0" && |
|
ifcVersionString != "2.5.0" && |
|
ifcVersionString != "2.6.0")) |
{ | { |
//l10n 485 | //l10n 485 |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, | //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
|
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 ClassName which is required property in PG_ProviderCapabilities class.")); | "Missing ClassName which is required property in PG_ProviderCapabilities class.")); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_NAMESPACES) == PEG_NOT_FOUND) |
// Validate the Namespaces property |
|
|
|
Uint32 namespacesIndex = |
|
instanceObject.findProperty(_PROPERTY_NAMESPACES); |
|
Array<String> namespacesArray; |
|
if (namespacesIndex != PEG_NOT_FOUND) |
{ | { |
//l10n 485 |
CIMValue namespacesValue = |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
instanceObject.getProperty(namespacesIndex).getValue(); |
//"Missing Namespaces which is required property in PG_ProviderCapabilities class."); |
if (!namespacesValue.isNull()) |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
{ |
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_NAMESPACES_IN_PG_PROVIDERCAPABILITIES", |
namespacesValue.get(namespacesArray); |
"Missing Namespaces which is required property in PG_ProviderCapabilities class.")); |
} |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) |
if (namespacesArray.size() == 0) |
{ | { |
//l10n 485 |
|
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderType which is required property in PG_ProviderCapabilities class."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( | throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDERTYPE_IN_PG_PROVIDERCAPABILITIES", |
"ControlProviders.ProviderRegistrationProvider." |
"Missing ProviderType which is required property in PG_ProviderCapabilities class.")); |
"ProviderRegistrationProvider." |
|
"MISSING_NAMESPACES_IN_PG_PROVIDERCAPABILITIES", |
|
"Missing Namespaces which is required property in " |
|
"PG_ProviderCapabilities class.")); |
|
} |
|
|
|
// Validate the ProviderType property |
|
|
|
Uint32 providerTypeIndex = |
|
instanceObject.findProperty(_PROPERTY_PROVIDERTYPE); |
|
Array<Uint16> providerTypeArray; |
|
if (providerTypeIndex != PEG_NOT_FOUND) |
|
{ |
|
CIMValue providerTypeValue = |
|
instanceObject.getProperty(providerTypeIndex).getValue(); |
|
if (!providerTypeValue.isNull()) |
|
{ |
|
providerTypeValue.get(providerTypeArray); |
|
} |
|
} |
|
|
|
if (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); |
|
|
| |
// l10n | // l10n |
// Get the client's list of preferred languages for the response | // Get the client's list of preferred languages for the response |
AcceptLanguages al = AcceptLanguages::EMPTY; |
AcceptLanguageList al; |
try | try |
{ | { |
AcceptLanguageListContainer al_container = | AcceptLanguageListContainer al_container = |
|
|
} | } |
catch (...) | catch (...) |
{ | { |
; // Leave AcceptLanguages empty |
; // Leave AcceptLanguageList empty |
} | } |
| |
CIMName className = instanceReference.getClassName(); | CIMName className = instanceReference.getClassName(); |
|
|
"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 |
|
|
| |
// l10n | // l10n |
// Get the client's list of preferred languages for the response | // Get the client's list of preferred languages for the response |
AcceptLanguages al = AcceptLanguages::EMPTY; |
AcceptLanguageList al; |
try | try |
{ | { |
AcceptLanguageListContainer al_container = | AcceptLanguageListContainer al_container = |
|
|
} | } |
catch (...) | catch (...) |
{ | { |
; // Leave AcceptLanguages empty |
; // Leave AcceptLanguageList empty |
} | } |
| |
String moduleName; | String moduleName; |
|
|
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 |
|
|
MessageQueueService * _service = _getProviderManagerService(); | MessageQueueService * _service = _getProviderManagerService(); |
Uint32 _queueId = _service->getQueueId(); | Uint32 _queueId = _service->getQueueId(); |
| |
callback_data *cb_data = new callback_data(this); |
|
|
|
// create request envelope | // create request envelope |
AsyncLegacyOperationStart * asyncRequest = | AsyncLegacyOperationStart * asyncRequest = |
new AsyncLegacyOperationStart ( | new AsyncLegacyOperationStart ( |
|
|
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; |
|
|
MessageQueueService * _service = _getProviderManagerService(); | MessageQueueService * _service = _getProviderManagerService(); |
Uint32 _queueId = _service->getQueueId(); | Uint32 _queueId = _service->getQueueId(); |
| |
callback_data *cb_data = new callback_data(this); |
|
|
|
// create request envelope | // create request envelope |
AsyncLegacyOperationStart * asyncRequest = | AsyncLegacyOperationStart * asyncRequest = |
new AsyncLegacyOperationStart ( | new AsyncLegacyOperationStart ( |
|
|
void ProviderRegistrationProvider::_sendTerminationMessageToSubscription( | void ProviderRegistrationProvider::_sendTerminationMessageToSubscription( |
const CIMObjectPath & ref, const String & moduleName, | const CIMObjectPath & ref, const String & moduleName, |
const Boolean disableProviderOnly, | const Boolean disableProviderOnly, |
const AcceptLanguages & al) |
const AcceptLanguageList & al) |
{ | { |
CIMInstance instance; | CIMInstance instance; |
String _moduleName; | String _moduleName; |
|
|
if (response->cimException.getCode () != CIM_ERR_SUCCESS) | if (response->cimException.getCode () != CIM_ERR_SUCCESS) |
{ | { |
CIMException e = response->cimException; | CIMException e = response->cimException; |
throw (e); |
throw e; |
} | } |
} | } |
} | } |
|
|
const CIMObjectPath & objectReference, | const CIMObjectPath & objectReference, |
const String & moduleName, | const String & moduleName, |
Boolean disableProviderOnly, | Boolean disableProviderOnly, |
const AcceptLanguages & al) // l10n |
const AcceptLanguageList & al) |
{ | { |
// | // |
// get module status | // get module status |
|
|
Sint16 ProviderRegistrationProvider::_enableModule( | Sint16 ProviderRegistrationProvider::_enableModule( |
const CIMObjectPath & moduleRef, | const CIMObjectPath & moduleRef, |
const String & moduleName, | const String & moduleName, |
const AcceptLanguages & al) |
const AcceptLanguageList & al) |
{ | { |
// | // |
// get module status | // get module status |
|
|
const CIMInstance & mInstance, | const CIMInstance & mInstance, |
const CIMInstance & pInstance, | const CIMInstance & pInstance, |
const Array<CIMInstance> & capInstances, | const Array<CIMInstance> & capInstances, |
const AcceptLanguages & al) |
const AcceptLanguageList & al) |
{ | { |
// | // |
// get indication server queueId | // get indication server queueId |
|
|
delete asyncRequest; | delete asyncRequest; |
delete asyncReply; | delete asyncReply; |
delete response; | delete response; |
throw (e); |
throw e; |
} | } |
| |
delete asyncRequest; | delete asyncRequest; |