(file) Return to ProviderRegistrationProvider.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ControlProviders / ProviderRegistrationProvider

Diff for /pegasus/src/Pegasus/ControlProviders/ProviderRegistrationProvider/ProviderRegistrationProvider.cpp between version 1.28 and 1.49

version 1.28, 2002/07/30 16:14:53 version 1.49, 2003/08/19 18:06:57
Line 39 
Line 39 
 #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
  
 /** /**
    The name of the operational status property  
 */  
 static const char _PROPERTY_OPERATIONALSTATUS [] = "OperationalStatus";  
   
 /**  
    The name of the name property for PG_Provider class  
 */  
 static const char _PROPERTY_PROVIDER_NAME [] = "Name";  
   
 /**  
    The name of the Name property for PG_ProviderModule class  
 */  
 static const char _PROPERTY_PROVIDERMODULE_NAME [] = "Name";  
   
 /**  
    The name of the Vendor property for PG_ProviderModule class  
 */  
 static const char _PROPERTY_VENDOR [] = "Vendor";  
   
 /**  
    The name of the Version property for PG_ProviderModule class  
 */  
 static const char _PROPERTY_VERSION [] = "Version";  
   
 /**  
    The name of the interface type property for PG_ProviderModule class  
 */  
 static const char _PROPERTY_INTERFACETYPE [] = "InterfaceType";  
   
 /**  
    The name of the interface version property for PG_ProviderModule class  
 */  
 static const char _PROPERTY_INTERFACEVERSION [] = "InterfaceVersion";  
   
 /**  
    The name of the location property for PG_ProviderModule class  
 */  
 static const char _PROPERTY_LOCATION [] = "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  
 */  
 static const char _PROPERTY_PROVIDERMODULENAME [] = "ProviderModuleName";  
   
 /**  
    The name of the provider name  property for provider capabilities class  
 */  
 static const char _PROPERTY_PROVIDERNAME [] = "ProviderName";  
   
 /**  
    The name of the classname property for provider capabilities class  
 */  
 static const char _PROPERTY_CLASSNAME [] = "ClassName";  
   
 /**  
    The name of the Namespace property for provider capabilities class  
 */  
 static const char _PROPERTY_NAMESPACES [] = "Namespaces";  
   
 /**  
    The name of the provider type  property for provider capabilities class  
 */  
 static const char _PROPERTY_PROVIDERTYPE [] = "ProviderType";  
   
 /**  
    The name of the supported properties property for provider capabilities class  
 */  
 static const char _PROPERTY_SUPPORTEDPROPERTIES [] = "SupportedProperties";  
   
 /**  
    The name of the supported methods property for provider capabilities class  
 */  
 static const char _PROPERTY_SUPPORTEDMETHODS [] = "SupportedMethods";  
   
 /**  
    Registered instance provider type  
 */  
 static const Uint16 _INSTANCE_PROVIDER    = 2;  
  
 /** /**
    Registered association provider type     Module status
 */ */
 static const Uint16 _ASSOCIATION_PROVIDER    = 3;  static const Uint16 _MODULE_OK        = 2;
   
 /**  
    Registered indication provider type  
 */  
 static const Uint16 _INDICATION_PROVIDER    = 4;  
   
 /**  
    Registered method provider type  
 */  
 static const Uint16 _METHOD_PROVIDER    = 5;  
  
 /** /**
    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
 */ */
 static const Uint16 _MODULE_OK        = 2;  
   
 static const Uint16 _MODULE_STOPPING   = 9; static const Uint16 _MODULE_STOPPING   = 9;
  
 static const Uint16 _MODULE_STOPPED   = 10; static const Uint16 _MODULE_STOPPED   = 10;
Line 169 
Line 78 
  
     _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)
Line 200 
Line 109 
 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_CONSUMERCAPABILITIES) &&
          !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
Line 245 
Line 157 
 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_CONSUMERCAPABILITIES) &&
          !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
Line 289 
Line 204 
 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_CONSUMERCAPABILITIES) &&
          !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
Line 336 
Line 253 
         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<void> & 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 (...)
