version 1.47, 2003/08/15 13:32:48
|
version 1.51, 2003/09/10 18:36:49
|
|
|
#include <Pegasus/Common/CIMMessage.h> | #include <Pegasus/Common/CIMMessage.h> |
#include <Pegasus/Common/OperationContext.h> | #include <Pegasus/Common/OperationContext.h> |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
|
#include <Pegasus/Common/MessageLoader.h> //l10n |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
//l10n |
"You must have superuser privilege to modify the registration."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
|
//"You must have superuser privilege to modify the registration."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_MODIFY_REGISTRATION", |
|
"You must have superuser privilege to modify the registration.")); |
} | } |
| |
if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) | if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
|
|
// | // |
if (propertyList.isNull()) | if (propertyList.isNull()) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
//l10n |
"Only can modify Namespaces, SupportedProperties, and SupportedMethods."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
//"Only can modify Namespaces, SupportedProperties, and SupportedMethods."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.CAN_ONLY_MODIFY_ERR", |
|
"Only can modify Namespaces, SupportedProperties, and SupportedMethods.")); |
} | } |
| |
Array<CIMName> propertyArray = propertyList.getPropertyNameArray(); | Array<CIMName> propertyArray = propertyList.getPropertyNameArray(); |
|
|
ObjectPathResponseHandler & handler) | ObjectPathResponseHandler & handler) |
{ | { |
// get userName and only privileged user can execute this operation | // get userName and only privileged user can execute this operation |
|
String PG_ProviderModule_Name = "PG_ProviderModule"; //l10n |
|
String PG_ProviderCapabilities_Name = "PG_ProviderCapabilities"; //l10n |
|
String PG_Provider_Name = "PG_Provider"; |
String userName; | String userName; |
try | try |
{ | { |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
//l10n |
"You must have superuser privilege to register providers."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
|
//"You must have superuser privilege to register providers."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_REGISTER_PROVIDERS", |
|
"You must have superuser privilege to register providers.")); |
} | } |
| |
CIMName className = instanceReference.getClassName(); | CIMName className = instanceReference.getClassName(); |
|
|
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULE_NAME) == | if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULE_NAME) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing Name which is required property in PG_ProviderModule class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Name which is required property in PG_ProviderModule class."); |
|
String missing = "Name"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_VENDOR) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_VENDOR) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing Vendor which is required property in PG_ProviderModule class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Vendor which is required property in PG_ProviderModule class."); |
|
String missing = "Vendor"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_VERSION) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_VERSION) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing Version which is required property in PG_ProviderModule class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Version which is required property in PG_ProviderModule class."); |
|
String missing = "Version"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name)); |
} | } |
| |
Uint32 ifcTypeIndex = | Uint32 ifcTypeIndex = |
instanceObject.findProperty(_PROPERTY_INTERFACETYPE); | instanceObject.findProperty(_PROPERTY_INTERFACETYPE); |
if (ifcTypeIndex == PEG_NOT_FOUND) | if (ifcTypeIndex == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing InterfaceType which is required property in PG_ProviderModule class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing InterfaceType which is required property in PG_ProviderModule class."); |
|
String missing = "InterfaceType"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name)); |
} | } |
String ifcTypeString; | String ifcTypeString; |
instanceObject.getProperty(ifcTypeIndex).getValue(). | instanceObject.getProperty(ifcTypeIndex).getValue(). |
|
|
| |
if(ifcTypeString != "C++Default" && ifcTypeString != "CMPI" ) | if(ifcTypeString != "C++Default" && ifcTypeString != "CMPI" ) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
//l10n |
"Unsupported InterfaceType value: \"" + ifcTypeString + "\""); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
//"Unsupported InterfaceType value: \"" + ifcTypeString + "\""); |
|
String unsupported = "InterfaceType"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.UNSUPPORTED_VALUE", |
|
"Unsupported $0 value: \"$1\"",unsupported,ifcTypeString)); |
} | } |
| |
Uint32 ifcVersionIndex = | Uint32 ifcVersionIndex = |
instanceObject.findProperty(_PROPERTY_INTERFACEVERSION); | instanceObject.findProperty(_PROPERTY_INTERFACEVERSION); |
if (ifcVersionIndex == PEG_NOT_FOUND) | if (ifcVersionIndex == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing InterfaceVersion which is required property in PG_ProviderModule class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing InterfaceVersion which is required property in PG_ProviderModule class."); |
|
String missing = "InterfaceVersion"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name)); |
} | } |
String ifcVersionString; | String ifcVersionString; |
instanceObject.getProperty(ifcVersionIndex).getValue(). | instanceObject.getProperty(ifcVersionIndex).getValue(). |
|
|
(ifcVersionString != "2.2.0") && | (ifcVersionString != "2.2.0") && |
(ifcVersionString != "2.3.0")) | (ifcVersionString != "2.3.0")) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
//l10n |
"Unsupported InterfaceVersion value: \"" + ifcVersionString + |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
"\""); |
//"Unsupported InterfaceVersion value: \"" + ifcVersionString + |
|
// "\""); |
|
String unsupported = "InterfaceVersion"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.UNSUPPORTED_VALUE", |
|
"Unsupported $0 value: \"$1\"",unsupported,ifcVersionString)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_LOCATION) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_LOCATION) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing Location which is required property in PG_ProviderModule class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Location which is required property in PG_ProviderModule class."); |
|
String missing = "Location"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_OPERATIONALSTATUS) == | if (instanceObject.findProperty(_PROPERTY_OPERATIONALSTATUS) == |
|
|
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == | if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing ProviderModuleName which is required property in PG_ProviderCapabilities class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderModuleName which is required property in PG_ProviderCapabilities class."); |
|
String missing = "ProviderModuleName"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderCapabilities_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) == | if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing ProviderName which is required property in PG_ProviderCapabilities class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderName which is required property in PG_ProviderCapabilities class."); |
|
String missing = "ProviderName"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderCapabilities_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) == | if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing CapabilityID which is required property in PG_ProviderCapabilities class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing CapabilityID which is required property in PG_ProviderCapabilities class."); |
|
String missing = "CapabilityID"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderCapabilities_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_CLASSNAME) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_CLASSNAME) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing ClassName which is required property in PG_ProviderCapabilities class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ClassName which is required property in PG_ProviderCapabilities class."); |
|
String missing = "ClassName"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderCapabilities_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_NAMESPACES) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_NAMESPACES) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing Namespaces which is required property in PG_ProviderCapabilities class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Namespaces which is required property in PG_ProviderCapabilities class."); |
|
String missing = "Namespaces"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderCapabilities_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing ProviderType which is required property in PG_ProviderCapabilities class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderType which is required property in PG_ProviderCapabilities class."); |
|
String missing = "ProviderType"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_ProviderCapabilities_Name)); |
} | } |
} | } |
else if (className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES)) | else if (className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES)) |
|
|
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == | if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
//L10N_TODO |
//L10N_ TODO DONE |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderModuleName which is required property in PG_ConsumerCapabilities class."); |
|
MessageLoaderParms parms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_MODULE_NAME_WHICH_IS_REQUIRED", |
"Missing ProviderModuleName which is required property in PG_ConsumerCapabilities class."); | "Missing ProviderModuleName which is required property in PG_ConsumerCapabilities class."); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) == | if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
//L10N_TODO |
//L10N_ TODO DONE |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderName which is required property in PG_ConsumerCapabilities class."); |
|
|
|
MessageLoaderParms parms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_NAME_WHICH_IS_REQUIRED", |
"Missing ProviderName which is required property in PG_ConsumerCapabilities class."); | "Missing ProviderName which is required property in PG_ConsumerCapabilities class."); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) == | if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
//L10N_TODO |
//L10N_ TODO DONE |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing CapabilityID which is required property in PG_ConsumerCapabilities class."); |
|
|
|
MessageLoaderParms parms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_CAPABILITY_ID_WHICH_IS_REQUIRED", |
"Missing CapabilityID which is required property in PG_ConsumerCapabilities class."); | "Missing CapabilityID which is required property in PG_ConsumerCapabilities class."); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) |
{ | { |
//L10N_TODO |
//L10N_ TODO DONE |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderType which is required property in PG_ConsumerCapabilities class."); |
|
|
|
MessageLoaderParms parms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_TYPE_WHICH_IS_REQUIRED", |
"Missing ProviderType which is required property in PG_ConsumerCapabilities class."); | "Missing ProviderType which is required property in PG_ConsumerCapabilities class."); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_INDICATIONDESTINATIONS) == | if (instanceObject.findProperty(_PROPERTY_INDICATIONDESTINATIONS) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
//L10N_TODO |
//L10N_ TODO DONE |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Destinations which is required property in PG_ConsumerCapabilities class."); |
|
|
|
MessageLoaderParms parms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_DESTINATIONS_TYPE_WHICH_IS_REQUIRED", |
"Missing Destinations which is required property in PG_ConsumerCapabilities class."); | "Missing Destinations which is required property in PG_ConsumerCapabilities class."); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); |
} | } |
} | } |
else // PEGASUS_CLASSNAME_PROVIDER | else // PEGASUS_CLASSNAME_PROVIDER |
|
|
// | // |
if (instanceObject.findProperty(_PROPERTY_PROVIDER_NAME) == PEG_NOT_FOUND) | if (instanceObject.findProperty(_PROPERTY_PROVIDER_NAME) == PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing Name which is required property in PG_Provider class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing Name which is required property in PG_Provider class."); |
|
String missing = "Name"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_Provider_Name)); |
} | } |
| |
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == | if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == |
PEG_NOT_FOUND) | PEG_NOT_FOUND) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
//l10n |
"Missing ProviderModuleName which is required property in PG_Provider class."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"Missing ProviderModuleName which is required property in PG_Provider class."); |
|
String missing = "ProviderModuleName"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY", |
|
"Missing $0 which is required property in $1 class.",missing,PG_Provider_Name)); |
} | } |
} | } |
| |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
//l10n |
"You must have superuser privilege to unregister providers."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
|
//"You must have superuser privilege to unregister providers."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_UNREGISTER_PROVIDERS", |
|
"You must have superuser privilege to unregister providers.")); |
} | } |
| |
if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) | if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
|
|
// if _PROPERTY_PROVIDERMODULENAME key not found | // if _PROPERTY_PROVIDERMODULENAME key not found |
if( !moduleFound) | if( !moduleFound) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
//l10n |
"key ProviderModuleName was not found"); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
//"key ProviderModuleName was not found"); |
|
String sub = "ProviderModuleName"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.KEY_NOT_FOUND", |
|
"key $0 was not found",sub)); |
} | } |
| |
// | // |
|
|
// | // |
try | try |
{ | { |
|
Sint16 ret_value = _disableModule(instanceReference, moduleName, true, al); |
|
|
// | // |
// if the provider disable failed | // if the provider disable failed |
// | // |
// l10n | // l10n |
if (_disableModule(instanceReference, moduleName, true, al) == -1) |
if (ret_value == -1) |
{ | { |
|
//l10n |
|
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"disable the provider failed."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.DISABLE_PROVIDER_FAILED", |
|
"disable the provider failed.")); |
|
} |
|
// |
|
// The provider disable failed since there are pending requests |
|
// |
|
if (ret_value == -2) |
|
{ |
|
//L10N TODO |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, | throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"disable the provider failed."); |
"disable the provider failed: Provider is busy."); |
} | } |
} | } |
catch(CIMException&) | catch(CIMException&) |
|
|
// if _PROPERTY_PROVIDERMODULE_NAME key not found | // if _PROPERTY_PROVIDERMODULE_NAME key not found |
if( !moduleFound) | if( !moduleFound) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
//l10n |
"key Name was not found"); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
//"key Name was not found"); |
|
String sub = "Name"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.KEY_NOT_FOUND", |
|
"key $0 was not found",sub)); |
} | } |
| |
// | // |
|
|
// | // |
try | try |
{ | { |
|
Sint16 ret_value = _disableModule(instanceReference, moduleName, false, al); |
|
|
// | // |
// if the provider module disable failed | // if the provider module disable failed |
// | // |
// l10n | // l10n |
if (_disableModule(instanceReference, moduleName, false, al) == -1) |
if (ret_value == -1) |
|
{ |
|
//l10n |
|
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
//"disable the provider module failed."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.DISABLE_PROVIDER_MODULE_FAILED", |
|
"disable the provider module failed.")); |
|
} |
|
|
|
// |
|
// The provider module disable failed since there are pending requests |
|
// |
|
if (ret_value == -2) |
{ | { |
|
//L10N TODO |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, | throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"disable the provider module failed."); |
"disable the provider module failed: Provider is busy."); |
} | } |
} | } |
catch(CIMException& e) | catch(CIMException& e) |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
//l10n |
"You must have superuser privilege to disable or enable providers."); |
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
|
//"You must have superuser privilege to disable or enable providers."); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_DISABLE_ENABLE_PROVIDERS", |
|
"You must have superuser privilege to disable or enable providers.")); |
} | } |
| |
if(!objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) | if(!objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
|
|
// if _PROPERTY_PROVIDERMODULE_NAME key not found | // if _PROPERTY_PROVIDERMODULE_NAME key not found |
if( !moduleFound) | if( !moduleFound) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
//l10n |
"key Name was not found"); |
String sub = "Name"; |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms( |
|
"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.KEY_NOT_FOUND", |
|
"key $0 was not found",sub)); |
} | } |
| |
handler.processing(); | handler.processing(); |
|
|
} | } |
| |
// disable provider module, return 0 if module is disabled successfully, | // disable provider module, return 0 if module is disabled successfully, |
// return 1 if module is already disabled, otherwise, return -1 |
// return 1 if module is already disabled, return -2 if module can not be |
|
// disabled since there are pending requests, otherwise, return -1 |
Sint16 ProviderRegistrationProvider::_disableModule( | Sint16 ProviderRegistrationProvider::_disableModule( |
const CIMObjectPath & objectReference, | const CIMObjectPath & objectReference, |
const String & moduleName, | const String & moduleName, |
|
|
moduleName, false, al); | moduleName, false, al); |
return (0); | return (0); |
} | } |
|
|
|
// module is not disabled since there are pending |
|
// requests for the providers in the module |
|
if (_opStatus[i] == _MODULE_OK) |
|
{ |
|
return (-2); |
|
} |
} | } |
} | } |
else // disable provider | else // disable provider |