version 1.23, 2002/06/03 23:31:41
|
version 1.37, 2002/09/19 16:17:36
|
|
|
/** | /** |
The name of the operational status property | The name of the operational status property |
*/ | */ |
static const char _PROPERTY_OPERATIONALSTATUS [] = "OperationalStatus"; |
static const CIMName _PROPERTY_OPERATIONALSTATUS = |
|
CIMName ("OperationalStatus"); |
| |
/** | /** |
The name of the name property for PG_Provider class | The name of the name property for PG_Provider class |
*/ | */ |
static const char _PROPERTY_PROVIDER_NAME [] = "Name"; |
static const CIMName _PROPERTY_PROVIDER_NAME = CIMName ("Name"); |
| |
/** | /** |
The name of the Name property for PG_ProviderModule class | The name of the Name property for PG_ProviderModule class |
*/ | */ |
static const char _PROPERTY_PROVIDERMODULE_NAME [] = "Name"; |
static const CIMName _PROPERTY_PROVIDERMODULE_NAME = CIMName ("Name"); |
| |
/** | /** |
The name of the Vendor property for PG_ProviderModule class | The name of the Vendor property for PG_ProviderModule class |
*/ | */ |
static const char _PROPERTY_VENDOR [] = "Vendor"; |
static const CIMName _PROPERTY_VENDOR = CIMName ("Vendor"); |
| |
/** | /** |
The name of the Version property for PG_ProviderModule class | The name of the Version property for PG_ProviderModule class |
*/ | */ |
static const char _PROPERTY_VERSION [] = "Version"; |
static const CIMName _PROPERTY_VERSION = CIMName ("Version"); |
| |
/** | /** |
The name of the interface type property for PG_ProviderModule class | The name of the interface type property for PG_ProviderModule class |
*/ | */ |
static const char _PROPERTY_INTERFACETYPE [] = "InterfaceType"; |
static const CIMName _PROPERTY_INTERFACETYPE = CIMName ("InterfaceType"); |
| |
/** | /** |
The name of the interface version property for PG_ProviderModule class | The name of the interface version property for PG_ProviderModule class |
*/ | */ |
static const char _PROPERTY_INTERFACEVERSION [] = "InterfaceVersion"; |
static const CIMName _PROPERTY_INTERFACEVERSION = CIMName ("InterfaceVersion"); |
| |
/** | /** |
The name of the location property for PG_ProviderModule class | The name of the location property for PG_ProviderModule class |
*/ | */ |
static const char _PROPERTY_LOCATION [] = "Location"; |
static const CIMName _PROPERTY_LOCATION = CIMName ("Location"); |
| |
/** | /** |
The name of the CapabilityID property for provider capabilities class | The name of the CapabilityID property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_CAPABILITYID [] = "CapabilityID"; |
static const CIMName _PROPERTY_CAPABILITYID = CIMName ("CapabilityID"); |
| |
/** | /** |
The name of the provider module name property for provider capabilities class | The name of the provider module name property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_PROVIDERMODULENAME [] = "ProviderModuleName"; |
static const CIMName _PROPERTY_PROVIDERMODULENAME = |
|
CIMName ("ProviderModuleName"); |
| |
/** | /** |
The name of the provider name property for provider capabilities class | The name of the provider name property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_PROVIDERNAME [] = "ProviderName"; |
static const CIMName _PROPERTY_PROVIDERNAME = CIMName ("ProviderName"); |
| |
/** | /** |
The name of the classname property for provider capabilities class | The name of the classname property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_CLASSNAME [] = "ClassName"; |
static const CIMName _PROPERTY_CLASSNAME = CIMName ("ClassName"); |
| |
/** | /** |
The name of the Namespace property for provider capabilities class | The name of the Namespace property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_NAMESPACES [] = "Namespaces"; |
static const CIMName _PROPERTY_NAMESPACES = CIMName ("Namespaces"); |
| |
/** | /** |
The name of the provider type property for provider capabilities class | The name of the provider type property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_PROVIDERTYPE [] = "ProviderType"; |
static const CIMName _PROPERTY_PROVIDERTYPE = CIMName ("ProviderType"); |
| |
/** | /** |
The name of the supported properties property for provider capabilities class | The name of the supported properties property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_SUPPORTEDPROPERTIES [] = "SupportedProperties"; |
static const CIMName _PROPERTY_SUPPORTEDPROPERTIES = |
|
CIMName ("SupportedProperties"); |
| |
/** | /** |
The name of the supported methods property for provider capabilities class | The name of the supported methods property for provider capabilities class |
*/ | */ |
static const char _PROPERTY_SUPPORTEDMETHODS [] = "SupportedMethods"; |
static const CIMName _PROPERTY_SUPPORTEDMETHODS = CIMName ("SupportedMethods"); |
| |
/** | /** |
Registered instance provider type | Registered instance provider type |
|
|
/** | /** |
stopping provider method | stopping provider method |
*/ | */ |
static const char _STOP_PROVIDER[] = "Stop"; |
static const CIMName _STOP_PROVIDER = CIMName ("Stop"); |
| |
/** | /** |
starting provider method | starting provider method |
*/ | */ |
static const char _START_PROVIDER[] = "Start"; |
static const CIMName _START_PROVIDER = CIMName ("Start"); |
| |
/** | /** |
Provider status | Provider status |
|
|
| |
_controller = &(ModuleController::get_client_handle(_id, &_client_handle)); | _controller = &(ModuleController::get_client_handle(_id, &_client_handle)); |
if(_client_handle == NULL) | if(_client_handle == NULL) |
ThrowUninitializedHandle(); |
throw UninitializedObjectException(); |
} | } |
| |
ProviderRegistrationProvider::~ProviderRegistrationProvider(void) | ProviderRegistrationProvider::~ProviderRegistrationProvider(void) |
|
|
void ProviderRegistrationProvider::getInstance( | void ProviderRegistrationProvider::getInstance( |
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & instanceReference, | const CIMObjectPath & instanceReference, |
const Uint32 flags, |
const Boolean includeQualifiers, |
|
const Boolean includeClassOrigin, |
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
ResponseHandler<CIMInstance> & handler) |
InstanceResponseHandler & handler) |
{ | { |
| |
if(!String::equalNoCase(instanceReference.getNameSpace(), |
if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
PEGASUS_NAMESPACENAME_INTEROP)) |
|
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, instanceReference.getNameSpace()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
instanceReference.getNameSpace().getString()); |
} | } |
| |
// ensure the class existing in the specified namespace | // ensure the class existing in the specified namespace |
String className = instanceReference.getClassName(); |
CIMName className = instanceReference.getClassName(); |
| |
if(!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDER) && |
if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERMODULE)) |
!className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE)) |
{ | { |
throw CIMException(CIM_ERR_NOT_SUPPORTED, className); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
className.getString()); |
} | } |
| |
// begin processing the request | // begin processing the request |
|
|
} | } |
catch(CIMException& e) | catch(CIMException& e) |
{ | { |
throw CIMException(CIM_ERR_FAILED, e.getMessage()); |
throw (e); |
} | } |
| |
handler.deliver(instance); | handler.deliver(instance); |
|
|
void ProviderRegistrationProvider::enumerateInstances( | void ProviderRegistrationProvider::enumerateInstances( |
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & classReference, | const CIMObjectPath & classReference, |
const Uint32 flags, |
const Boolean includeQualifiers, |
|
const Boolean includeClassOrigin, |
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
ResponseHandler<CIMInstance> & handler) |
InstanceResponseHandler & handler) |
{ | { |
if(!String::equalNoCase(classReference.getNameSpace(), |
if(!classReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
PEGASUS_NAMESPACENAME_INTEROP)) |
|
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, classReference.getNameSpace()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
classReference.getNameSpace().getString()); |
} | } |
| |
// ensure the class existing in the specified namespace | // ensure the class existing in the specified namespace |
String className = classReference.getClassName(); |
CIMName className = classReference.getClassName(); |
| |
if(!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDER) && |
if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERMODULE)) |
!className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE)) |
{ | { |
throw CIMException(CIM_ERR_NOT_SUPPORTED, className); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
className.getString()); |
} | } |
| |
// begin processing the request | // begin processing the request |
|
|
} | } |
catch(CIMException& e) | catch(CIMException& e) |
{ | { |
throw CIMException(CIM_ERR_FAILED, e.getMessage()); |
throw (e); |
} | } |
| |
handler.deliver(enumInstances); | handler.deliver(enumInstances); |
|
|
void ProviderRegistrationProvider::enumerateInstanceNames( | void ProviderRegistrationProvider::enumerateInstanceNames( |
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & classReference, | const CIMObjectPath & classReference, |
ResponseHandler<CIMObjectPath> & handler) |
ObjectPathResponseHandler & handler) |
{ | { |
if(!String::equalNoCase(classReference.getNameSpace(), |
if(!classReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
PEGASUS_NAMESPACENAME_INTEROP)) |
|
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, classReference.getNameSpace()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
classReference.getNameSpace().getString()); |
} | } |
| |
// ensure the class existing in the specified namespace | // ensure the class existing in the specified namespace |
String className = classReference.getClassName(); |
CIMName className = classReference.getClassName(); |
| |
if(!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDER) && |
if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERMODULE)) |
!className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE)) |
{ | { |
throw CIMException(CIM_ERR_NOT_SUPPORTED, className); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
className.getString()); |
} | } |
| |
// begin processing the request | // begin processing the request |
|
|
} | } |
catch(CIMException& e) | catch(CIMException& e) |
{ | { |
throw CIMException(CIM_ERR_FAILED, e.getMessage()); |
throw (e); |
} | } |
| |
handler.deliver(enumInstanceNames); | handler.deliver(enumInstanceNames); |
|
|
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & instanceReference, | const CIMObjectPath & instanceReference, |
const CIMInstance & instanceObject, | const CIMInstance & instanceObject, |
const Uint32 flags, |
const Boolean includeQualifiers, |
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
ResponseHandler<CIMInstance> & handler) |
ResponseHandler & handler) |
{ | { |
// get userName and only privileged user can execute this operation | // get userName and only privileged user can execute this operation |
String userName; | String userName; |
try | try |
{ | { |
IdentityContainer container = context.get(CONTEXT_IDENTITY); |
IdentityContainer container = context.get(IdentityContainer::NAME); |
userName = container.getUserName(); | userName = container.getUserName(); |
} | } |
catch (...) | catch (...) |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw CIMException (CIM_ERR_ACCESS_DENIED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
"You must have superuser privilege to modify the registration."); | "You must have superuser privilege to modify the registration."); |
} | } |
| |
if(!String::equalNoCase(instanceReference.getNameSpace(), |
if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
PEGASUS_NAMESPACENAME_INTEROP)) |
|
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, instanceReference.getNameSpace()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
instanceReference.getNameSpace().getString()); |
} | } |
| |
// | // |
// only support to modify the instance of PG_ProviderCapabilities | // only support to modify the instance of PG_ProviderCapabilities |
// | // |
if (!String::equalNoCase(instanceReference.getClassName(), |
if (!instanceReference.getClassName().equal |
PEGASUS_CLASSNAME_PROVIDERCAPABILITIES)) |
(PEGASUS_CLASSNAME_PROVIDERCAPABILITIES)) |
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, instanceReference.getClassName()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
instanceReference.getClassName().getString()); |
} | } |
| |
// | // |
|
|
// | // |
if (propertyList.isNull()) | if (propertyList.isNull()) |
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
"Only can modify Namespaces, SupportedProperties, and SupportedMethods."); | "Only can modify Namespaces, SupportedProperties, and SupportedMethods."); |
} | } |
| |
Array<String> propertyArray = propertyList.getPropertyNameArray(); |
Array<CIMName> propertyArray = propertyList.getPropertyNameArray(); |
for (Uint32 i=0; i<propertyArray.size(); i++) | for (Uint32 i=0; i<propertyArray.size(); i++) |
{ | { |
if (!String::equalNoCase(propertyArray[i], _PROPERTY_NAMESPACES) && |
if (!propertyArray[i].equal (_PROPERTY_NAMESPACES) && |
!String::equalNoCase(propertyArray[i], _PROPERTY_SUPPORTEDPROPERTIES) && |
!propertyArray[i].equal (_PROPERTY_SUPPORTEDPROPERTIES) && |
!String::equalNoCase(propertyArray[i], _PROPERTY_SUPPORTEDMETHODS)) |
!propertyArray[i].equal (_PROPERTY_SUPPORTEDMETHODS)) |
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, propertyArray[i]); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
propertyArray[i].getString()); |
} | } |
} | } |
| |
|
|
try | try |
{ | { |
_providerRegistrationManager->modifyInstance(instanceReference, | _providerRegistrationManager->modifyInstance(instanceReference, |
instanceObject, flags, propertyArray); |
instanceObject, includeQualifiers, propertyArray); |
} | } |
catch(CIMException& e) | catch(CIMException& e) |
{ | { |
throw CIMException(CIM_ERR_FAILED, e.getMessage()); |
throw (e); |
} | } |
| |
// complete processing the request | // complete processing the request |
|
|
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & instanceReference, | const CIMObjectPath & instanceReference, |
const CIMInstance & instanceObject, | const CIMInstance & instanceObject, |
ResponseHandler<CIMObjectPath> & handler) |
ObjectPathResponseHandler & handler) |
{ | { |
// get userName and only privileged user can execute this operation | // get userName and only privileged user can execute this operation |
String userName; | String userName; |
try | try |
{ | { |
IdentityContainer container = context.get(CONTEXT_IDENTITY); |
IdentityContainer container = context.get(IdentityContainer::NAME); |
userName = container.getUserName(); | userName = container.getUserName(); |
} | } |
catch (...) | catch (...) |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw CIMException (CIM_ERR_ACCESS_DENIED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
"You must have superuser privilege to register providers."); | "You must have superuser privilege to register providers."); |
} | } |
| |
String className = instanceReference.getClassName(); |
CIMName className = instanceReference.getClassName(); |
String nameSpace = instanceReference.getNameSpace(); |
CIMNamespaceName nameSpace = instanceReference.getNameSpace(); |
| |
CIMObjectPath returnReference; | CIMObjectPath returnReference; |
| |
CIMInstance instance = instanceObject; | CIMInstance instance = instanceObject; |
| |
if(!String::equalNoCase(nameSpace, PEGASUS_NAMESPACENAME_INTEROP)) |
if(!nameSpace.equal (PEGASUS_NAMESPACENAME_INTEROP)) |
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, nameSpace); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
nameSpace.getString()); |
} | } |
| |
// ensure the class existing in the specified namespace | // ensure the class existing in the specified namespace |
if(!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDER) && |
if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERMODULE)) |
!className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE)) |
{ | { |
throw CIMException(CIM_ERR_NOT_SUPPORTED, className); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
className.getString()); |
} | } |
| |
// | // |
// Check all required properties are set | // Check all required properties are set |
// | // |
if(String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERMODULE)) |
if (className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE)) |
{ | { |
// | // |
// Name, Version, InterfaceType, InterfaceVersion, and Location | // Name, Version, InterfaceType, InterfaceVersion, and Location |
// properties must be set | // properties must be set |
// OperationalStatus property needs to be set. If not, set to default | // OperationalStatus property needs to be set. If not, set to default |
// | // |
if (!instanceObject.existsProperty(_PROPERTY_PROVIDERMODULE_NAME)) |
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULE_NAME) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing Name which is required property in PG_ProviderModule class."); | "Missing Name which is required property in PG_ProviderModule class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_VENDOR)) |
if (instanceObject.findProperty(_PROPERTY_VENDOR) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing Vendor which is required property in PG_ProviderModule class."); | "Missing Vendor which is required property in PG_ProviderModule class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_VERSION)) |
if (instanceObject.findProperty(_PROPERTY_VERSION) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing Version which is required property in PG_ProviderModule class."); | "Missing Version which is required property in PG_ProviderModule class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_INTERFACETYPE)) |
if (instanceObject.findProperty(_PROPERTY_INTERFACETYPE) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing InterfaceType which is required property in PG_ProviderModule class."); | "Missing InterfaceType which is required property in PG_ProviderModule class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_INTERFACEVERSION)) |
if (instanceObject.findProperty(_PROPERTY_INTERFACEVERSION) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing InterfaceVersion which is required property in PG_ProviderModule class."); | "Missing InterfaceVersion which is required property in PG_ProviderModule class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_LOCATION)) |
if (instanceObject.findProperty(_PROPERTY_LOCATION) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing Location which is required property in PG_ProviderModule class."); | "Missing Location which is required property in PG_ProviderModule class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_OPERATIONALSTATUS)) |
if (instanceObject.findProperty(_PROPERTY_OPERATIONALSTATUS) == |
|
PEG_NOT_FOUND) |
{ | { |
Array<Uint16> _operationalStatus; | Array<Uint16> _operationalStatus; |
_operationalStatus.append(_MODULE_OK); | _operationalStatus.append(_MODULE_OK); |
|
|
(_PROPERTY_OPERATIONALSTATUS, _operationalStatus)); | (_PROPERTY_OPERATIONALSTATUS, _operationalStatus)); |
} | } |
} | } |
else if(String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES)) |
else if (className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES)) |
{ | { |
// | // |
// ProviderModuleName, ProviderName, InstanceID, ClassName, | // ProviderModuleName, ProviderName, InstanceID, ClassName, |
// Namespaces, and ProviderType properties must be set | // Namespaces, and ProviderType properties must be set |
// | // |
| |
if (!instanceObject.existsProperty(_PROPERTY_PROVIDERMODULENAME)) |
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing ProviderModuleName which is required property in PG_ProviderCapabilities class."); | "Missing ProviderModuleName which is required property in PG_ProviderCapabilities class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_PROVIDERNAME)) |
if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing ProviderName which is required property in PG_ProviderCapabilities class."); | "Missing ProviderName which is required property in PG_ProviderCapabilities class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_CAPABILITYID)) |
if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing CapabilityID which is required property in PG_ProviderCapabilities class."); | "Missing CapabilityID which is required property in PG_ProviderCapabilities class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_CLASSNAME)) |
if (instanceObject.findProperty(_PROPERTY_CLASSNAME) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing ClassName which is required property in PG_ProviderCapabilities class."); | "Missing ClassName which is required property in PG_ProviderCapabilities class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_NAMESPACES)) |
if (instanceObject.findProperty(_PROPERTY_NAMESPACES) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing Namespaces which is required property in PG_ProviderCapabilities class."); | "Missing Namespaces which is required property in PG_ProviderCapabilities class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_PROVIDERTYPE)) |
if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing ProviderType which is required property in PG_ProviderCapabilities class."); | "Missing ProviderType which is required property in PG_ProviderCapabilities class."); |
} | } |
} | } |
|
|
// | // |
// Name and ProviderModuleName properties must be set | // Name and ProviderModuleName properties must be set |
// | // |
if (!instanceObject.existsProperty(_PROPERTY_PROVIDER_NAME)) |
if (instanceObject.findProperty(_PROPERTY_PROVIDER_NAME) == PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing Name which is required property in PG_Provider class."); | "Missing Name which is required property in PG_Provider class."); |
} | } |
| |
if (!instanceObject.existsProperty(_PROPERTY_PROVIDERMODULENAME)) |
if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) == |
|
PEG_NOT_FOUND) |
{ | { |
throw CIMException (CIM_ERR_FAILED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
"Missing ProviderModuleName which is required property in PG_Provider class."); | "Missing ProviderModuleName which is required property in PG_Provider class."); |
} | } |
} | } |
|
|
} | } |
catch(CIMException& e) | catch(CIMException& e) |
{ | { |
throw CIMException(CIM_ERR_FAILED, e.getMessage()); |
throw (e); |
} | } |
| |
handler.deliver(returnReference); | handler.deliver(returnReference); |
|
|
void ProviderRegistrationProvider::deleteInstance( | void ProviderRegistrationProvider::deleteInstance( |
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & instanceReference, | const CIMObjectPath & instanceReference, |
ResponseHandler<CIMInstance> & handler) |
ResponseHandler & handler) |
{ | { |
// get userName and only privileged user can execute this operation | // get userName and only privileged user can execute this operation |
String userName; | String userName; |
try | try |
{ | { |
IdentityContainer container = context.get(CONTEXT_IDENTITY); |
IdentityContainer container = context.get(IdentityContainer::NAME); |
userName = container.getUserName(); | userName = container.getUserName(); |
} | } |
catch (...) | catch (...) |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw CIMException (CIM_ERR_ACCESS_DENIED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
"You must have superuser privilege to unregister providers."); | "You must have superuser privilege to unregister providers."); |
} | } |
| |
if(!String::equalNoCase(instanceReference.getNameSpace(), |
if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
PEGASUS_NAMESPACENAME_INTEROP)) |
|
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, instanceReference.getNameSpace()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
instanceReference.getNameSpace().getString()); |
} | } |
| |
String className = instanceReference.getClassName(); |
CIMName className = instanceReference.getClassName(); |
| |
// ensure the class existing in the specified namespace | // ensure the class existing in the specified namespace |
if(!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDER) && |
if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) && |
!String::equalNoCase(className, PEGASUS_CLASSNAME_PROVIDERMODULE)) |
!className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE)) |
{ | { |
throw CIMException(CIM_ERR_NOT_SUPPORTED, className); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
className.getString()); |
} | } |
| |
// begin processing the request | // begin processing the request |
|
|
} | } |
catch(CIMException& e) | catch(CIMException& e) |
{ | { |
throw CIMException(CIM_ERR_FAILED, e.getMessage()); |
throw (e); |
} | } |
| |
// complete processing the request | // complete processing the request |
|
|
void ProviderRegistrationProvider::invokeMethod( | void ProviderRegistrationProvider::invokeMethod( |
const OperationContext & context, | const OperationContext & context, |
const CIMObjectPath & objectReference, | const CIMObjectPath & objectReference, |
const String & methodName, |
const CIMName & methodName, |
const Array<CIMParamValue> & inParameters, | const Array<CIMParamValue> & inParameters, |
Array<CIMParamValue> & outParameters, |
MethodResultResponseHandler & handler) |
ResponseHandler<CIMValue> & handler) |
|
{ | { |
// get userName and only privileged user can execute this operation | // get userName and only privileged user can execute this operation |
String userName; | String userName; |
try | try |
{ | { |
IdentityContainer container = context.get(CONTEXT_IDENTITY); |
IdentityContainer container = context.get(IdentityContainer::NAME); |
userName = container.getUserName(); | userName = container.getUserName(); |
} | } |
catch (...) | catch (...) |
|
|
| |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
throw CIMException (CIM_ERR_ACCESS_DENIED, |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, |
"You must have superuser privilege to disable or enable providers."); | "You must have superuser privilege to disable or enable providers."); |
} | } |
| |
if(!String::equalNoCase(objectReference.getNameSpace(), |
if(!objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP)) |
PEGASUS_NAMESPACENAME_INTEROP)) |
|
{ | { |
throw CIMException (CIM_ERR_NOT_SUPPORTED, objectReference.getNameSpace()); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, |
|
objectReference.getNameSpace().getString()); |
} | } |
| |
String moduleName; | String moduleName; |
Boolean moduleFound = false; | Boolean moduleFound = false; |
| |
// get module name from reference | // get module name from reference |
Array<KeyBinding> keys = objectReference.getKeyBindings(); |
Array<CIMKeyBinding> keys = objectReference.getKeyBindings(); |
| |
for(Uint32 i=0; i<keys.size() ; i++) | for(Uint32 i=0; i<keys.size() ; i++) |
{ | { |
if(String::equalNoCase(keys[i].getName(), _PROPERTY_PROVIDERMODULE_NAME)) |
if(keys[i].getName().equal (_PROPERTY_PROVIDERMODULE_NAME)) |
{ | { |
moduleName = keys[i].getValue(); | moduleName = keys[i].getValue(); |
moduleFound = true; | moduleFound = true; |
|
|
Array<Uint16> _OperationalStatus = | Array<Uint16> _OperationalStatus = |
_providerRegistrationManager->getProviderModuleStatus( moduleName); | _providerRegistrationManager->getProviderModuleStatus( moduleName); |
| |
|
// get module instance |
|
CIMInstance mInstance = _providerRegistrationManager->getInstance(objectReference); |
|
|
handler.processing(); | handler.processing(); |
| |
Sint16 ret_value; | Sint16 ret_value; |
| |
if(String::equalNoCase(methodName, _STOP_PROVIDER)) |
if(methodName.equal(_STOP_PROVIDER)) |
{ | { |
for (Uint32 i = 0; i<_OperationalStatus.size(); i++) | for (Uint32 i = 0; i<_OperationalStatus.size(); i++) |
{ | { |
|
|
} | } |
} | } |
| |
CIMInstance mInstance; |
|
CIMInstance instance; | CIMInstance instance; |
Array<CIMInstance> instances; | Array<CIMInstance> instances; |
String _moduleName; | String _moduleName; |
| |
// get module instance |
|
mInstance = _providerRegistrationManager->getInstance(objectReference); |
|
|
|
// get all provider instances which have same module name as moduleName | // get all provider instances which have same module name as moduleName |
CIMObjectPath providerRef(objectReference.getHost(), | CIMObjectPath providerRef(objectReference.getHost(), |
objectReference.getNameSpace(), | objectReference.getNameSpace(), |
|
|
handler.complete(); | handler.complete(); |
return; | return; |
} | } |
else if(String::equalNoCase(methodName, _START_PROVIDER)) |
else if(methodName.equal(_START_PROVIDER)) |
{ | { |
for (Uint32 i = 0; i<_OperationalStatus.size(); i++) | for (Uint32 i = 0; i<_OperationalStatus.size(); i++) |
{ | { |
|
|
CIMEnableModuleRequestMessage * enable_req = | CIMEnableModuleRequestMessage * enable_req = |
new CIMEnableModuleRequestMessage( | new CIMEnableModuleRequestMessage( |
XmlWriter::getNextMessageId (), | XmlWriter::getNextMessageId (), |
moduleName, |
mInstance, |
QueueIdStack(_service->getQueueId())); | QueueIdStack(_service->getQueueId())); |
| |
Array<Uint16> _opStatus; | Array<Uint16> _opStatus; |
|
|
} | } |
else | else |
{ | { |
throw CIMException(CIM_ERR_METHOD_NOT_AVAILABLE); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY); |
} | } |
} | } |
| |
|
|
asyncRequest)) | asyncRequest)) |
{ | { |
delete asyncRequest; | delete asyncRequest; |
throw CIMException(CIM_ERR_NOT_FOUND); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, String::EMPTY); |
} | } |
} | } |
} | } |