Line 354 
Line 271 
  
     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
     {     {
         throw CIMException (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(!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());
     }     }
  
     //     //
Line 379 
Line 301 
     //     //
     if (propertyList.isNull())     if (propertyList.isNull())
     {     {
         throw CIMException (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.");
               String s1 = "Namespaces";
               String s2 = "SupportedProperties";
               String s3 = "SupportedMethods";
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, MessageLoaderParms(
                           "ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.CAN_ONLY_MODIFY_ERR",
                           "Only can modify $0, $1, and $2.",
                           s1, s2, s3));
     }     }
  
     Array<CIMName> 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());
         }         }
     }     }
  
Line 400 
Line 331 
     try     try
     {     {
         _providerRegistrationManager->modifyInstance(instanceReference,         _providerRegistrationManager->modifyInstance(instanceReference,
             instanceObject, flags, propertyArray);              instanceObject, includeQualifiers, propertyArray);
     }     }
     catch(CIMException& e)     catch(CIMException& e)
     {     {
Line 416 
Line 347 
     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 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
     {     {
         IdentityContainer container = context.get(CONTEXT_IDENTITY);          IdentityContainer container = context.get(IdentityContainer::NAME);
         userName = container.getUserName();         userName = container.getUserName();
     }     }
     catch (...)     catch (...)
Line 432 
Line 366 
  
     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
     {     {
         throw CIMException (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."));
     }     }
  
     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_CONSUMERCAPABILITIES) &&
          !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
Line 469 
Line 410 
         if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULE_NAME) ==         if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULE_NAME) ==
             PEG_NOT_FOUND)             PEG_NOT_FOUND)
         {         {
             throw CIMException (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 CIMException (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 CIMException (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";
         if (instanceObject.findProperty(_PROPERTY_INTERFACETYPE) ==                  throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
             PEG_NOT_FOUND)                  "ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY",
         {                  "Missing $0 which is required property in $1 class.",missing,PG_ProviderModule_Name));
             throw CIMException (CIM_ERR_FAILED,          }
                 "Missing InterfaceType which is required property in PG_ProviderModule class.");  
         }          Uint32 ifcTypeIndex =
               instanceObject.findProperty(_PROPERTY_INTERFACETYPE);
         if (instanceObject.findProperty(_PROPERTY_INTERFACEVERSION) ==          if (ifcTypeIndex == PEG_NOT_FOUND)
             PEG_NOT_FOUND)          {
         {                  //l10n
             throw CIMException (CIM_ERR_FAILED,              //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
                 "Missing InterfaceVersion which is required property in PG_ProviderModule class.");                  //"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;
           instanceObject.getProperty(ifcTypeIndex).getValue().
               get(ifcTypeString);
   
           if(ifcTypeString != "C++Default" && ifcTypeString != "CMPI" )
           {
                   //l10n
               //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 =
               instanceObject.findProperty(_PROPERTY_INTERFACEVERSION);
           if (ifcVersionIndex == PEG_NOT_FOUND)
           {
                   //l10n
               //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;
           instanceObject.getProperty(ifcVersionIndex).getValue().
               get(ifcVersionString);
           if ((ifcVersionString != "2.1.0") &&
               (ifcVersionString != "2.2.0") &&
               (ifcVersionString != "2.3.0"))
           {
                   //l10n
               //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 CIMException (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) ==
Line 514 
Line 517 
                 (_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,
Line 524 
Line 527 
         if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) ==         if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) ==
             PEG_NOT_FOUND)             PEG_NOT_FOUND)
         {         {
             throw CIMException (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 CIMException (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 CIMException (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 CIMException (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 CIMException (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)
           {
                   //l10n
               //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))
       {
           //
           // ProviderModuleName, ProviderName, CapabilityID, ProviderType,
           // and Destinations properties must be set
           //
   
           if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) ==
               PEG_NOT_FOUND)
           {
   //L10N_ TODO DONE
               //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.");
   
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
           }
   
           if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) ==
               PEG_NOT_FOUND)
           {
   //L10N_ TODO DONE
               //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.");
   
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
           }
   
           if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) ==
               PEG_NOT_FOUND)
           {
   //L10N_ TODO DONE
               //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.");
   
               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)
         {         {
             throw CIMException (CIM_ERR_FAILED,  //L10N_ TODO DONE
                 "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_ConsumerCapabilities class.");
   
               MessageLoaderParms parms(
                   "ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_TYPE_WHICH_IS_REQUIRED",
                   "Missing ProviderType which is required property in PG_ConsumerCapabilities class.");
   
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
           }
   
           if (instanceObject.findProperty(_PROPERTY_INDICATIONDESTINATIONS) ==
               PEG_NOT_FOUND)
           {
   //L10N_ TODO DONE
               //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.");
   
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
         }         }
     }     }
     else // PEGASUS_CLASSNAME_PROVIDER     else // PEGASUS_CLASSNAME_PROVIDER
Line 567 
Line 675 
         //         //
         if (instanceObject.findProperty(_PROPERTY_PROVIDER_NAME) == PEG_NOT_FOUND)         if (instanceObject.findProperty(_PROPERTY_PROVIDER_NAME) == PEG_NOT_FOUND)
         {         {
             throw CIMException (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 CIMException (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));
         }         }
     }     }
  
Line 602 
Line 720 
 void ProviderRegistrationProvider::deleteInstance( void ProviderRegistrationProvider::deleteInstance(
     const OperationContext & context,     const OperationContext & context,
     const CIMObjectPath & instanceReference,     const CIMObjectPath & instanceReference,
     ResponseHandler<void> & 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 (...)
Line 618 
Line 736 
  
     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
     {     {
         throw CIMException (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))
       {
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
               instanceReference.getNameSpace().getString());
     }     }
  
     if(!String::equalNoCase(instanceReference.getNameSpace(),  
                             PEGASUS_NAMESPACENAME_INTEROP))  // l10n
       // Get the client's list of preferred languages for the response
       AcceptLanguages al = AcceptLanguages::EMPTY;
       try
       {
           AcceptLanguageListContainer al_container =
                   (AcceptLanguageListContainer)context.get(AcceptLanguageListContainer::NAME);
           al = al_container.getLanguages();
       }
       catch (...)
     {     {
         throw CIMException (CIM_ERR_NOT_SUPPORTED, instanceReference.getNameSpace());          ;   // Leave AcceptLanguages empty
     }     }
  
     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_CONSUMERCAPABILITIES) &&
          !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
     handler.processing();     handler.processing();
  
       String moduleName;
       Boolean moduleFound = false;
       Array<CIMKeyBinding> keys = instanceReference.getKeyBindings();
   
       //
       // disable provider before delete provider
       // registration if the class is PG_Provider
       //
       if (className.equal (PEGASUS_CLASSNAME_PROVIDER))
       {
           // get module name from reference
   
           for(Uint32 i=0; i<keys.size() ; i++)
           {
               if(keys[i].getName().equal (_PROPERTY_PROVIDERMODULENAME))
               {
                   moduleName = keys[i].getValue();
                   moduleFound = true;
               }
           }
   
           // if _PROPERTY_PROVIDERMODULENAME key not found
           if( !moduleFound)
           {
                   //l10n
               //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));
           }
   
           //
           // disable the provider
           //
           try
           {
                //
                // if the provider disable failed
                //
   // l10n
                if (_disableModule(instanceReference, moduleName, true, al) == -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."));
                }
           }
           catch(CIMException&)
           {
               throw;
           }
       }
   
       //
       // disable provider module before remove provider registration
       // if the class is PG_ProviderModule
       //
   
       if (className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
       {
           // get module name from reference
   
           for(Uint32 i=0; i<keys.size() ; i++)
           {
               if(keys[i].getName().equal (_PROPERTY_PROVIDERMODULE_NAME))
               {
                   moduleName = keys[i].getValue();
                   moduleFound = true;
               }
           }
   
           // if _PROPERTY_PROVIDERMODULE_NAME key not found
           if( !moduleFound)
           {
                   //l10n
           //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));
           }
   
           //
           // disable the provider module
           //
           try
           {
               //
               // if the provider module disable failed
               //
   // l10n
               if (_disableModule(instanceReference, moduleName, false, al) == -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."));
               }
           }
           catch(CIMException& e)
           {
               throw (e);
           }
       }
   
     try     try
     {     {
         _providerRegistrationManager->deleteInstance(instanceReference);         _providerRegistrationManager->deleteInstance(instanceReference);
Line 660 
Line 912 
     const CIMObjectPath & objectReference,     const CIMObjectPath & objectReference,
     const CIMName & 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 (...)
Line 677 
Line 928 
  
     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))     if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
     {     {
         throw CIMException (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(!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());
       }
   
   
   // l10n
       // Get the client's list of preferred languages for the response
       AcceptLanguages al = AcceptLanguages::EMPTY;
       try
       {
           AcceptLanguageListContainer al_container =
                   (AcceptLanguageListContainer)context.get(AcceptLanguageListContainer::NAME);
           al = al_container.getLanguages();
       }
       catch (...)
       {
           ;   // Leave AcceptLanguages empty
     }     }
  
     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;
Line 705 
Line 975 
     // 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));
     }     }
  
     //  
     // get module status  
     //  
     Array<Uint16> _OperationalStatus =  
         _providerRegistrationManager->getProviderModuleStatus( moduleName);  
   
     // get module instance  
     CIMInstance mInstance = _providerRegistrationManager->getInstance(objectReference);  
   
     handler.processing();     handler.processing();
  
     Sint16 ret_value;     Sint16 ret_value;
  
     if(methodName.equal(_STOP_PROVIDER))     if(methodName.equal(_STOP_PROVIDER))
     {     {
         for (Uint32 i = 0; i<_OperationalStatus.size(); i++)          // disable module
         {          try
             // retValue equals 1 if module is already disabled  
             if (_OperationalStatus[i] == _MODULE_STOPPED ||  
                 _OperationalStatus[i] == _MODULE_STOPPING)  
             {  
                 ret_value = 1;  
                 CIMValue retValue(ret_value);  
                 handler.deliver(retValue);  
                 handler.complete();  
                 return;  
             }  
         }  
   
         CIMInstance instance;  
         Array<CIMInstance> instances;  
         String _moduleName;  
   
         // get all provider instances which have same module name as moduleName  
         CIMObjectPath providerRef(objectReference.getHost(),  
                                  objectReference.getNameSpace(),  
                                  PEGASUS_CLASSNAME_PROVIDER,  
                                  objectReference.getKeyBindings());  
         Array<CIMInstance> namedInstances;  
         namedInstances = _providerRegistrationManager->enumerateInstances(providerRef);  
         for(Uint32 i = 0, n=namedInstances.size(); i < n; i++)  
         {  
             instance = namedInstances[i];  
             instance.getProperty(instance.findProperty  
             (_PROPERTY_PROVIDERMODULENAME)).getValue().get(_moduleName);  
             if (String::equalNoCase(_moduleName, moduleName))  
             {             {
                 instances.append(instance);  // l10n
                ret_value =  _disableModule(objectReference, moduleName, false, al);
             }             }
           catch(CIMException& e)
         }  
   
         //  
         // get provider manager service  
         //  
         MessageQueueService * _service = _getProviderManagerService();  
   
         if (_service != NULL)  
         {  
             // create CIMDisableModuleRequestMessage  
             CIMDisableModuleRequestMessage * disable_req =  
                 new CIMDisableModuleRequestMessage(  
                     XmlWriter::getNextMessageId (),  
                     mInstance,  
                     instances,  
                     QueueIdStack(_service->getQueueId()));  
   
             Array<Uint16> _opStatus =  
                 _sendDisableMessageToProviderManager(disable_req);  
   
             for (Uint32 i = 0; i<_opStatus.size(); i++)  
             {  
                 if (_opStatus[i] == _MODULE_STOPPED)  
                 {                 {
                     // module was disabled successfully               throw (e);
                     ret_value = 0;  
                     CIMValue retValue(ret_value);  
                     handler.deliver(retValue);  
                     handler.complete();  
   
                     // send termination message to subscription service  
                     _sendTerminationMessageToSubscription(objectReference, moduleName);  
                     return;  
                 }  
             }  
         }         }
  
         // disable failed  
         ret_value = -1;  
         CIMValue retValue(ret_value);         CIMValue retValue(ret_value);
         handler.deliver(retValue);         handler.deliver(retValue);
         handler.complete();         handler.complete();
Line 805 
Line 1006 
     }     }
     else if(methodName.equal(_START_PROVIDER))     else if(methodName.equal(_START_PROVIDER))
     {     {
           //
           // get module status
           //
           Array<Uint16> _OperationalStatus =
               _providerRegistrationManager->getProviderModuleStatus( moduleName);
   
         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
Line 829 
Line 1036 
             }             }
         }         }
  
           // get module instance
           CIMInstance mInstance =
               _providerRegistrationManager->getInstance(objectReference);
   
         //         //
         // get provider manager service         // get provider manager service
         //         //
