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

   1 karl  1.84 //%2006////////////////////////////////////////////////////////////////////////
   2 kumpf 1.1  //
   3 karl  1.73 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 karl  1.57 // IBM Corp.; EMC Corporation, The Open Group.
   7 karl  1.73 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9 karl  1.75 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl  1.84 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12            // EMC Corporation; Symantec Corporation; The Open Group.
  13 kumpf 1.1  //
  14            // Permission is hereby granted, free of charge, to any person obtaining a copy
  15            // of this software and associated documentation files (the "Software"), to
  16            // deal in the Software without restriction, including without limitation the
  17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  18            // sell copies of the Software, and to permit persons to whom the Software is
  19            // furnished to do so, subject to the following conditions:
  20 r.kieninger 1.92.4.1 //
  21 kumpf       1.1      // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  22                      // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  23                      // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  24                      // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  25                      // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  26                      // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27                      // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28                      // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29                      //
  30                      //==============================================================================
  31 r.kieninger 1.92.4.1 //NOCHKSRC
  32 kumpf       1.1      // Author: Yi Zhou (yi_zhou@hp.com)
  33                      //
  34                      // Modified By: Chip Vincent (cvincent@us.ibm.com)
  35                      //              Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
  36                      //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
  37 kumpf       1.20     //              Carol Ann Krug Graves, Hewlett-Packard Company
  38                      //                  (carolann_graves@hp.com)
  39 kumpf       1.71     //              Seema Gupta (gseema@in.ibm.com) for PEP135
  40 kumpf       1.1      //
  41                      //%/////////////////////////////////////////////////////////////////////////////
  42                      
  43 kumpf       1.5      #include "ProviderRegistrationProvider.h"
  44                      
  45 kumpf       1.4      #include <Pegasus/Common/PegasusVersion.h>
  46 kumpf       1.5      #include <Pegasus/Common/XmlWriter.h>
  47 kumpf       1.6      #include <Pegasus/Common/Constants.h>
  48                      #include <Pegasus/Common/CIMMessage.h>
  49 se.gupta    1.67     #include <Pegasus/Common/OperationContextInternal.h>
  50 kumpf       1.15     #include <Pegasus/Common/System.h>
  51 humberto    1.48     #include <Pegasus/Common/MessageLoader.h> //l10n
  52 kumpf       1.68     #include <Pegasus/Common/Constants.h>
  53 kumpf       1.1      
  54                      PEGASUS_NAMESPACE_BEGIN
  55                      
  56                      /**
  57                         The name of the CapabilityID property for provider capabilities class
  58                      */
  59 kumpf       1.36     static const CIMName _PROPERTY_CAPABILITYID  = CIMName ("CapabilityID");
  60 kumpf       1.1      
  61                      /**
  62                         stopping provider method
  63                      */
  64 kumpf       1.36     static const CIMName _STOP_PROVIDER     = CIMName ("Stop");
  65 kumpf       1.1      
  66                      /**
  67                         starting provider method
  68                      */
  69 kumpf       1.36     static const CIMName _START_PROVIDER   = CIMName ("Start");
  70 kumpf       1.1      
  71                      ProviderRegistrationProvider::ProviderRegistrationProvider(
  72                          ProviderRegistrationManager * providerRegistrationManager)	
  73                      {
  74                          _providerRegistrationManager = providerRegistrationManager;
  75 kumpf       1.6      
  76 kumpf       1.89         _controller = ModuleController::getModuleController();
  77 kumpf       1.1      }
  78                      
  79                      ProviderRegistrationProvider::~ProviderRegistrationProvider(void)	
  80                      {
  81                      }
  82                      
  83                      // get registered provider
  84                      void ProviderRegistrationProvider::getInstance(
  85                          const OperationContext & context,
  86 kumpf       1.13         const CIMObjectPath & instanceReference,
  87 kumpf       1.34         const Boolean includeQualifiers,
  88                          const Boolean includeClassOrigin,
  89 kumpf       1.2          const CIMPropertyList & propertyList,
  90 kumpf       1.33         InstanceResponseHandler & handler)
  91 kumpf       1.1      {
  92                      
  93 kumpf       1.36         if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP))
  94 kumpf       1.10         {
  95 kumpf       1.30     	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
  96 kumpf       1.36                 instanceReference.getNameSpace().getString());
  97 kumpf       1.10         }
  98                      
  99 kumpf       1.1          // ensure the class existing in the specified namespace
 100 kumpf       1.36         CIMName className = instanceReference.getClassName();
 101 kumpf       1.1      
 102 kumpf       1.36         if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) &&
 103                             !className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) &&
 104 kumpf       1.46            !className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES) &&
 105 kumpf       1.36            !className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 106 kumpf       1.1          {
 107 r.kieninger 1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 108 kumpf       1.36                 className.getString());
 109 kumpf       1.1          }
 110                      
 111                          // begin processing the request
 112                          handler.processing();
 113                      
 114                          CIMInstance instance;
 115                      
 116                          try
 117                          {
 118 kumpf       1.60     	instance = _providerRegistrationManager->getInstance(instanceReference,
 119                      							     includeQualifiers,
 120                      							     includeClassOrigin,
 121                      							     propertyList);
 122 kumpf       1.1          }
 123 david.dillard 1.78         catch(const CIMException&)
 124 kumpf         1.1          {
 125 david.dillard 1.78             throw;
 126 kumpf         1.1          }
 127                        
 128                            handler.deliver(instance);
 129                        
 130                            // complete processing the request
 131                            handler.complete();
 132                        }
 133                        
 134                        // get all registered providers
 135                        void ProviderRegistrationProvider::enumerateInstances(
 136                            const OperationContext & context,
 137 kumpf         1.13         const CIMObjectPath & classReference,
 138 kumpf         1.34         const Boolean includeQualifiers,
 139                            const Boolean includeClassOrigin,
 140 kumpf         1.2          const CIMPropertyList & propertyList,
 141 kumpf         1.33         InstanceResponseHandler & handler)
 142 kumpf         1.1      {
 143 kumpf         1.36         if(!classReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP))
 144 kumpf         1.10         {
 145 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 146 kumpf         1.36                 classReference.getNameSpace().getString());
 147 kumpf         1.10         }
 148                        
 149 kumpf         1.1          // ensure the class existing in the specified namespace
 150 kumpf         1.36         CIMName className = classReference.getClassName();
 151 kumpf         1.1      
 152 kumpf         1.36         if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) &&
 153                               !className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) &&
 154 kumpf         1.46            !className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES) &&
 155 kumpf         1.36            !className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 156 kumpf         1.1          {
 157 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 158 kumpf         1.36                 className.getString());
 159 kumpf         1.1          }
 160                        
 161                            // begin processing the request
 162                            handler.processing();
 163                        
 164 kumpf         1.20         Array<CIMInstance> enumInstances;
 165 kumpf         1.1      
 166                            try
 167                            {
 168 r.kieninger   1.92.4.1         enumInstances =
 169 kumpf         1.91     	    _providerRegistrationManager->enumerateInstancesForClass(
 170 r.kieninger   1.92.4.1                 classReference,
 171 kumpf         1.91                     includeQualifiers,
 172 r.kieninger   1.92.4.1                 includeClassOrigin,
 173 kumpf         1.91                     propertyList);
 174 kumpf         1.1          }
 175 david.dillard 1.78         catch(const CIMException&)
 176 kumpf         1.1          {
 177 david.dillard 1.78             throw;
 178 kumpf         1.1          }
 179                        
 180 kumpf         1.21         handler.deliver(enumInstances);
 181 kumpf         1.1      
 182                            // complete processing the request
 183                            handler.complete();
 184                        }
 185                        
 186                        // get all registered provider names
 187                        void ProviderRegistrationProvider::enumerateInstanceNames(
 188                            const OperationContext & context,
 189 kumpf         1.13         const CIMObjectPath & classReference,
 190 kumpf         1.33         ObjectPathResponseHandler & handler)
 191 kumpf         1.1      {
 192 kumpf         1.36         if(!classReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP))
 193 kumpf         1.10         {
 194 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 195 kumpf         1.36                 classReference.getNameSpace().getString());
 196 kumpf         1.10         }
 197                        
 198 kumpf         1.1          // ensure the class existing in the specified namespace
 199 kumpf         1.36         CIMName className = classReference.getClassName();
 200 kumpf         1.1      
 201 kumpf         1.36         if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) &&
 202                               !className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) &&
 203 kumpf         1.46            !className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES) &&
 204 kumpf         1.36            !className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 205 kumpf         1.1          {
 206 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 207 kumpf         1.36                 className.getString());
 208 kumpf         1.1          }
 209                        
 210                            // begin processing the request
 211                            handler.processing();
 212                        
 213 kumpf         1.13         Array<CIMObjectPath> enumInstanceNames;
 214 kumpf         1.1      
 215                            // get all instance names from repository
 216                            try
 217                            {
 218 david.dillard 1.78             enumInstanceNames =
 219 kumpf         1.91                 _providerRegistrationManager->enumerateInstanceNamesForClass(
 220                                        classReference);
 221 kumpf         1.1          }
 222 david.dillard 1.78         catch(const CIMException&)
 223 kumpf         1.1          {
 224 david.dillard 1.78             throw;
 225 kumpf         1.1          }
 226                        
 227                            handler.deliver(enumInstanceNames);
 228                        
 229                            // complete processing the request
 230                            handler.complete();
 231                        }
 232                        
 233                        // change properties for the registered provider
 234 chip          1.24     // only support to change property of Namespaces, property of
 235 kumpf         1.1      // SupportedProperties, and property of SupportedMethods
 236                        void ProviderRegistrationProvider::modifyInstance(
 237 kumpf         1.15             const OperationContext & context,
 238 kumpf         1.13             const CIMObjectPath & instanceReference,
 239 kumpf         1.1              const CIMInstance & instanceObject,
 240 kumpf         1.34             const Boolean includeQualifiers,
 241 kumpf         1.2              const CIMPropertyList & propertyList,
 242 kumpf         1.33             ResponseHandler & handler)
 243 kumpf         1.1      {
 244 kumpf         1.15         // get userName and only privileged user can execute this operation
 245 kumpf         1.19         String userName;
 246                            try
 247                            {
 248 kumpf         1.37             IdentityContainer container = context.get(IdentityContainer::NAME);
 249 kumpf         1.19             userName = container.getUserName();
 250                            }
 251                            catch (...)
 252                            {
 253                                userName = String::EMPTY;
 254                            }
 255 kumpf         1.15     
 256 r.kieninger   1.92.4.1 #ifndef PEGASUS_OS_ZOS
 257 chip          1.24         if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
 258 kumpf         1.15         {
 259 humberto      1.48         	//l10n
 260                        	//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED,
 261 r.kieninger   1.92.4.1 	    //"You must have superuser privilege to modify the registration.");
 262 humberto      1.48     	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,MessageLoaderParms(
 263                        	    		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_MODIFY_REGISTRATION",
 264                        	    		"You must have superuser privilege to modify the registration.")); 	
 265 kumpf         1.15         }
 266 r.kieninger   1.92.4.1 #endif
 267 kumpf         1.15     
 268 kumpf         1.36         if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP))
 269 kumpf         1.10         {
 270 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 271 kumpf         1.36                 instanceReference.getNameSpace().getString());
 272 kumpf         1.10         }
 273                        
 274 kumpf         1.1          //
 275                            // only support to modify the instance of PG_ProviderCapabilities
 276                            //
 277 r.kieninger   1.92.4.1     if (!instanceReference.getClassName().equal
 278 kumpf         1.36             (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES))
 279 kumpf         1.1          {
 280 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 281 kumpf         1.36                 instanceReference.getClassName().getString());
 282 kumpf         1.1          }
 283                        
 284                            //
 285 kumpf         1.2          // only can modify the property of Namespaces, property of
 286 kumpf         1.1          // SupportedProperties, and property of SupportedMethods
 287                            //
 288 kumpf         1.2          if (propertyList.isNull())
 289 kumpf         1.1          {
 290 humberto      1.48         	//l10n
 291                        	//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 292                        	    //"Only can modify Namespaces, SupportedProperties, and SupportedMethods.");
 293                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, MessageLoaderParms(
 294                        	    		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.CAN_ONLY_MODIFY_ERR",
 295 humberto      1.50     	    		"Only can modify Namespaces, SupportedProperties, and SupportedMethods."));
 296 kumpf         1.2          }
 297                        
 298 kumpf         1.28         Array<CIMName> propertyArray = propertyList.getPropertyNameArray();
 299 kumpf         1.2          for (Uint32 i=0; i<propertyArray.size(); i++)
 300                            {
 301 kumpf         1.36     	if (!propertyArray[i].equal (_PROPERTY_NAMESPACES) &&
 302                        	    !propertyArray[i].equal (_PROPERTY_SUPPORTEDPROPERTIES) &&
 303                        	    !propertyArray[i].equal (_PROPERTY_SUPPORTEDMETHODS))
 304 kumpf         1.1      	{
 305 r.kieninger   1.92.4.1 	    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 306 kumpf         1.36                     propertyArray[i].getString());
 307 kumpf         1.2      	}
 308 kumpf         1.1          }
 309                        
 310                            // begin processing the request
 311                            handler.processing();
 312                        
 313                            try
 314                            {
 315 r.kieninger   1.92.4.1         _providerRegistrationManager->modifyInstance(instanceReference,
 316                        						     instanceObject,
 317                        						     includeQualifiers,
 318 kumpf         1.60     	    					     propertyArray);
 319 kumpf         1.1          }
 320 kumpf         1.90         catch(const CIMException&)
 321 kumpf         1.1          {
 322 david.dillard 1.78             throw;
 323 kumpf         1.1          }
 324                        
 325                            // complete processing the request
 326                            handler.complete();
 327                        }
 328                        
 329                        // register a provider
 330                        void ProviderRegistrationProvider::createInstance(
 331                            const OperationContext & context,
 332 kumpf         1.13         const CIMObjectPath & instanceReference,
 333 kumpf         1.1          const CIMInstance & instanceObject,
 334 kumpf         1.33         ObjectPathResponseHandler & handler)
 335 kumpf         1.1      {
 336 kumpf         1.15         // get userName and only privileged user can execute this operation
 337 kumpf         1.19         String userName;
 338                            try
 339                            {
 340 kumpf         1.37             IdentityContainer container = context.get(IdentityContainer::NAME);
 341 kumpf         1.19             userName = container.getUserName();
 342                            }
 343                            catch (...)
 344                            {
 345                                userName = String::EMPTY;
 346                            }
 347 kumpf         1.15     
 348 r.kieninger   1.92.4.1 #ifndef PEGASUS_OS_ZOS
 349 chip          1.24         if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
 350 kumpf         1.15         {
 351 humberto      1.48         	//l10n
 352                        	//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED,
 353 r.kieninger   1.92.4.1 	    //"You must have superuser privilege to register providers.");
 354 humberto      1.48     	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, MessageLoaderParms(
 355                        	    			"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_REGISTER_PROVIDERS",
 356                        	    			"You must have superuser privilege to register providers.")); 	
 357 kumpf         1.15         }
 358 r.kieninger   1.92.4.1 #endif
 359 kumpf         1.36         CIMName className = instanceReference.getClassName();
 360                            CIMNamespaceName nameSpace = instanceReference.getNameSpace();
 361 kumpf         1.1      
 362 kumpf         1.13         CIMObjectPath returnReference;
 363 kumpf         1.1      
 364                            CIMInstance instance = instanceObject;
 365                        
 366 kumpf         1.36         if(!nameSpace.equal (PEGASUS_NAMESPACENAME_INTEROP))
 367 kumpf         1.10         {
 368 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 369 kumpf         1.36                 nameSpace.getString());
 370 kumpf         1.10         }
 371                        
 372 kumpf         1.1          // ensure the class existing in the specified namespace
 373 kumpf         1.36         if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) &&
 374                               !className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) &&
 375 kumpf         1.46            !className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES) &&
 376 kumpf         1.36            !className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 377 kumpf         1.1          {
 378 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 379 kumpf         1.36                 className.getString());
 380 kumpf         1.1          }
 381                        
 382                            //
 383                            // Check all required properties are set
 384                            //
 385 kumpf         1.36         if (className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 386 kumpf         1.1          {
 387                        	//
 388                        	// Name, Version, InterfaceType, InterfaceVersion, and Location
 389                        	// properties must be set
 390                        	// OperationalStatus property needs to be set. If not, set to default
 391                        	//
 392 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULE_NAME) ==
 393                                    PEG_NOT_FOUND)
 394 kumpf         1.1      	{
 395 humberto      1.53     		//l10n 485
 396 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 397                        		//"Missing Name which is required property in PG_ProviderModule class.");
 398                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 399 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_NAME_IN_PG_PROVIDERMODULE",
 400                        		"Missing Name which is required property in PG_ProviderModule class."));
 401 kumpf         1.12     	}
 402                        
 403 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_VENDOR) == PEG_NOT_FOUND)
 404 kumpf         1.12     	{
 405 humberto      1.53     		//l10n 485
 406 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 407                        		//"Missing Vendor which is required property in PG_ProviderModule class.");
 408                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 409 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_VENDOR_IN_PG_PROVIDERMODULE",
 410                        		"Missing Vendor which is required property in PG_ProviderModule class."));
 411 kumpf         1.1      	}
 412                        
 413 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_VERSION) == PEG_NOT_FOUND)
 414 kumpf         1.1      	{
 415 humberto      1.53     		//l10n 485
 416 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 417                        		//"Missing Version which is required property in PG_ProviderModule class.");
 418                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 419 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_VERSION_IN_PG_PROVIDERMODULE",
 420                        		"Missing Version which is required property in PG_ProviderModule class."));
 421 kumpf         1.1      	}
 422                        
 423 kumpf         1.41             Uint32 ifcTypeIndex =
 424                                    instanceObject.findProperty(_PROPERTY_INTERFACETYPE);
 425                        	if (ifcTypeIndex == PEG_NOT_FOUND)
 426 kumpf         1.1      	{
 427 humberto      1.53     		//l10n 485
 428 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 429                        		//"Missing InterfaceType which is required property in PG_ProviderModule class.");
 430                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 431 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_INTERFACETYPE_IN_PG_PROVIDERMODULE",
 432 humberto      1.54     		"Missing InterfaceType which is required property in PG_ProviderModule class."));
 433 kumpf         1.1      	}
 434 kumpf         1.41             String ifcTypeString;
 435                                instanceObject.getProperty(ifcTypeIndex).getValue().
 436                                    get(ifcTypeString);
 437 mday          1.45     
 438 schuur        1.63             if (ifcTypeString != "C++Default"
 439 se.gupta      1.72     #ifdef PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER
 440 schuur        1.63                 && ifcTypeString != "CMPI"
 441                        #endif
 442 mark.hamzy    1.85     #ifdef PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER
 443                                    && (ifcTypeString != "JMPI")
 444                                    && (ifcTypeString != "JMPIExperimental")
 445                        #endif
 446 schuur        1.63     	        )
 447 kumpf         1.41     	{
 448 humberto      1.53     		//l10n 485
 449 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 450                        		//"Unsupported InterfaceType value: \"" + ifcTypeString + "\"");
 451                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms(
 452 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.UNSUPPORTED_INTERFACETYPE_VALUE",
 453                        		"Unsupported InterfaceType value: \"$0\"",ifcTypeString));
 454 kumpf         1.41     	}
 455 kumpf         1.1      
 456 kumpf         1.41             Uint32 ifcVersionIndex =
 457                                    instanceObject.findProperty(_PROPERTY_INTERFACEVERSION);
 458                        	if (ifcVersionIndex == PEG_NOT_FOUND)
 459 kumpf         1.1      	{
 460 humberto      1.53     		//l10n 485
 461 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 462                        		//"Missing InterfaceVersion which is required property in PG_ProviderModule class.");
 463                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 464 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_INTERFACEVERSION_IN_PG_PROVIDERMODULE",
 465                        		"Missing InterfaceVersion which is required property in PG_ProviderModule class."));
 466 kumpf         1.41     	}
 467                                String ifcVersionString;
 468                                instanceObject.getProperty(ifcVersionIndex).getValue().
 469                                    get(ifcVersionString);
 470 schuur        1.63             if (
 471 se.gupta      1.72     #ifdef PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER
 472 schuur        1.63                (ifcTypeString == "CMPI" &&
 473                                    ifcVersionString != "2.0.0") ||
 474                        #endif
 475 mark.hamzy    1.85     #ifdef PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER
 476                                   (ifcTypeString == "JMPI" &&
 477                                    ifcVersionString != "1.0.0" &&
 478                                    ifcVersionString != "2.0.0" &&
 479                                    ifcVersionString != "2.2.0") ||
 480                                   (ifcTypeString == "JMPIExperimental" &&
 481                                    ifcVersionString != "0.0.1") ||
 482                        #endif
 483 schuur        1.63                (ifcTypeString == "C++Default" &&
 484                                    ifcVersionString != "2.1.0" &&
 485                                    ifcVersionString != "2.2.0" &&
 486 kumpf         1.74                 ifcVersionString != "2.3.0" &&
 487 kumpf         1.86                 ifcVersionString != "2.5.0" &&
 488                                    ifcVersionString != "2.6.0"))
 489 kumpf         1.41     	{
 490 humberto      1.53     		//l10n 485
 491 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 492                        		//"Unsupported InterfaceVersion value: \"" + ifcVersionString +
 493                                           // "\"");
 494                                String unsupported = "InterfaceVersion";
 495                                throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms(
 496 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.UNSUPPORTED_INTERFACEVERSION_VALUE",
 497                        		"Unsupported InterfaceVersion value: \"$0\"",ifcVersionString));
 498 kumpf         1.1      	}
 499                        
 500 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_LOCATION) == PEG_NOT_FOUND)
 501 kumpf         1.1      	{
 502 humberto      1.53     		//l10n 485
 503 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 504                        		//"Missing Location which is required property in PG_ProviderModule class.");
 505                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 506 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_LOCATION_IN_PG_PROVIDERMODULE",
 507                        		"Missing Location which is required property in PG_ProviderModule class."));
 508 kumpf         1.1      	}
 509                        
 510 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_OPERATIONALSTATUS) ==
 511 kumpf         1.27                 PEG_NOT_FOUND)
 512 kumpf         1.1      	{
 513                        	    Array<Uint16> _operationalStatus;
 514 kumpf         1.68     	    _operationalStatus.append(CIM_MSE_OPSTATUS_VALUE_OK);
 515 kumpf         1.1      	    instance.addProperty (CIMProperty
 516                        		(_PROPERTY_OPERATIONALSTATUS, _operationalStatus));
 517                        	}
 518 kumpf         1.74     
 519                                //
 520                                // Validate the UserContext property
 521                                //
 522 kumpf         1.76             CIMValue userContextValue;
 523 kumpf         1.74             Uint32 userContextIndex = instanceObject.findProperty(
 524                                    PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT);
 525 kumpf         1.76     
 526 kumpf         1.74             if (userContextIndex != PEG_NOT_FOUND)
 527                                {
 528 kumpf         1.76                 userContextValue =
 529                                        instanceObject.getProperty(userContextIndex).getValue();
 530                                }
 531                        
 532                                if (!userContextValue.isNull())
 533                                {
 534 kumpf         1.74     #ifdef PEGASUS_DISABLE_PROV_USERCTXT
 535                                    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
 536                                        "ControlProviders.ProviderRegistrationProvider."
 537                                            "ProviderRegistrationProvider.USERCONTEXT_UNSUPPORTED",
 538                                        "The UserContext property in the PG_ProviderModule class is "
 539                                            "not supported."));
 540                        #else
 541 kumpf         1.76                 Uint16 userContext;
 542                                    userContextValue.get(userContext);
 543 kumpf         1.74     
 544                                    if (!(
 545                        # ifndef PEGASUS_DISABLE_PROV_USERCTXT_REQUESTOR
 546 kumpf         1.76                       (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) ||
 547 kumpf         1.74     # endif
 548                        # ifndef PEGASUS_DISABLE_PROV_USERCTXT_DESIGNATED
 549 kumpf         1.76                       (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED) ||
 550 kumpf         1.74     # endif
 551                        # ifndef PEGASUS_DISABLE_PROV_USERCTXT_PRIVILEGED
 552 kumpf         1.76                       (userContext == PG_PROVMODULE_USERCTXT_PRIVILEGED) ||
 553 kumpf         1.74     # endif
 554                        # ifndef PEGASUS_DISABLE_PROV_USERCTXT_CIMSERVER
 555 kumpf         1.76                       (userContext == PG_PROVMODULE_USERCTXT_CIMSERVER) ||
 556 kumpf         1.74     # endif
 557                                          0))
 558                                    {
 559                                        throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
 560                                            MessageLoaderParms(
 561                                                "ControlProviders.ProviderRegistrationProvider."
 562                                                    "ProviderRegistrationProvider."
 563                                                    "UNSUPPORTED_USERCONTEXT_VALUE",
 564                                                "Unsupported UserContext value: \"$0\".",
 565 kumpf         1.76                             userContext));
 566 kumpf         1.74                 }
 567                        
 568                                    // DesignatedUserContext property is required when UserContext == 3
 569 kumpf         1.76                 if (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)
 570 kumpf         1.74                 {
 571                                        Uint32 designatedUserIndex = instanceObject.findProperty(
 572                                            PEGASUS_PROPERTYNAME_MODULE_DESIGNATEDUSER);
 573                                        if ((designatedUserIndex == PEG_NOT_FOUND) ||
 574                                            instanceObject.getProperty(designatedUserIndex).getValue()
 575                                                .isNull())
 576                                        {
 577                                            throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
 578                                                MessageLoaderParms(
 579                                                    "ControlProviders.ProviderRegistrationProvider."
 580                                                        "ProviderRegistrationProvider."
 581                                                        "MISSING_DESIGNATEDUSER_IN_PG_PROVIDERMODULE",
 582                                                    "Missing DesignatedUserContext property in "
 583                                                        "PG_ProviderModule instance."));
 584                                        }
 585                                        else
 586                                        {
 587                                            // Validate that DesignatedUserContext is of String type
 588                                            String designatedUser;
 589                                            instanceObject.getProperty(designatedUserIndex).getValue()
 590                                                .get(designatedUser);
 591 kumpf         1.74                     }
 592                                    }
 593                        #endif
 594                                }
 595 kumpf         1.1          }
 596 kumpf         1.36         else if (className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES))
 597 kumpf         1.1          {
 598                        	//
 599                        	// ProviderModuleName, ProviderName, InstanceID, ClassName,
 600                         	// Namespaces, and ProviderType properties must be set
 601                        	//
 602                        
 603 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) ==
 604                                    PEG_NOT_FOUND)
 605 kumpf         1.1      	{
 606 humberto      1.53     		//l10n 485
 607 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 608                        		//"Missing ProviderModuleName which is required property in PG_ProviderCapabilities class.");
 609                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 610 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDERMODULENAME_IN_PG_PROVIDERCAPABILITIES",
 611                        		"Missing ProviderModuleName which is required property in PG_ProviderCapabilities class."));
 612 kumpf         1.1      	}
 613                        
 614 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) ==
 615 kumpf         1.27                 PEG_NOT_FOUND)
 616 kumpf         1.1      	{
 617 humberto      1.53     		//l10n 485
 618 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 619                        		//"Missing ProviderName which is required property in PG_ProviderCapabilities class.");
 620                        		String missing = "ProviderName";
 621                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 622                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY",
 623 humberto      1.53     		"Missing ProviderName which is required property in PG_ProviderCapabilities class."));
 624 kumpf         1.1      	}
 625                        
 626 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) ==
 627 kumpf         1.27                 PEG_NOT_FOUND)
 628 kumpf         1.1      	{
 629 humberto      1.53     		//l10n 485
 630 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 631                        		//"Missing CapabilityID which is required property in PG_ProviderCapabilities class.");
 632                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 633 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSINGCAPABILITYID_IN_PG_PROVIDERCAPABILITIES",
 634                        		"Missing CapabilityID which is required property in PG_ProviderCapabilities class."));
 635 kumpf         1.1      	}
 636                        
 637 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_CLASSNAME) == PEG_NOT_FOUND)
 638 kumpf         1.1      	{
 639 humberto      1.53     		//l10n 485
 640 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 641                        		//"Missing ClassName which is required property in PG_ProviderCapabilities class.");
 642                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 643 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_CLASSNAME_IN_PG_PROVIDERCAPABILITIES",
 644                        		"Missing ClassName which is required property in PG_ProviderCapabilities class."));
 645 kumpf         1.1      	}
 646                        
 647 kumpf         1.80             // Validate the Namespaces property
 648                        
 649                                Uint32 namespacesIndex =
 650                                    instanceObject.findProperty(_PROPERTY_NAMESPACES);
 651                                Array<String> namespacesArray;
 652                                if (namespacesIndex != PEG_NOT_FOUND)
 653                                {
 654                                    CIMValue namespacesValue =
 655                                        instanceObject.getProperty(namespacesIndex).getValue();
 656                                    if (!namespacesValue.isNull())
 657                                    {
 658                                        namespacesValue.get(namespacesArray);
 659                                    }
 660                                }
 661                        
 662                                if (namespacesArray.size() == 0)
 663 kumpf         1.1      	{
 664 kumpf         1.80                 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
 665                                        "ControlProviders.ProviderRegistrationProvider."
 666                                            "ProviderRegistrationProvider."
 667                                            "MISSING_NAMESPACES_IN_PG_PROVIDERCAPABILITIES",
 668                                        "Missing Namespaces which is required property in "
 669                                            "PG_ProviderCapabilities class."));
 670 kumpf         1.1      	}
 671                        
 672 kumpf         1.77             // Validate the ProviderType property
 673                        
 674                                Uint32 providerTypeIndex =
 675                                    instanceObject.findProperty(_PROPERTY_PROVIDERTYPE);
 676                                Array<Uint16> providerTypeArray;
 677                                if (providerTypeIndex != PEG_NOT_FOUND)
 678                                {
 679 kumpf         1.80                 CIMValue providerTypeValue =
 680                                        instanceObject.getProperty(providerTypeIndex).getValue();
 681                                    if (!providerTypeValue.isNull())
 682                                    {
 683                                        providerTypeValue.get(providerTypeArray);
 684                                    }
 685 kumpf         1.77             }
 686                        
 687 kumpf         1.80             if (providerTypeArray.size() == 0)
 688 kumpf         1.77             {
 689                                    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
 690                                        MessageLoaderParms(
 691                                            "ControlProviders.ProviderRegistrationProvider."
 692                                                "ProviderRegistrationProvider."
 693                                                "MISSING_PROVIDERTYPE_IN_PG_PROVIDERCAPABILITIES",
 694                                            "Missing ProviderType which is required property in "
 695                                                "PG_ProviderCapabilities class."));
 696                                }
 697                        
 698                                for (Uint32 i = 0; i < providerTypeArray.size(); i++)
 699                                {
 700                                    if ((providerTypeArray[i] < 2) ||
 701                        #ifdef PEGASUS_DISABLE_EXECQUERY
 702                                        (providerTypeArray[i] > 6)
 703                        #else
 704                                        (providerTypeArray[i] > 7)
 705                        #endif
 706                                                                  )
 707                                    {
 708                                        throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
 709 kumpf         1.77                         MessageLoaderParms(
 710                                                "ControlProviders.ProviderRegistrationProvider."
 711                                                    "ProviderRegistrationProvider.UNSUPPORTED_"
 712                                                    "PROVIDERTYPE_IN_PG_PROVIDERCAPABILITIES",
 713                                                "Unsupported ProviderType value \"$0\" in "
 714                                                    "PG_ProviderCapabilities instance.",
 715                                                providerTypeArray[i]));
 716                                    }
 717                                }
 718 kumpf         1.1          }
 719 kumpf         1.46         else if (className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES))
 720                            {
 721                        	//
 722                        	// ProviderModuleName, ProviderName, CapabilityID, ProviderType,
 723                         	// and Destinations properties must be set
 724                        	//
 725                        
 726                        	if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) ==
 727                                    PEG_NOT_FOUND)
 728                        	{
 729 humberto      1.49     //L10N_ TODO DONE
 730                        	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 731                        		//"Missing ProviderModuleName which is required property in PG_ConsumerCapabilities class.");
 732                        	    MessageLoaderParms parms(
 733                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_MODULE_NAME_WHICH_IS_REQUIRED",
 734 kumpf         1.46     		"Missing ProviderModuleName which is required property in PG_ConsumerCapabilities class.");
 735 humberto      1.49     
 736                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
 737 kumpf         1.46     	}
 738                        
 739 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_PROVIDERNAME) ==
 740 kumpf         1.46                 PEG_NOT_FOUND)
 741                        	{
 742 humberto      1.49     //L10N_ TODO DONE
 743                        	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 744                        		//"Missing ProviderName which is required property in PG_ConsumerCapabilities class.");
 745                        
 746                        	    MessageLoaderParms parms(
 747                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_NAME_WHICH_IS_REQUIRED",
 748 kumpf         1.46     		"Missing ProviderName which is required property in PG_ConsumerCapabilities class.");
 749 humberto      1.49     
 750                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
 751 kumpf         1.46     	}
 752                        
 753 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_CAPABILITYID) ==
 754 kumpf         1.46                 PEG_NOT_FOUND)
 755                        	{
 756 humberto      1.49     //L10N_ TODO DONE
 757                        	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 758                        		//"Missing CapabilityID which is required property in PG_ConsumerCapabilities class.");
 759                        
 760                        	    MessageLoaderParms parms(
 761                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_CAPABILITY_ID_WHICH_IS_REQUIRED",
 762 kumpf         1.46     		"Missing CapabilityID which is required property in PG_ConsumerCapabilities class.");
 763 humberto      1.49     
 764                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
 765 kumpf         1.46     	}
 766                        
 767                        	if (instanceObject.findProperty(_PROPERTY_PROVIDERTYPE) == PEG_NOT_FOUND)
 768                        	{
 769 humberto      1.49     //L10N_ TODO DONE
 770                        	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 771                        		//"Missing ProviderType which is required property in PG_ConsumerCapabilities class.");
 772                        
 773                        	    MessageLoaderParms parms(
 774                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDER_TYPE_WHICH_IS_REQUIRED",
 775 kumpf         1.46     		"Missing ProviderType which is required property in PG_ConsumerCapabilities class.");
 776 humberto      1.49     
 777                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
 778 kumpf         1.46     	}
 779                        
 780 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_INDICATIONDESTINATIONS) ==
 781 kumpf         1.46     	    PEG_NOT_FOUND)
 782                        	{
 783 humberto      1.49     //L10N_ TODO DONE
 784                        	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 785                        		//"Missing Destinations which is required property in PG_ConsumerCapabilities class.");
 786                        
 787                        	    MessageLoaderParms parms(
 788                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_DESTINATIONS_TYPE_WHICH_IS_REQUIRED",
 789 kumpf         1.46     		"Missing Destinations which is required property in PG_ConsumerCapabilities class.");
 790 humberto      1.49     
 791                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
 792 kumpf         1.46     	}
 793                            }
 794 kumpf         1.10         else // PEGASUS_CLASSNAME_PROVIDER
 795 kumpf         1.1          {
 796                        	//
 797                        	// Name and ProviderModuleName properties must be set
 798                        	//
 799 kumpf         1.27     	if (instanceObject.findProperty(_PROPERTY_PROVIDER_NAME) == PEG_NOT_FOUND)
 800 kumpf         1.1      	{
 801 humberto      1.53     		//l10n 485
 802 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 803                        		//"Missing Name which is required property in PG_Provider class.");
 804                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 805                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_REQUIRED_PROPERTY",
 806 humberto      1.53     		"Missing Name which is required property in PG_Provider class."));
 807 kumpf         1.1      	}
 808                        	
 809 r.kieninger   1.92.4.1 	if (instanceObject.findProperty(_PROPERTY_PROVIDERMODULENAME) ==
 810 kumpf         1.27                 PEG_NOT_FOUND)
 811 kumpf         1.1      	{
 812 humberto      1.53     		//l10n 485
 813 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 814                        		//"Missing ProviderModuleName which is required property in PG_Provider class.");
 815                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 816 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.MISSING_PROVIDERMODULENAME_IN_PG_PROVIDER",
 817                        		"Missing ProviderModuleName which is required property in PG_Provider class."));
 818 kumpf         1.1      	}
 819                            }
 820                        
 821                            // begin processing the request
 822                            handler.processing();
 823                        	
 824                            try
 825                            {
 826 david.dillard 1.78             returnReference =
 827                                    _providerRegistrationManager->createInstance(instanceReference, instance);
 828 kumpf         1.1          }
 829 david.dillard 1.78         catch(const CIMException&)
 830 kumpf         1.1          {
 831 david.dillard 1.78             throw;
 832 kumpf         1.1          }
 833                        
 834                            handler.deliver(returnReference);
 835                        
 836                            // complete processing request
 837                            handler.complete();
 838                        }
 839                        
 840                        // Unregister a provider
 841                        void ProviderRegistrationProvider::deleteInstance(
 842                            const OperationContext & context,
 843 kumpf         1.13         const CIMObjectPath & instanceReference,
 844 kumpf         1.33         ResponseHandler & handler)
 845 kumpf         1.1      {
 846 kumpf         1.15         // get userName and only privileged user can execute this operation
 847 kumpf         1.19         String userName;
 848                            try
 849                            {
 850 kumpf         1.37             IdentityContainer container = context.get(IdentityContainer::NAME);
 851 kumpf         1.19             userName = container.getUserName();
 852                            }
 853                            catch (...)
 854                            {
 855                                userName = String::EMPTY;
 856                            }
 857 kumpf         1.15     
 858 r.kieninger   1.92.4.1 #ifndef PEGASUS_OS_ZOS
 859 chip          1.24         if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
 860 kumpf         1.15         {
 861 humberto      1.48         	//l10n
 862                        	//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED,
 863                        	    //"You must have superuser privilege to unregister providers.");
 864                        	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,MessageLoaderParms(
 865                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_UNREGISTER_PROVIDERS",
 866                        	    "You must have superuser privilege to unregister providers.")); 	
 867 kumpf         1.15         }
 868 r.kieninger   1.92.4.1 #endif
 869 kumpf         1.36         if(!instanceReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP))
 870 kumpf         1.10         {
 871 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 872 kumpf         1.36                 instanceReference.getNameSpace().getString());
 873 kumpf         1.10         }
 874                        
 875 chuck         1.47     
 876                        // l10n
 877                            // Get the client's list of preferred languages for the response
 878 kumpf         1.83         AcceptLanguageList al;
 879 r.kieninger   1.92.4.1     try
 880 chuck         1.47         {
 881 r.kieninger   1.92.4.1         AcceptLanguageListContainer al_container =
 882 chuck         1.47     		(AcceptLanguageListContainer)context.get(AcceptLanguageListContainer::NAME);
 883                                al = al_container.getLanguages();
 884                            }
 885                            catch (...)
 886                            {
 887 kumpf         1.83             ;   // Leave AcceptLanguageList empty
 888 chuck         1.47         }
 889                        
 890 kumpf         1.36         CIMName className = instanceReference.getClassName();
 891 kumpf         1.1      
 892                            // ensure the class existing in the specified namespace
 893 kumpf         1.36         if(!className.equal (PEGASUS_CLASSNAME_PROVIDER) &&
 894                               !className.equal (PEGASUS_CLASSNAME_PROVIDERCAPABILITIES) &&
 895 kumpf         1.46            !className.equal (PEGASUS_CLASSNAME_CONSUMERCAPABILITIES) &&
 896 kumpf         1.36            !className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 897 kumpf         1.1          {
 898 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 899 kumpf         1.36                 className.getString());
 900 kumpf         1.1          }
 901                        
 902                            // begin processing the request
 903                            handler.processing();
 904                        
 905 kumpf         1.43         String moduleName;
 906                            Boolean moduleFound = false;
 907                            Array<CIMKeyBinding> keys = instanceReference.getKeyBindings();
 908                        
 909                            //
 910 r.kieninger   1.92.4.1     // disable provider before delete provider
 911 kumpf         1.43         // registration if the class is PG_Provider
 912                            //
 913                            if (className.equal (PEGASUS_CLASSNAME_PROVIDER))
 914                            {
 915                            	// get module name from reference
 916                        
 917                            	for(Uint32 i=0; i<keys.size() ; i++)
 918                            	{
 919                        	    if(keys[i].getName().equal (_PROPERTY_PROVIDERMODULENAME))
 920                        	    {
 921                        	        moduleName = keys[i].getValue();
 922                        	        moduleFound = true;
 923                        	    }
 924                        	}
 925                        
 926                            	// if _PROPERTY_PROVIDERMODULENAME key not found
 927                            	if( !moduleFound)
 928                            	{
 929 humberto      1.53         		//l10n 485
 930 humberto      1.48     	    //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 931                        		//"key ProviderModuleName was not found");
 932                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms(
 933 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.PROVIDERMODULENAME_KEY_NOT_FOUND",
 934                        		"key ProviderModuleName was not found"));
 935 kumpf         1.43         	}
 936                        
 937 r.kieninger   1.92.4.1 	//
 938                        	// disable the provider
 939 kumpf         1.43     	//
 940                        	try
 941                        	{
 942 kumpf         1.51     	     Sint16 ret_value = _disableModule(instanceReference, moduleName, true, al);
 943                        
 944 kumpf         1.43                  //
 945                                     // if the provider disable failed
 946                                     //
 947 chuck         1.47     // l10n
 948 kumpf         1.51                  if (ret_value == -1)
 949 kumpf         1.43                  {
 950 humberto      1.48                  	//l10n
 951                                         //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 952                                             //"disable the provider failed.");
 953                                         throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 954                        					"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.DISABLE_PROVIDER_FAILED",
 955                                            "disable the provider failed."));
 956 kumpf         1.43                  }
 957 kumpf         1.51     	     //
 958                                     // The provider disable failed since there are pending requests
 959                                     //
 960                                     if (ret_value == -2)
 961                                     {
 962                        //L10N TODO
 963 humberto      1.52                     // throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
 964                                             //"disable the provider failed: Provider is busy.");
 965                                         throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
 966                        					"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.DISABLE_PROVIDER_FAILED_PROVIDER_BUSY",
 967                                            "disable the provider failed: Provider is busy."));
 968 kumpf         1.51                  }
 969 kumpf         1.43     	}
 970                            	catch(CIMException&)
 971                            	{
 972                        	    throw;
 973                            	}
 974                            }
 975                        
 976                            //
 977                            // disable provider module before remove provider registration
 978 r.kieninger   1.92.4.1     // if the class is PG_ProviderModule
 979 kumpf         1.43         //
 980                        
 981                            if (className.equal (PEGASUS_CLASSNAME_PROVIDERMODULE))
 982                            {
 983                            	// get module name from reference
 984                        
 985                            	for(Uint32 i=0; i<keys.size() ; i++)
 986                            	{
 987                        	    if(keys[i].getName().equal (_PROPERTY_PROVIDERMODULE_NAME))
 988                        	    {
 989                        	        moduleName = keys[i].getValue();
 990                        	        moduleFound = true;
 991                        	    }
 992                        	}
 993                        
 994                            	// if _PROPERTY_PROVIDERMODULE_NAME key not found
 995                            	if( !moduleFound)
 996                            	{
 997 humberto      1.53         		//l10n 485
 998 humberto      1.48     	//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
 999                        		//"key Name was not found");
1000                        		throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms(
1001 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.NAME_KEY_NOT_FOUND",
1002                        		"key Name was not found"));
1003 kumpf         1.43         	}
1004                        
1005 r.kieninger   1.92.4.1 	//
1006 kumpf         1.43     	// disable the provider module
1007                        	//
1008                        	try
1009                        	{
1010 kumpf         1.51     	    Sint16 ret_value = _disableModule(instanceReference, moduleName, false, al);
1011                        
1012 kumpf         1.43                 //
1013                                    // if the provider module disable failed
1014                                    //
1015 chuck         1.47     // l10n
1016 kumpf         1.51                 if (ret_value == -1)
1017 kumpf         1.43                 {
1018 humberto      1.48                 	//l10n
1019                                         //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1020                                             //"disable the provider module failed.");
1021                                             throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
1022                        						"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.DISABLE_PROVIDER_MODULE_FAILED",
1023                                             	"disable the provider module failed."));
1024 kumpf         1.43                 }
1025 r.kieninger   1.92.4.1 	
1026 kumpf         1.51     	    //
1027                                    // The provider module disable failed since there are pending requests
1028                                    //
1029                                    if (ret_value == -2)
1030                                    {
1031                        //L10N TODO
1032 humberto      1.52                      //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1033                                            // "disable the provider module failed: Provider is busy.");
1034                                         throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,MessageLoaderParms(
1035                        						"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.DISABLE_PROVIDER_MODULE_FAILED_PROVIDER_BUSY",
1036                                             	"disable the provider module failed: Provider is busy."));
1037 kumpf         1.51                 }
1038 david.dillard 1.78             }
1039                                catch(const CIMException&)
1040                                {
1041                                    throw;
1042                                }
1043 kumpf         1.43         }
1044                        
1045 kumpf         1.1          try
1046                            {
1047 david.dillard 1.78             _providerRegistrationManager->deleteInstance(instanceReference);
1048 kumpf         1.1          }
1049 david.dillard 1.78         catch(const CIMException&)
1050 kumpf         1.1          {
1051 david.dillard 1.78             throw;
1052 kumpf         1.1          }
1053                        
1054                            // complete processing the request
1055                            handler.complete();
1056                        }
1057                        
1058                        // Block a provider, unblock a provider, and stop a provider
1059                        void ProviderRegistrationProvider::invokeMethod(
1060                            const OperationContext & context,
1061 kumpf         1.13         const CIMObjectPath & objectReference,
1062 kumpf         1.28         const CIMName & methodName,
1063 kumpf         1.1          const Array<CIMParamValue> & inParameters,
1064 kumpf         1.33         MethodResultResponseHandler & handler)
1065 kumpf         1.1      {
1066 kumpf         1.15         // get userName and only privileged user can execute this operation
1067 kumpf         1.19         String userName;
1068                            try
1069                            {
1070 kumpf         1.37             IdentityContainer container = context.get(IdentityContainer::NAME);
1071 kumpf         1.19             userName = container.getUserName();
1072                            }
1073                            catch (...)
1074                            {
1075                                userName = String::EMPTY;
1076                            }
1077 kumpf         1.15     
1078 r.kieninger   1.92.4.1 #ifndef PEGASUS_OS_ZOS
1079 chip          1.24         if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName))
1080 mday          1.17         {
1081 humberto      1.48         	//l10n
1082                        	//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED,
1083 r.kieninger   1.92.4.1 	    //"You must have superuser privilege to disable or enable providers.");
1084 humberto      1.48     	    throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,MessageLoaderParms(
1085                        		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SUPERUSER_PRIVILEGE_REQUIRED_DISABLE_ENABLE_PROVIDERS",
1086                        	    "You must have superuser privilege to disable or enable providers.")); 	
1087 mday          1.17         }
1088 r.kieninger   1.92.4.1 #endif
1089 kumpf         1.36         if(!objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP))
1090 kumpf         1.10         {
1091 r.kieninger   1.92.4.1 	throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
1092 kumpf         1.36                 objectReference.getNameSpace().getString());
1093 kumpf         1.10         }
1094                        
1095 chuck         1.47     
1096                        // l10n
1097                            // Get the client's list of preferred languages for the response
1098 kumpf         1.83         AcceptLanguageList al;
1099 r.kieninger   1.92.4.1     try
1100 chuck         1.47         {
1101 r.kieninger   1.92.4.1         AcceptLanguageListContainer al_container =
1102 chuck         1.47     		(AcceptLanguageListContainer)context.get(AcceptLanguageListContainer::NAME);
1103                                al = al_container.getLanguages();
1104                            }
1105                            catch (...)
1106                            {
1107 kumpf         1.83             ;   // Leave AcceptLanguageList empty
1108 chuck         1.47         }
1109                        
1110 kumpf         1.5          String moduleName;
1111                            Boolean moduleFound = false;
1112 kumpf         1.3      
1113 kumpf         1.5          // get module name from reference
1114 kumpf         1.35         Array<CIMKeyBinding> keys = objectReference.getKeyBindings();
1115 kumpf         1.1      
1116 kumpf         1.5          for(Uint32 i=0; i<keys.size() ; i++)
1117 kumpf         1.1          {
1118 kumpf         1.36     	if(keys[i].getName().equal (_PROPERTY_PROVIDERMODULE_NAME))
1119 kumpf         1.1      	{
1120 kumpf         1.5      	    moduleName = keys[i].getValue();
1121                        	    moduleFound = true;
1122 kumpf         1.1      	}
1123                            }
1124                        
1125 kumpf         1.5          // if _PROPERTY_PROVIDERMODULE_NAME key not found
1126                            if( !moduleFound)
1127 kumpf         1.1          {
1128 humberto      1.53         	//l10n 485
1129 humberto      1.48     	throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,MessageLoaderParms(
1130 humberto      1.53     		"ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.NAME_KEY_NOT_FOUND",
1131                        		"key Name was not found"));
1132 kumpf         1.1          }
1133                        
1134 kumpf         1.5          handler.processing();
1135                        
1136                            Sint16 ret_value;
1137 kumpf         1.1      
1138 kumpf         1.56         try
1139 kumpf         1.1          {
1140 kumpf         1.56             if(methodName.equal(_STOP_PROVIDER))
1141                            	{
1142                        	    // disable module
1143 chuck         1.47         	     ret_value =  _disableModule(objectReference, moduleName, false, al);
1144 kumpf         1.8      	}
1145 kumpf         1.56         	else if(methodName.equal(_START_PROVIDER))
1146 kumpf         1.43         	{
1147 kumpf         1.56     	    // enable module
1148                            	     ret_value =  _enableModule(objectReference, moduleName, al);
1149 kumpf         1.1      	}
1150 kumpf         1.56             else
1151 david.dillard 1.78             {
1152                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY);
1153                                }
1154 kumpf         1.1          }
1155 david.dillard 1.78         catch(const CIMException&)
1156 kumpf         1.1          {
1157 david.dillard 1.78             throw;
1158 kumpf         1.1          }
1159 kumpf         1.56     
1160                            CIMValue retValue(ret_value);
1161                            handler.deliver(retValue);
1162                            handler.complete();
1163 kumpf         1.5      }
1164                        
1165                        // get provider manager service
1166                        MessageQueueService * ProviderRegistrationProvider::_getProviderManagerService()
1167                        {
1168                            MessageQueue * queue = MessageQueue::lookup(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP);
1169                            MessageQueueService * _service = dynamic_cast<MessageQueueService *>(queue);
1170                        
1171 chip          1.24         return(_service);
1172 kumpf         1.5      }
1173                        
1174                        ProviderRegistrationProvider & ProviderRegistrationProvider::operator=(const ProviderRegistrationProvider & handle)
1175                        {
1176                            if(this == &handle)
1177                            {
1178                                return(*this);
1179                            }
1180                        
1181                            return(*this);
1182                        }
1183 kumpf         1.1      
1184 kumpf         1.5      Array<Uint16> ProviderRegistrationProvider::_sendDisableMessageToProviderManager(
1185                                CIMDisableModuleRequestMessage * disable_req)
1186                        {
1187                            MessageQueueService * _service = _getProviderManagerService();
1188                            Uint32 _queueId = _service->getQueueId();
1189                        
1190                            // create request envelope
1191                            AsyncLegacyOperationStart * asyncRequest =
1192                                new AsyncLegacyOperationStart (
1193                                    NULL,
1194                                    _queueId,
1195                                    disable_req,
1196                                    _queueId);
1197                        
1198 kumpf         1.89         AsyncReply * asyncReply =
1199                                _controller->ClientSendWait(_queueId, asyncRequest);
1200 kumpf         1.10         CIMDisableModuleResponseMessage * response =
1201                        	reinterpret_cast<CIMDisableModuleResponseMessage *>(
1202 kumpf         1.70                  (dynamic_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result());
1203 kumpf         1.8          if (response->cimException.getCode() != CIM_ERR_SUCCESS)
1204                            {
1205 david.dillard 1.78             CIMException e = response->cimException;
1206 kumpf         1.8              delete asyncRequest;
1207                                delete asyncReply;
1208                                delete response;
1209 david.dillard 1.78             throw e;
1210 kumpf         1.8          }
1211 kumpf         1.5      
1212 chip          1.24         Array<Uint16> operationalStatus = response->operationalStatus;
1213 kumpf         1.8      
1214                            delete asyncRequest;
1215                            delete asyncReply;
1216                            delete response;
1217 mday          1.16     
1218 kumpf         1.5          return(operationalStatus);
1219                        }
1220                        
1221                        Array<Uint16> ProviderRegistrationProvider::_sendEnableMessageToProviderManager(
1222                                CIMEnableModuleRequestMessage * enable_req)
1223                        {
1224                            MessageQueueService * _service = _getProviderManagerService();
1225                            Uint32 _queueId = _service->getQueueId();
1226                        
1227                            // create request envelope
1228                            AsyncLegacyOperationStart * asyncRequest =
1229                                new AsyncLegacyOperationStart (
1230                                    NULL,
1231                                    _queueId,
1232                                    enable_req,
1233                                    _queueId);
1234                        
1235 kumpf         1.89         AsyncReply * asyncReply =
1236                                _controller->ClientSendWait(_queueId, asyncRequest);
1237 kumpf         1.8          CIMEnableModuleResponseMessage * response =
1238                        	reinterpret_cast<CIMEnableModuleResponseMessage *>(
1239 kumpf         1.70                  (dynamic_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result());
1240 kumpf         1.8          if (response->cimException.getCode() != CIM_ERR_SUCCESS)
1241                            {
1242                        	CIMException e = response->cimException;
1243                                delete asyncRequest;
1244                                delete asyncReply;
1245                                delete response;
1246                        	throw (e);
1247                            }
1248                        
1249 chip          1.24         Array<Uint16> operationalStatus = response->operationalStatus;
1250 kumpf         1.8      
1251                            delete asyncRequest;
1252                            delete asyncReply;
1253                            delete response;
1254 mday          1.16     
1255 kumpf         1.5          return(operationalStatus);
1256 kumpf         1.6      }
1257                        
1258                        // send termination message to subscription service
1259                        void ProviderRegistrationProvider::_sendTerminationMessageToSubscription(
1260 kumpf         1.43         const CIMObjectPath & ref, const String & moduleName,
1261 chuck         1.47         const Boolean disableProviderOnly,
1262 kumpf         1.83         const AcceptLanguageList & al)
1263 kumpf         1.6      {
1264                            CIMInstance instance;
1265                            String _moduleName;
1266                            Array<CIMInstance> instances;
1267                        
1268 kumpf         1.43         if (!disableProviderOnly)
1269                            {
1270                                CIMObjectPath reference("", PEGASUS_NAMESPACENAME_INTEROP,
1271                        	    PEGASUS_CLASSNAME_PROVIDER, ref.getKeyBindings());
1272 chip          1.24     
1273 kumpf         1.43             Array<CIMObjectPath> instanceNames =
1274 kumpf         1.91     	    _providerRegistrationManager->enumerateInstanceNamesForClass(
1275                                        reference);
1276 kumpf         1.6      
1277 kumpf         1.43             // find all the instances which have same module name as moduleName
1278                                for (Uint32 i = 0, n=instanceNames.size(); i < n; i++)
1279                                {
1280 kumpf         1.42     	    //
1281                                    // get provider module name from reference
1282                                    //
1283                        
1284                                    Array<CIMKeyBinding> keys = instanceNames[i].getKeyBindings();
1285                        
1286                                    for(Uint32 j=0; j < keys.size(); j++)
1287                                    {
1288                                        if(keys[j].getName().equal (_PROPERTY_PROVIDERMODULENAME))
1289                                        {
1290                                            _moduleName = keys[j].getValue();
1291                                        }
1292                                    }
1293 kumpf         1.6      
1294 kumpf         1.43     	    if (String::equalNoCase(moduleName, _moduleName))
1295                        	    {
1296                        	        reference.setKeyBindings(keys);
1297                        	        instance = _providerRegistrationManager->getInstance(reference);
1298 kumpf         1.55     		//
1299                        		// if the provider is indication provider
1300                        		//
1301 kumpf         1.70     		if (_isIndicationProvider(moduleName, instance))
1302 kumpf         1.55     		{
1303                        	            instances.append(instance);
1304                        		}
1305 kumpf         1.43     	    }
1306                                }
1307                            }
1308                            else
1309                            {
1310 kumpf         1.55     	instance = _providerRegistrationManager->getInstance(ref);
1311                        
1312                        	//
1313                        	// if the provider is indication provider
1314                        	//
1315 kumpf         1.70     	if (_isIndicationProvider(moduleName, instance))
1316 kumpf         1.55     	{
1317 kumpf         1.6      	    instances.append(instance);
1318 kumpf         1.55     	}
1319 kumpf         1.6          }
1320                        
1321                            //
1322                            // get indication server queueId
1323                            //
1324                            MessageQueueService * _service = _getIndicationService();
1325                        
1326 kumpf         1.15         if (_service != NULL)
1327                            {
1328                                Uint32 _queueId = _service->getQueueId();
1329 kumpf         1.6      
1330 kumpf         1.15             CIMNotifyProviderTerminationRequestMessage * termination_req =
1331                        	    new CIMNotifyProviderTerminationRequestMessage(
1332                        	        XmlWriter::getNextMessageId (),
1333                        	        instances,
1334                        	        QueueIdStack(_service->getQueueId()));
1335                        
1336 chuck         1.47     // l10n
1337 se.gupta      1.69             termination_req->operationContext.set(AcceptLanguageListContainer(al));
1338 chuck         1.47     
1339 kumpf         1.15             // create request envelope
1340 kumpf         1.88             AsyncLegacyOperationStart asyncRequest(
1341 kumpf         1.71                 NULL,
1342                                    _queueId,
1343                                    termination_req,
1344                                    _queueId);
1345 kumpf         1.6      
1346 kumpf         1.89             AutoPtr <AsyncReply> asyncReply(
1347                                    _controller->ClientSendWait(_queueId, &asyncRequest));
1348 r.kieninger   1.92.4.1 
1349 kumpf         1.71             AutoPtr <CIMNotifyProviderTerminationResponseMessage> response
1350                                    (reinterpret_cast <CIMNotifyProviderTerminationResponseMessage *>
1351                                    ((dynamic_cast <AsyncLegacyOperationResult *>
1352                                    (asyncReply.get ()))->get_result ()));
1353 r.kieninger   1.92.4.1 
1354 kumpf         1.71             if (response->cimException.getCode () != CIM_ERR_SUCCESS)
1355 kumpf         1.15             {
1356 kumpf         1.71                 CIMException e = response->cimException;
1357 david.dillard 1.78                 throw e;
1358 kumpf         1.15             }
1359 kumpf         1.6          }
1360                        }
1361                        
1362                        // get indication service
1363                        MessageQueueService * ProviderRegistrationProvider::_getIndicationService()
1364                        {
1365                            MessageQueue * queue = MessageQueue::lookup(
1366                        	PEGASUS_QUEUENAME_INDICATIONSERVICE);
1367                        
1368                            MessageQueueService * _service =
1369                        	dynamic_cast<MessageQueueService *>(queue);
1370                            return(_service);
1371 kumpf         1.43     }
1372                        
1373                        // disable provider module, return 0 if module is disabled successfully,
1374 kumpf         1.51     // return 1 if module is already disabled, return -2 if module can not be
1375                        // disabled since there are pending requests, otherwise, return -1
1376 kumpf         1.43     Sint16 ProviderRegistrationProvider::_disableModule(
1377 r.kieninger   1.92.4.1     const CIMObjectPath & objectReference,
1378 kumpf         1.43         const String & moduleName,
1379 chuck         1.47         Boolean disableProviderOnly,
1380 kumpf         1.83         const AcceptLanguageList & al)
1381 kumpf         1.43     {
1382                            	//
1383                            	// get module status
1384                            	//
1385                            	Array<Uint16> _OperationalStatus =
1386                        	    _providerRegistrationManager->getProviderModuleStatus( moduleName);
1387                        
1388                        	for (Uint32 i = 0; i<_OperationalStatus.size(); i++)
1389                        	{
1390                        	    // retValue equals 1 if module is already disabled
1391 kumpf         1.68     	    if (_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED ||
1392                        		_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)
1393 kumpf         1.43     	    {
1394                        		return (1);
1395                        	    }
1396                        	}
1397                        
1398                        	CIMInstance instance;
1399                        	Array<CIMInstance> instances;
1400                                CIMInstance mInstance;
1401                        	String _moduleName;
1402                        	CIMObjectPath providerRef;
1403 kumpf         1.55     	Boolean indProvider = false;
1404                                Array<Boolean> indicationProviders;
1405 kumpf         1.43     
1406                        	// disable a provider module or delete a provider module
1407                        	if (!disableProviderOnly)
1408                        	{
1409                        	    providerRef = CIMObjectPath(objectReference.getHost(),
1410                        				 objectReference.getNameSpace(),
1411                        				 PEGASUS_CLASSNAME_PROVIDER,
1412                        				 objectReference.getKeyBindings());
1413                        
1414                                    // get module instance
1415 r.kieninger   1.92.4.1             mInstance =
1416 kumpf         1.43     	        _providerRegistrationManager->getInstance(objectReference);
1417                        
1418                        	}
1419                        	else // disable a provider
1420                        	{
1421                                    // get module instance
1422                        	    Array <CIMKeyBinding> moduleKeyBindings;
1423                        	    moduleKeyBindings.append (CIMKeyBinding
1424 r.kieninger   1.92.4.1 		(_PROPERTY_PROVIDERMODULE_NAME, moduleName,
1425                        		 CIMKeyBinding::STRING));
1426 kumpf         1.43     
1427                        	    CIMObjectPath moduleRef(objectReference.getHost(),
1428                        				    objectReference.getNameSpace(),
1429                        				    PEGASUS_CLASSNAME_PROVIDERMODULE,
1430                        				    moduleKeyBindings);
1431 r.kieninger   1.92.4.1 				
1432                                    mInstance =
1433 kumpf         1.43     	        _providerRegistrationManager->getInstance(moduleRef);
1434                        	}
1435                        
1436                                if (!disableProviderOnly)
1437                                {
1438 r.kieninger   1.92.4.1 	    // get all provider instances which have same module name as
1439 kumpf         1.43     	    // moduleName
1440 r.kieninger   1.92.4.1  	    Array<CIMObjectPath> instanceNames =
1441 kumpf         1.91     	        _providerRegistrationManager->enumerateInstanceNamesForClass(
1442                                            providerRef);
1443 kumpf         1.43     
1444                        	    for(Uint32 i = 0, n=instanceNames.size(); i < n; i++)
1445                        	    {
1446                        	        //
1447                                        // get provider module name from reference
1448                                        //
1449                        
1450                                        Array<CIMKeyBinding> keys = instanceNames[i].getKeyBindings();
1451                        
1452                                        for(Uint32 j=0; j < keys.size(); j++)
1453                                        {
1454                                            if(keys[j].getName().equal (_PROPERTY_PROVIDERMODULENAME))
1455                                            {
1456                                                _moduleName = keys[j].getValue();
1457                                            }
1458                                        }
1459                        
1460                        	        if (String::equalNoCase(_moduleName, moduleName))
1461                        	        {
1462                        		    providerRef.setKeyBindings(keys);
1463                        		    instance = _providerRegistrationManager->getInstance
1464 kumpf         1.43     			(providerRef);
1465 kumpf         1.70     		    if (_isIndicationProvider(moduleName, instance))
1466 kumpf         1.55                         {
1467                                                indProvider = true;
1468                                                indicationProviders.append(true);
1469                                            }
1470                                            else
1471                                            {
1472                                                indicationProviders.append(false);
1473                                            }
1474 kumpf         1.43     		    instances.append(instance);
1475                        	        }
1476                        
1477                        	    }
1478                                }
1479                                else
1480                                {
1481 kumpf         1.55     	    instance = _providerRegistrationManager->getInstance(objectReference);
1482 kumpf         1.70                 if (_isIndicationProvider(moduleName, instance))
1483 kumpf         1.55                 {
1484                                        indProvider = true;
1485                                        indicationProviders.append(true);
1486                                    }
1487                                    else
1488                                    {
1489                                        indicationProviders.append(false);
1490                                    }
1491                        
1492                                    instances.append(instance);
1493 kumpf         1.43             }
1494                        
1495                                //
1496                                // get provider manager service
1497                                //
1498                                MessageQueueService * _service = _getProviderManagerService();
1499                        
1500                        	if (_service != NULL)
1501                        	{
1502                        	    // create CIMDisableModuleRequestMessage
1503                        	    CIMDisableModuleRequestMessage * disable_req =
1504                        	        new CIMDisableModuleRequestMessage(
1505                        		    XmlWriter::getNextMessageId (),
1506                        		    mInstance,
1507                        		    instances,
1508                        		    disableProviderOnly,
1509 kumpf         1.55     		    indicationProviders,
1510 kumpf         1.43     		    QueueIdStack(_service->getQueueId()));
1511 chuck         1.47     // l10n
1512 se.gupta      1.66     		disable_req->operationContext.set(AcceptLanguageListContainer(al));;
1513 kumpf         1.43     
1514                          	    Array<Uint16> _opStatus =
1515                        	        _sendDisableMessageToProviderManager(disable_req);
1516                        
1517                        	    if (!disableProviderOnly) // disable provider module
1518                        	    {
1519                        	        for (Uint32 i = 0; i<_opStatus.size(); i++)
1520                        	        {
1521                        		    // module was disabled successfully
1522 kumpf         1.68     	            if (_opStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPED)
1523 kumpf         1.43     	            {
1524 kumpf         1.55     			if (indProvider)
1525                        			{
1526                        	 	            // send termination message to subscription service
1527                        		            _sendTerminationMessageToSubscription(objectReference,
1528                        				  moduleName, false, al);
1529                        			}
1530 kumpf         1.43     		        return (0);
1531                        	            }
1532 kumpf         1.51     
1533                        		    // module is not disabled since there are pending
1534                                            // requests for the providers in the module
1535 kumpf         1.68                         if (_opStatus[i] == CIM_MSE_OPSTATUS_VALUE_OK)
1536 kumpf         1.51                         {
1537                                                return (-2);
1538                                            }
1539 kumpf         1.43     	        }
1540                        	    }
1541                        	    else // disable provider
1542                        	    {
1543 kumpf         1.55     		if (indProvider)
1544                        		{
1545                        	            _sendTerminationMessageToSubscription(objectReference,
1546 chuck         1.47     			moduleName, true, al);
1547 kumpf         1.55     		}
1548 kumpf         1.43     	        return (0);
1549                        	    }
1550                          	}
1551                        
1552                                // disable failed
1553                        	return (-1);
1554 kumpf         1.55     }
1555                        
1556 r.kieninger   1.92.4.1 // enable provider module
1557 kumpf         1.56     // return 0 if module is enabled successfully,
1558                        // return 1 if module is already enabled,
1559                        // return 2 if module can not be enabled since module is stopping,
1560 r.kieninger   1.92.4.1 // otherwise, return -1
1561 kumpf         1.56     Sint16 ProviderRegistrationProvider::_enableModule(
1562 r.kieninger   1.92.4.1     const CIMObjectPath & moduleRef,
1563 kumpf         1.56         const String & moduleName,
1564 kumpf         1.83         const AcceptLanguageList & al)
1565 kumpf         1.56     {
1566                            	//
1567                            	// get module status
1568                            	//
1569                            	Array<Uint16> _OperationalStatus =
1570                        	    _providerRegistrationManager->getProviderModuleStatus( moduleName);
1571                        
1572                        	for (Uint32 i = 0; i<_OperationalStatus.size(); i++)
1573                        	{
1574                        	    // retValue equals 1 if module is already enabled
1575 kumpf         1.68     	    if (_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_OK)
1576 kumpf         1.56     	    {
1577                        		return (1);
1578                        	    }
1579                        
1580                        	    // retValue equals 2 if module is stopping
1581                        	    // at this stage, module can not be started
1582 kumpf         1.68     	    if (_OperationalStatus[i] == CIM_MSE_OPSTATUS_VALUE_STOPPING)
1583 kumpf         1.56     	    {
1584                                        return (2);
1585                        	    }
1586                        	}
1587                        
1588                                // get module instance
1589 r.kieninger   1.92.4.1         CIMInstance mInstance =
1590 kumpf         1.56     	    _providerRegistrationManager->getInstance(moduleRef);
1591                        
1592                        	//
1593                                // get provider manager service
1594                                //
1595                                MessageQueueService * _service = _getProviderManagerService();
1596                        	Boolean enabled = false;
1597                        
1598 kumpf         1.65             if (_service != NULL)
1599 kumpf         1.56     	{
1600                        	    // create CIMEnableModuleRequestMessage
1601                        	    CIMEnableModuleRequestMessage * enable_req =
1602                        	        new CIMEnableModuleRequestMessage(
1603                        		    XmlWriter::getNextMessageId (),
1604                        		    mInstance,
1605                        		    QueueIdStack(_service->getQueueId()));
1606                        // l10n
1607 r.kieninger   1.92.4.1         enable_req->operationContext.set(AcceptLanguageListContainer(al));;
1608 se.gupta      1.66     		
1609 kumpf         1.56       	    Array<Uint16> _opStatus;
1610                                    _opStatus = _sendEnableMessageToProviderManager(enable_req);
1611                        
1612                        	    for (Uint32 i = 0; i<_opStatus.size(); i++)
1613                        	    {
1614                        		// module is enabled successfully
1615 kumpf         1.68     	        if (_opStatus[i] == CIM_MSE_OPSTATUS_VALUE_OK)
1616 kumpf         1.56     	        {
1617                        		    enabled = true;
1618                        	        }
1619                        	    }
1620                        	}
1621                        
1622                        	if (enabled)
1623                        	{
1624                        	    //
1625 kumpf         1.59     	    // Since module is enabled, need get updated module instance
1626                        	    //
1627 r.kieninger   1.92.4.1             CIMInstance updatedModuleInstance =
1628 kumpf         1.59     	        _providerRegistrationManager->getInstance(moduleRef);
1629                        
1630 kumpf         1.65     	    // module is enabled, initialize providers as necessary
1631                        	    _providerRegistrationManager->initializeProviders(
1632                        		updatedModuleInstance);
1633                        
1634 kumpf         1.59     	    //
1635 r.kieninger   1.92.4.1 	    // The module is enabled, need to send enable message to
1636 kumpf         1.56     	    // subscription service if the provider is an indication provider
1637                        	    //
1638                        
1639                        	    CIMObjectPath providerRef = CIMObjectPath(String::EMPTY,
1640                        				    moduleRef.getNameSpace(),
1641                        				    PEGASUS_CLASSNAME_PROVIDER,
1642                        				    Array<CIMKeyBinding>());
1643                        
1644                        	    //
1645                        	    // get all provider instances which have same module name as
1646                        	    // moduleName
1647                                    //
1648                        	    Array<CIMObjectPath> instanceNames =
1649 kumpf         1.91     	        _providerRegistrationManager->enumerateInstanceNamesForClass(
1650                                            providerRef);
1651 kumpf         1.56     	    CIMInstance pInstance;
1652                        	    String _moduleName;
1653                        	    String _providerName;
1654                        	    Array<CIMInstance> capInstances;
1655                        
1656                        	    for(Uint32 i = 0, n=instanceNames.size(); i < n; i++)
1657                        	    {
1658                        
1659                                        Array<CIMKeyBinding> keys = instanceNames[i].getKeyBindings();
1660                        
1661                                        for(Uint32 j=0; j < keys.size(); j++)
1662                                        {
1663                        	            //
1664                                            // get provider module name from reference
1665                                            //
1666                                            if(keys[j].getName().equal (_PROPERTY_PROVIDERMODULENAME))
1667                                            {
1668                                                _moduleName = keys[j].getValue();
1669                                            }
1670                        
1671                        	            //
1672 kumpf         1.56                         // get provider name from reference
1673                                            //
1674                                            if(keys[j].getName().equal (_PROPERTY_PROVIDER_NAME))
1675                                            {
1676                                                _providerName = keys[j].getValue();
1677                                            }
1678                                        }
1679                        
1680                        	        if (String::equalNoCase(_moduleName, moduleName))
1681                        	        {
1682                        	 	    providerRef.setKeyBindings(keys);
1683                        	            pInstance = _providerRegistrationManager->getInstance
1684                        			(providerRef);
1685 r.kieninger   1.92.4.1 		    //
1686                        		    // get all the indication capability instances which belongs
1687 kumpf         1.56     		    // to this provider
1688                        		    //
1689                        		    capInstances = _getIndicationCapInstances(
1690                        				   moduleName, pInstance, providerRef);
1691                        
1692                        		    //
1693                        		    // if there are indication capability instances
1694                        		    //
1695 kumpf         1.71                         if (capInstances.size() != 0)
1696 kumpf         1.56     		    {
1697 kumpf         1.65     		        _sendEnableMessageToSubscription(updatedModuleInstance,
1698 kumpf         1.56     		  					 pInstance,
1699                        						     	 capInstances,
1700                        							 al);
1701                        		    }
1702 r.kieninger   1.92.4.1 	        }
1703 kumpf         1.56     	    }
1704                        	    return (0);
1705                        	}
1706                        
1707                        
1708                                // enable failed
1709                        	return (-1);
1710                        }
1711                        
1712                        // send enable message to indication service
1713                        void ProviderRegistrationProvider::_sendEnableMessageToSubscription(
1714                            const CIMInstance & mInstance,
1715                            const CIMInstance & pInstance,
1716                            const Array<CIMInstance> & capInstances,
1717 kumpf         1.83         const AcceptLanguageList & al)
1718 kumpf         1.56     {
1719                            //
1720                            // get indication server queueId
1721                            //
1722                            MessageQueueService * _service = _getIndicationService();
1723                        
1724                            if (_service != NULL)
1725                            {
1726                            	Uint32 _queueId = _service->getQueueId();
1727 r.kieninger   1.92.4.1 	
1728                            	CIMNotifyProviderEnableRequestMessage * enable_req =
1729 kumpf         1.56     		new CIMNotifyProviderEnableRequestMessage (
1730                        		    XmlWriter::getNextMessageId (),
1731                        		    capInstances,
1732                        		    QueueIdStack(_service->getQueueId()));
1733                        
1734 se.gupta      1.66     	enable_req->operationContext.set(AcceptLanguageListContainer(al));
1735 se.gupta      1.67         enable_req->operationContext.insert(ProviderIdContainer(mInstance,pInstance));
1736 se.gupta      1.66     	
1737 kumpf         1.56     	// create request envelope
1738                                AsyncLegacyOperationStart * asyncRequest =
1739                                    new AsyncLegacyOperationStart (
1740                                        NULL,
1741                                        _queueId,
1742                                        enable_req,
1743                                        _queueId);
1744 r.kieninger   1.92.4.1 	
1745                        	AsyncReply * asyncReply =
1746 kumpf         1.89     	    _controller->ClientSendWait(_queueId, asyncRequest);
1747 kumpf         1.56     
1748 kumpf         1.64             CIMNotifyProviderEnableResponseMessage * response =
1749                        	    reinterpret_cast<CIMNotifyProviderEnableResponseMessage *>(
1750 kumpf         1.70     		(dynamic_cast<AsyncLegacyOperationResult *>(asyncReply))->get_result());
1751 kumpf         1.64     
1752                                if (response->cimException.getCode() != CIM_ERR_SUCCESS)
1753 david.dillard 1.78             {
1754                                    CIMException e = response->cimException;
1755                                    delete asyncRequest;
1756                                    delete asyncReply;
1757                                    delete response;
1758                                    throw e;
1759                                }
1760 kumpf         1.64     
1761                                delete asyncRequest;
1762                                delete asyncReply;
1763                                delete response;
1764 kumpf         1.56         }
1765                        }
1766                        
1767 kumpf         1.70     // If provider is an indication provider, return true,
1768 kumpf         1.55     // otherwise, return false
1769                        Boolean ProviderRegistrationProvider::_isIndicationProvider(
1770                            const String & moduleName,
1771 kumpf         1.70         const CIMInstance & instance)
1772 kumpf         1.55     {
1773                            // get provider name
1774                            String providerName;
1775 kumpf         1.70         Uint32 pos = instance.findProperty(_PROPERTY_PROVIDER_NAME);
1776 kumpf         1.55         if (pos != PEG_NOT_FOUND)
1777                            {
1778                        	instance.getProperty(pos).getValue().get(providerName);	
1779                            }
1780                        
1781 kumpf         1.70         return (_providerRegistrationManager->isIndicationProvider(
1782                        	    moduleName, providerName));
1783 kumpf         1.56     }
1784                        
1785                        //
1786 r.kieninger   1.92.4.1 // get all the capability instances whose provider type is indication
1787                        //
1788 kumpf         1.56     Array<CIMInstance> ProviderRegistrationProvider::_getIndicationCapInstances(
1789                            const String & moduleName,
1790                            const CIMInstance & instance,
1791                            const CIMObjectPath & providerRef)
1792                        {
1793                            // get provider name
1794                            String providerName;
1795                            Uint32 pos = instance.findProperty(CIMName (_PROPERTY_PROVIDER_NAME));
1796                            if (pos != PEG_NOT_FOUND)
1797                            {
1798                        	instance.getProperty(pos).getValue().get(providerName);	
1799                            }
1800                        
1801                            CIMObjectPath capabilityRef;
1802                        
1803                            capabilityRef = CIMObjectPath(providerRef.getHost(),
1804                        				  providerRef.getNameSpace(),
1805 kumpf         1.91     		       		  PEGASUS_CLASSNAME_PROVIDERCAPABILITIES,
1806 kumpf         1.56     		       		  providerRef.getKeyBindings());
1807                        
1808                            // get all Capabilities instances
1809                            Array<CIMObjectPath> instanceNames =
1810 kumpf         1.91     	_providerRegistrationManager->enumerateInstanceNamesForClass(
1811                                    capabilityRef);
1812 kumpf         1.56     			
1813                            String _moduleName, _providerName;
1814                            CIMInstance capInstance;
1815                            Array<Uint16> providerTypes;
1816                            Array<CIMInstance> indCapInstances = 0;
1817                            for(Uint32 i = 0, n=instanceNames.size(); i < n; i++)
1818                            {
1819                        	Array<CIMKeyBinding> keys = instanceNames[i].getKeyBindings();
1820                        
1821                        	for(Uint32 j=0; j < keys.size(); j++)
1822                                {
1823                                     if(keys[j].getName().equal (_PROPERTY_PROVIDERMODULENAME))
1824                                     {
1825                                          _moduleName = keys[j].getValue();
1826                                     }
1827                        
1828                                     if(keys[j].getName().equal (_PROPERTY_PROVIDERNAME))
1829                                     {
1830                                          _providerName = keys[j].getValue();
1831                                     }
1832 kumpf         1.58     	}
1833 kumpf         1.56     
1834 kumpf         1.58            //
1835                               // if capability instance has same module name as moduleName
1836                               // and same provider name as providerName, get provider type
1837                               //
1838                               if(String::equal(_moduleName, moduleName) &&
1839                                  String::equal(_providerName, providerName))
1840                               {
1841                        	    capInstance = _providerRegistrationManager->getInstance
1842 kumpf         1.56     				(instanceNames[i]);
1843                        
1844 kumpf         1.58     	    Uint32 pos = capInstance.findProperty(CIMName (_PROPERTY_PROVIDERTYPE));
1845                            	    if (pos != PEG_NOT_FOUND)
1846                        	    {
1847 r.kieninger   1.92.4.1 	        capInstance.getProperty(pos).getValue().get(providerTypes);
1848 kumpf         1.56     
1849 kumpf         1.58         		for (Uint32 k=0; k < providerTypes.size(); k++)
1850                            		{
1851 r.kieninger   1.92.4.1 		    //
1852 kumpf         1.58     		    // if provider type of the instance is indication,
1853 r.kieninger   1.92.4.1 		    // append the instance
1854 kumpf         1.58     		    //
1855                                	    if (providerTypes[k] == _INDICATION_PROVIDER)
1856                                	    {
1857                                    	        indCapInstances.append(capInstance);
1858                                	    }
1859                            		}
1860                        	    }
1861                        	}
1862 kumpf         1.56         }
1863                        
1864                            return (indCapInstances);
1865 kumpf         1.1      }
1866                        
1867                        PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2