Line 842 
Line 1053 
                     XmlWriter::getNextMessageId (),                     XmlWriter::getNextMessageId (),
                     mInstance,                     mInstance,
                     QueueIdStack(_service->getQueueId()));                     QueueIdStack(_service->getQueueId()));
   // l10n
               enable_req->acceptLanguages = al;
  
             Array<Uint16> _opStatus;             Array<Uint16> _opStatus;
             _opStatus = _sendEnableMessageToProviderManager(enable_req);             _opStatus = _sendEnableMessageToProviderManager(enable_req);
Line 869 
Line 1082 
     }     }
     else     else
     {     {
         throw CIMException(CIM_ERR_METHOD_NOT_AVAILABLE);          throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY);
     }     }
 } }
  
Line 976 
Line 1189 
  
 // send termination message to subscription service // send termination message to subscription service
 void ProviderRegistrationProvider::_sendTerminationMessageToSubscription( void ProviderRegistrationProvider::_sendTerminationMessageToSubscription(
     const CIMObjectPath & ref, const String & moduleName)      const CIMObjectPath & ref, const String & moduleName,
       const Boolean disableProviderOnly,
       const AcceptLanguages & al)
 { {
     CIMInstance instance;     CIMInstance instance;
     String _moduleName;     String _moduleName;
     Array<CIMInstance> instances;     Array<CIMInstance> instances;
  
       if (!disableProviderOnly)
       {
     CIMObjectPath reference("", PEGASUS_NAMESPACENAME_INTEROP,     CIMObjectPath reference("", PEGASUS_NAMESPACENAME_INTEROP,
         PEGASUS_CLASSNAME_PROVIDER, ref.getKeyBindings());         PEGASUS_CLASSNAME_PROVIDER, ref.getKeyBindings());
  
     // get all registered providers          Array<CIMObjectPath> instanceNames =
     Array<CIMInstance> enumInstances =              _providerRegistrationManager->enumerateInstanceNames(reference);
         _providerRegistrationManager->enumerateInstances(reference);  
  
     // find all the instances which have same module name as moduleName     // find all the instances which have same module name as moduleName
     for (Uint32 i = 0, n=enumInstances.size(); i < n; i++)          for (Uint32 i = 0, n=instanceNames.size(); i < n; i++)
     {     {
         instance = enumInstances[i];  
   
         //         //
         // get provider module name              // get provider module name from reference
         //         //
         instance.getProperty(instance.findProperty  
         (_PROPERTY_PROVIDERMODULENAME)).getValue().get(_moduleName);              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 (String::equalNoCase(moduleName, _moduleName))         if (String::equalNoCase(moduleName, _moduleName))
         {         {
                   reference.setKeyBindings(keys);
                   instance = _providerRegistrationManager->getInstance(reference);
             instances.append(instance);             instances.append(instance);
         }         }
     }     }
       }
       else
       {
               instance = _providerRegistrationManager->getInstance(ref);
               instances.append(instance);
       }
  
     //     //
     // get indication server queueId     // get indication server queueId
Line 1021 
Line 1251 
                 instances,                 instances,
                 QueueIdStack(_service->getQueueId()));                 QueueIdStack(_service->getQueueId()));
  
   // l10n
           termination_req->acceptLanguages = al;
   
         // create request envelope         // create request envelope
         AsyncLegacyOperationStart * asyncRequest =         AsyncLegacyOperationStart * asyncRequest =
             new AsyncLegacyOperationStart (             new AsyncLegacyOperationStart (
Line 1036 
Line 1269 
                            asyncRequest))                            asyncRequest))
         {         {
             delete asyncRequest;             delete asyncRequest;
             throw CIMException(CIM_ERR_NOT_FOUND);              throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, String::EMPTY);
         }         }
     }     }
 } }
Line 1052 
Line 1285 
     return(_service);     return(_service);
 } }
  
   // disable provider module, return 0 if module is disabled successfully,
   // return 1 if module is already disabled, otherwise, return -1
   Sint16 ProviderRegistrationProvider::_disableModule(
       const CIMObjectPath & objectReference,
       const String & moduleName,
       Boolean disableProviderOnly,
       const AcceptLanguages & al)         // l10n
   {
           //
           // get module status
           //
           Array<Uint16> _OperationalStatus =
               _providerRegistrationManager->getProviderModuleStatus( moduleName);
   
           for (Uint32 i = 0; i<_OperationalStatus.size(); i++)
           {
               // retValue equals 1 if module is already disabled
               if (_OperationalStatus[i] == _MODULE_STOPPED ||
                   _OperationalStatus[i] == _MODULE_STOPPING)
               {
                   return (1);
               }
           }
   
           CIMInstance instance;
           Array<CIMInstance> instances;
           CIMInstance mInstance;
           String _moduleName;
           Uint16 providers;
           CIMObjectPath providerRef;
   
           // disable a provider module or delete a provider module
           if (!disableProviderOnly)
           {
               providerRef = CIMObjectPath(objectReference.getHost(),
                                    objectReference.getNameSpace(),
                                    PEGASUS_CLASSNAME_PROVIDER,
                                    objectReference.getKeyBindings());
   
               // get module instance
               mInstance =
                   _providerRegistrationManager->getInstance(objectReference);
   
           }
           else // disable a provider
           {
               // get module instance
               Array <CIMKeyBinding> moduleKeyBindings;
               moduleKeyBindings.append (CIMKeyBinding
                   (_PROPERTY_PROVIDERMODULE_NAME, moduleName,
                    CIMKeyBinding::STRING));
   
               CIMObjectPath moduleRef(objectReference.getHost(),
                                       objectReference.getNameSpace(),
                                       PEGASUS_CLASSNAME_PROVIDERMODULE,
                                       moduleKeyBindings);
   
               mInstance =
                   _providerRegistrationManager->getInstance(moduleRef);
           }
   
           if (!disableProviderOnly)
           {
               // get all provider instances which have same module name as
               // moduleName
               Array<CIMObjectPath> instanceNames =
                   _providerRegistrationManager->enumerateInstanceNames(providerRef);
   
               for(Uint32 i = 0, n=instanceNames.size(); i < n; i++)
               {
                   //
                   // get provider module name from reference
                   //
   
                   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 (String::equalNoCase(_moduleName, moduleName))
                   {
                       providerRef.setKeyBindings(keys);
                       instance = _providerRegistrationManager->getInstance
                           (providerRef);
                       instances.append(instance);
                   }
   
               }
           }
           else
           {
               instances.append(_providerRegistrationManager->getInstance
                    (objectReference));
           }
   
           //
           // get provider manager service
           //
           MessageQueueService * _service = _getProviderManagerService();
   
           if (_service != NULL)
           {
               // create CIMDisableModuleRequestMessage
               CIMDisableModuleRequestMessage * disable_req =
                   new CIMDisableModuleRequestMessage(
                       XmlWriter::getNextMessageId (),
                       mInstance,
                       instances,
                       disableProviderOnly,
                       QueueIdStack(_service->getQueueId()));
   // l10n
               disable_req->acceptLanguages = al;
   
               Array<Uint16> _opStatus =
                   _sendDisableMessageToProviderManager(disable_req);
   
               if (!disableProviderOnly) // disable provider module
               {
                   for (Uint32 i = 0; i<_opStatus.size(); i++)
                   {
                       // module was disabled successfully
                       if (_opStatus[i] == _MODULE_STOPPED)
                       {
                           // send termination message to subscription service
                           _sendTerminationMessageToSubscription(objectReference,
                                   moduleName, false, al);
                           return (0);
                       }
                   }
               }
               else // disable provider
               {
                   _sendTerminationMessageToSubscription(objectReference,
                           moduleName, true, al);
                   return (0);
               }
           }
   
           // disable failed
           return (-1);
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.28  
changed lines
  Added in v.1.49

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2